Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tools/3dsmaxExport/LEXIExporter/LexiExport/Sources/LexiIntermediateMesh.h @ 45

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

=…

File size: 4.2 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_IntermediateMesh__
28#define __NDS_LexiExporter_IntermediateMesh__
29
30//
31
32class CIntermediateMesh : public Ogre::MovableObject {
33
34        friend class CIntermediateBuilder;
35
36        private:
37
38                typedef struct {
39
40                        unsigned int m_iTime;
41                        CMeshArray* m_pArray;
42
43                } MeshArray;
44
45                typedef struct {
46
47                        Ogre::String    m_sPoseName;
48                        unsigned int    m_iTime;
49                        bool                    m_bOptimize;
50
51                } PoseData;
52
53                typedef struct {
54
55                        PoseData                m_poseData;
56                        Ogre::String    m_sAnimName;
57                        unsigned int    m_iStartFrame;
58                        unsigned int    m_iEndFrame;
59                        float                   m_fSampleRate;
60
61                } PoseAnimData;
62
63        private:
64
65                void BuildMaterialList();
66
67                unsigned int m_iNumTriangles;
68                CTriangleArray m_Triangles;
69
70                typedef std::map<std::string, MeshArray*> ArrayMap;
71                ArrayMap m_Arrays;
72
73                fastvector<CIntermediateMaterial*> m_Materials;
74
75                CIntermediateSkeleton* m_pISkeleton;
76
77                std::map< Ogre::String ,PoseData > m_lPoseList;
78                std::map< Ogre::String, PoseAnimData > m_lPoseAnims;
79
80                unsigned int* m_pIndexTable;
81                unsigned int* m_pPickIndexTable;
82                unsigned int m_iIndexCount;
83
84        protected:
85
86                unsigned int m_iNodeID;
87                bool    m_bIsCollapsed;
88
89                //
90
91                CIntermediateMesh(unsigned int iNumTriangles, unsigned int iNodeID);
92
93                void ForceCreateArray(const char* pszName);
94
95                //
96
97        virtual const Ogre::String& getMovableType(void) const;
98        virtual const Ogre::AxisAlignedBox& getBoundingBox(void) const;
99                virtual Ogre::Real getBoundingRadius(void) const;
100        virtual void _updateRenderQueue(Ogre::RenderQueue* queue);
101
102        public:
103
104                // Destructor
105                ~CIntermediateMesh();
106
107                //
108                //  Triangle
109
110                // Get number of triangles
111                unsigned int GetNumTriangles() const;
112
113                // Get reference to triangle
114                CTriangle& GetTriangle(unsigned int iIndex);
115                const CTriangle& GetTriangle(unsigned int iIndex) const;
116
117                // Get reference to entire triangle array
118                CTriangleArray& GetTriangles();
119                const CTriangleArray& GetTriangles() const;
120
121                // Get triangle indices using a specific material
122                void GetTrianglesUsingMaterial(CIntermediateMaterial* pMaterial, std::vector<unsigned int>& Triangles) const;
123
124                //
125                //  Array
126
127                // Get array
128                CMeshArray* GetArray(const char* pszName, TimeValue iTime);
129
130                bool IsCollapsed( void );
131
132                //
133                //  Material
134
135                // Get number of materials
136                unsigned int GetNumMaterials() const;
137
138                // Get material
139                CIntermediateMaterial* GetMaterial(unsigned int iIndex) const;
140
141                //
142                // Skeleton
143                void SetSkeleton( CIntermediateSkeleton* pSkel );
144                CIntermediateSkeleton* GetSkeleton( void );
145
146                //
147                // Pose
148                bool AddPose(Ogre::String name, unsigned int frame, bool bOptimize);
149                bool HasPoseData( void );
150                unsigned int GetPoseCount( void );
151                bool GetPose(unsigned int index, Ogre::String& poseName, unsigned int& frameRef, bool& optimize);
152
153                bool AddPoseAnimation(const char* pszAnimName, unsigned int iStartFrame, unsigned int iEndFrame, float fRate, bool bOptimize);
154                unsigned int GetPoseAnimCount( void );
155                bool GetPoseAnimation(unsigned int index, Ogre::String& poseName, unsigned int& iStartFrame, unsigned int& iEndFrame, float& fRate, bool& bOptimize);
156
157               
158                //
159                //  Utilities
160
161                // Reindex vertices
162
163                void Reindex(const fastvector<CMeshArray*>& ArrayList);
164                void PostReindex(const fastvector<CMeshArray*>& ArrayList);
165
166};
167
168//
169
170#endif // __NDS_LexiExporter_IntermediateMesh__
Note: See TracBrowser for help on using the repository browser.