[6] | 1 | /* |
---|
| 2 | ----------------------------------------------------------------------------- |
---|
| 3 | This source file is part of OGRE |
---|
| 4 | (Object-oriented Graphics Rendering Engine) |
---|
| 5 | For the latest info, see http://www.ogre3d.org/ |
---|
| 6 | |
---|
| 7 | Copyright (c) 2000-2006 The OGRE Team |
---|
| 8 | Also see acknowledgements in Readme.html |
---|
| 9 | |
---|
| 10 | This program is free software; you can redistribute it and/or modify it under |
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
| 13 | version. |
---|
| 14 | |
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
| 23 | ----------------------------------------------------------------------------- |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | #if !defined(__OGREMAX_MESHXML_EXPORTER_H__) |
---|
| 27 | #define __OGREMAX_MESHXML_EXPORTER_H__ |
---|
| 28 | |
---|
| 29 | #include "OgreMaxConfig.h" |
---|
| 30 | #include "OgreMaxExport.h" |
---|
| 31 | |
---|
| 32 | #include <string> |
---|
| 33 | #include <queue> |
---|
| 34 | #include <map> |
---|
| 35 | #include "tab.h" |
---|
| 36 | |
---|
| 37 | class MaterialMap; |
---|
| 38 | class IGameScene; |
---|
| 39 | class IGameNode; |
---|
| 40 | class IGameObject; |
---|
| 41 | class IGameMaterial; |
---|
| 42 | |
---|
| 43 | namespace OgreMax { |
---|
| 44 | |
---|
| 45 | class MeshXMLExporter : public OgreMaxExporter, public ITreeEnumProc |
---|
| 46 | { |
---|
| 47 | typedef struct { |
---|
| 48 | std::string name; |
---|
| 49 | int start; |
---|
| 50 | int end; |
---|
| 51 | } NamedAnimation; |
---|
| 52 | |
---|
| 53 | public: |
---|
| 54 | typedef std::map< std::string, std::string > OutputMap; |
---|
| 55 | |
---|
| 56 | MeshXMLExporter(const Config& config, MaterialMap& materialMap); |
---|
| 57 | virtual ~MeshXMLExporter(); |
---|
| 58 | |
---|
| 59 | // generates a list of INode* for assembly into Ogre::Mesh form; returns |
---|
| 60 | // a map of filename --> XML stringstream. |
---|
| 61 | bool buildMeshXML(OutputMap& output); |
---|
| 62 | |
---|
| 63 | protected: |
---|
| 64 | // mesh file stream functions |
---|
| 65 | bool streamFileHeader(std::ostream &of); |
---|
| 66 | bool streamFileFooter(std::ostream &of); |
---|
| 67 | bool streamSubmesh(std::ostream &of, IGameObject *obj, std::string &mtlName); |
---|
| 68 | bool streamBoneAssignments(std::ostream &of, Modifier *mod, IGameNode *node); |
---|
| 69 | |
---|
| 70 | int getBoneIndex(char *name); |
---|
| 71 | std::string removeSpaces(const std::string &s); |
---|
| 72 | |
---|
| 73 | int callback(INode *node); |
---|
| 74 | |
---|
| 75 | private: |
---|
| 76 | |
---|
| 77 | bool export(OutputMap& output); |
---|
| 78 | |
---|
| 79 | bool m_createSkeletonLink; |
---|
| 80 | std::string m_exportFilename; // filename provided by |
---|
| 81 | std::string m_filename; // filename provided by |
---|
| 82 | std::string m_skeletonFilename; |
---|
| 83 | std::queue< std::string > m_submeshNames; |
---|
| 84 | MaterialMap& m_materialMap; |
---|
| 85 | std::map< std::string, int > m_boneIndexMap; |
---|
| 86 | int m_currentBoneIndex; |
---|
| 87 | |
---|
| 88 | IGameScene* m_pGame; |
---|
| 89 | Tab<INode*> m_nodeTab; |
---|
| 90 | }; |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | #endif |
---|