| 1 | /* |
|---|
| 2 | ----------------------------------------------------------------------------- |
|---|
| 3 | This source file is part of LEXIExporter |
|---|
| 4 | |
|---|
| 5 | Copyright 2006 NDS Limited |
|---|
| 6 | |
|---|
| 7 | Author(s): |
|---|
| 8 | Mark Folkenberg, |
|---|
| 9 | Bo Krohn |
|---|
| 10 | |
|---|
| 11 | This program is free software; you can redistribute it and/or modify it under |
|---|
| 12 | the terms of the GNU Lesser General Public License as published by the Free Software |
|---|
| 13 | Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 14 | version. |
|---|
| 15 | |
|---|
| 16 | This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 18 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|---|
| 19 | |
|---|
| 20 | You should have received a copy of the GNU Lesser General Public License along with |
|---|
| 21 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 22 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
|---|
| 23 | http://www.gnu.org/copyleft/lesser.txt. |
|---|
| 24 | ----------------------------------------------------------------------------- |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | #include "LexiIntermediateAPI.h" |
|---|
| 28 | #include "LexiOgreSkeletonCompiler.h" |
|---|
| 29 | |
|---|
| 30 | class COgreMeshCompiler |
|---|
| 31 | { |
|---|
| 32 | public: |
|---|
| 33 | |
|---|
| 34 | COgreMeshCompiler( CIntermediateMesh* pIntermediateMesh, const CDDObject* pConfig, Ogre::String filename ); |
|---|
| 35 | virtual ~COgreMeshCompiler(); |
|---|
| 36 | |
|---|
| 37 | bool WriteOgreMesh( const Ogre::String& sFilename ); |
|---|
| 38 | |
|---|
| 39 | Ogre::MeshPtr GetOgreMesh( void ); |
|---|
| 40 | |
|---|
| 41 | protected: |
|---|
| 42 | |
|---|
| 43 | void InitializeOgreComponents( void ); |
|---|
| 44 | |
|---|
| 45 | void CreateOgreMesh( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 46 | void CreateSubMeshes( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 47 | void CreateBuffers( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 48 | void CreateIndexBuffer( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 49 | void CreateVertexBuffer( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 50 | void CreateNormalBuffer( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 51 | void CreateDiffuseBuffer( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 52 | void CreateTexCoordBuffer( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 53 | void CreatePoseBuffers( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 54 | void CreateMeshBounds( void ); |
|---|
| 55 | void PrintVertexDataToLog( void ); |
|---|
| 56 | |
|---|
| 57 | void SetBoneAssignments( const CTriangle& face, CIntermediateMesh* pIntermediateMesh ); |
|---|
| 58 | |
|---|
| 59 | private: |
|---|
| 60 | |
|---|
| 61 | void ReadConfig( const CDDObject* pConfig ); |
|---|
| 62 | void ReindexIntermediateBuffers( CIntermediateMesh* pIntermediateMesh ); |
|---|
| 63 | |
|---|
| 64 | unsigned int CreatePose( CIntermediateMesh* pIntermediateMesh, Ogre::String name, unsigned int iFrame, bool bOptimize ); |
|---|
| 65 | unsigned int m_iNrPoses; |
|---|
| 66 | |
|---|
| 67 | Ogre::MeshPtr m_pOgreMesh; |
|---|
| 68 | Ogre::Real m_MaxSquaredLength; |
|---|
| 69 | Ogre::AxisAlignedBox m_AABB; |
|---|
| 70 | int m_iBind; |
|---|
| 71 | |
|---|
| 72 | bool m_bReindex; |
|---|
| 73 | bool m_bExportNormals; |
|---|
| 74 | bool m_bExportColours; |
|---|
| 75 | bool m_bExportTexUVs; |
|---|
| 76 | bool m_bExportSkeleton; |
|---|
| 77 | |
|---|
| 78 | COgreSkeletonCompiler* m_pSkeletonCompiler; |
|---|
| 79 | |
|---|
| 80 | Ogre::HardwareIndexBuffer::IndexType m_IndexBitType; |
|---|
| 81 | std::map<CIntermediateMaterial*, Ogre::SubMesh*> m_lMaterialSubMeshMap; |
|---|
| 82 | |
|---|
| 83 | Ogre::HardwareVertexBufferSharedPtr vBuf; |
|---|
| 84 | unsigned int m_iNrVerts; |
|---|
| 85 | |
|---|
| 86 | }; |
|---|