Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/3dsmaxExport/LEXIExporter/LexiExport/Sources/LexiIntermediateBuilder.h @ 6

Last change on this file since 6 was 6, checked in by anonymous, 17 years ago

=…

File size: 4.0 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of LEXIExporter
4
5Copyright 2006 NDS Limited
6
7Author(s):
8Mark Folkenberg,
9Bo Krohn
10
11This program is free software; you can redistribute it and/or modify it under
12the terms of the GNU Lesser General Public License as published by the Free Software
13Foundation; either version 2 of the License, or (at your option) any later
14version.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
19
20You should have received a copy of the GNU Lesser General Public License along with
21this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22Place - Suite 330, Boston, MA 02111-1307, USA, or go to
23http://www.gnu.org/copyleft/lesser.txt.
24-----------------------------------------------------------------------------
25*/
26
27#ifndef __NDS_LexiExporter_IntermediateBuilder__
28#define __NDS_LexiExporter_IntermediateBuilder__
29
30//
31
32class CIntermediateBuilderSkeleton;
33
34
35class CIntermediateBuilder {
36
37        friend class CIntermediateMesh;
38
39        public:
40
41                // Constructor/Destructor
42                CIntermediateBuilder();
43                ~CIntermediateBuilder();
44
45                // Get pointer to intermediate builder
46                static CIntermediateBuilder* Get();
47
48                // Clear everything (cached materials, etc.)
49                void Clear();
50
51                void CleanUpHierarchy( Ogre::SceneNode* pNode );
52
53                void SetConfig( CDDObject* pConfig );
54
55                // Get built hierarchy
56                Ogre::SceneNode* CreateHierarchy(unsigned int iNodeID, bool bRecursive, bool bHidden);
57
58                // Collapse hierarchy
59                Ogre::SceneNode* CollapseHierarchy(Ogre::SceneNode* pHierarchy, const std::list<std::string>& Arrays, const char* pszName);
60
61                // Get the list of active intermediate materials
62                bool GetMaterials( std::map<Ogre::String, CIntermediateMaterial*>& materialMap ) const;
63
64                // Transform Max coord system to Ogre
65                static void Rotate90DegreesAroundX( Point3& inVec );
66                static void Rotate90DegreesAroundX( Quat& inQuat );
67
68                Ogre::String GetAnimationName( void );
69                float GetAnimationLength( void );
70
71                CIntermediateBuilderSkeleton* GetSkeletonBuilder( void );
72
73                // Material Map
74                std::map<Ogre::String, CIntermediateMaterial*>  m_lMaterials;
75
76
77        protected:
78
79                CMeshArray* BuildMeshArray(unsigned int iNodeID, const char* pszTypeName, TimeValue iTime);
80
81                // Build and track Intermediate Materials
82                CIntermediateMaterial* CreateMaterial( Mtl* pMaxMaterial );
83
84                void RegisterMaps( CIntermediateMaterial* pIMat, Mtl* pMaxMaterial ) ;
85
86        private:
87
88                Ogre::SceneNode* CreateHierarchy(unsigned int iNodeID, Ogre::SceneNode* pParent, bool bRecursive, bool bHidden);
89                CIntermediateMesh* CreateMesh(unsigned int iNodeID);
90
91                int m_iBoneIndex;
92                bool FindSkinModifier(INode* nodePtr, Modifier** pSkinMod,ISkin** pSkin, ISkinContextData** pSkinContext);
93                void CreateIntermediateBonePool(CIntermediateSkeleton* pSkel, ISkin* pSkin);
94                void ConnectLinkedBones(CIntermediateSkeleton* pSkel);
95                void BuildSkeleton( CIntermediateSkeleton* pSkel );
96                void AddFrame( CIntermediateSkeleton* pSkel, unsigned int meshNodeID, CAnimationSetting animSetting);
97                void SetBindingPose( CIntermediateSkeleton* pISkel, unsigned int meshNodeID, unsigned int frame );
98
99                void CountTriangles(Ogre::SceneNode* pNode, unsigned int& iNumTriangles) const;
100                void CollapseHierarchy(CIntermediateMesh* pMesh, unsigned int& iTriangleOffset, unsigned int& iVertexOffset, Ogre::SceneNode* pNode, const std::list<std::string>& Arrays, const Ogre::Matrix4& mat) const;
101
102                static void Clamp( Point3& inVec, float threshold );
103
104                CIntermediateBuilderSkeleton* m_pSkeletonBuilder;
105
106                CAnimSettings   m_AnimationSetting;
107
108                bool                    m_bExportSkeleton;
109                int                             m_iAnimStart;
110                int                             m_iAnimEnd;
111                float                   m_fSampleRate;
112                Ogre::String    m_sAnimationName;
113                float                   m_fAnimTotalLength;
114
115                // record the created intermediate objects
116                std::vector< CIntermediateMesh* > m_lIMPool;
117};
118
119//
120
121#endif // __NDS_LexiExporter_IntermediateBuilder__
Note: See TracBrowser for help on using the repository browser.