OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreMeshFileFormat.h
Go to the documentation of this file.
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-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __MeshFileFormat_H__
29 #define __MeshFileFormat_H__
30 
31 #include "OgrePrerequisites.h"
32 
33 namespace Ogre {
34 
58  enum MeshChunkID {
59  M_HEADER = 0x1000,
60  // char* version : Version number check
61  M_MESH = 0x3000,
62  // bool skeletallyAnimated // important flag which affects h/w buffer policies
63  // Optional M_GEOMETRY chunk
64  M_SUBMESH = 0x4000,
65  // char* materialName
66  // bool useSharedVertices
67  // unsigned int indexCount
68  // bool indexes32Bit
69  // unsigned int* faceVertexIndices (indexCount)
70  // OR
71  // unsigned short* faceVertexIndices (indexCount)
72  // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
73  M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
74  // unsigned short operationType
76  // Optional bone weights (repeating section)
77  // unsigned int vertexIndex;
78  // unsigned short boneIndex;
79  // float weight;
80  // Optional chunk that matches a texture name to an alias
81  // a texture alias is sent to the submesh material to use this texture name
82  // instead of the one in the texture unit with a matching alias name
83  M_SUBMESH_TEXTURE_ALIAS = 0x4200, // Repeating section
84  // char* aliasName;
85  // char* textureName;
86 
87  M_GEOMETRY = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
88  // unsigned int vertexCount
90  M_GEOMETRY_VERTEX_ELEMENT = 0x5110, // Repeating section
91  // unsigned short source; // buffer bind source
92  // unsigned short type; // VertexElementType
93  // unsigned short semantic; // VertexElementSemantic
94  // unsigned short offset; // start offset in buffer in bytes
95  // unsigned short index; // index of the semantic (for colours and texture coords)
96  M_GEOMETRY_VERTEX_BUFFER = 0x5200, // Repeating section
97  // unsigned short bindIndex; // Index to bind this buffer to
98  // unsigned short vertexSize; // Per-vertex size, must agree with declaration at this index
100  // raw buffer data
102  // Optional link to skeleton
103  // char* skeletonName : name of .skeleton to use
105  // Optional bone weights (repeating section)
106  // unsigned int vertexIndex;
107  // unsigned short boneIndex;
108  // float weight;
110  // Optional LOD information
111  // string strategyName;
112  // unsigned short numLevels;
113  // bool manual; (true for manual alternate meshes, false for generated)
115  // Repeating section, ordered in increasing depth
116  // NB LOD 0 (full detail from 0 depth) is omitted
117  // LOD value - this is a distance, a pixel count etc, based on strategy
118  // float lodValue;
120  // Required if M_MESH_LOD section manual = true
121  // String manualMeshName;
123  // Required if M_MESH_LOD section manual = false
124  // Repeating section (1 per submesh)
125  // unsigned int indexCount;
126  // bool indexes32Bit
127  // unsigned short* faceIndexes; (indexCount)
128  // OR
129  // unsigned int* faceIndexes; (indexCount)
130  M_MESH_BOUNDS = 0x9000,
131  // float minx, miny, minz
132  // float maxx, maxy, maxz
133  // float radius
134 
135  // Added By DrEvil
136  // optional chunk that contains a table of submesh indexes and the names of
137  // the sub-meshes.
139  // Subchunks of the name table. Each chunk contains an index & string
141  // short index
142  // char* name
143 
144  // Optional chunk which stores precomputed edge data
145  M_EDGE_LISTS = 0xB000,
146  // Each LOD has a separate edge list
147  M_EDGE_LIST_LOD = 0xB100,
148  // unsigned short lodIndex
149  // bool isManual // If manual, no edge data here, loaded from manual mesh
150  // bool isClosed
151  // unsigned long numTriangles
152  // unsigned long numEdgeGroups
153  // Triangle* triangleList
154  // unsigned long indexSet
155  // unsigned long vertexSet
156  // unsigned long vertIndex[3]
157  // unsigned long sharedVertIndex[3]
158  // float normal[4]
159 
160  M_EDGE_GROUP = 0xB110,
161  // unsigned long vertexSet
162  // unsigned long triStart
163  // unsigned long triCount
164  // unsigned long numEdges
165  // Edge* edgeList
166  // unsigned long triIndex[2]
167  // unsigned long vertIndex[2]
168  // unsigned long sharedVertIndex[2]
169  // bool degenerate
170 
171  // Optional poses section, referred to by pose keyframes
172  M_POSES = 0xC000,
173  M_POSE = 0xC100,
174  // char* name (may be blank)
175  // unsigned short target // 0 for shared geometry,
176  // 1+ for submesh index + 1
177  // bool includesNormals [1.8+]
178  M_POSE_VERTEX = 0xC111,
179  // unsigned long vertexIndex
180  // float xoffset, yoffset, zoffset
181  // float xnormal, ynormal, znormal (optional, 1.8+)
182  // Optional vertex animation chunk
183  M_ANIMATIONS = 0xD000,
184  M_ANIMATION = 0xD100,
185  // char* name
186  // float length
188  // [Optional] base keyframe information (pose animation only)
189  // char* baseAnimationName (blank for self)
190  // float baseKeyFrameTime
191 
193  // unsigned short type // 1 == morph, 2 == pose
194  // unsigned short target // 0 for shared geometry,
195  // 1+ for submesh index + 1
197  // float time
198  // bool includesNormals [1.8+]
199  // float x,y,z // repeat by number of vertices in original geometry
201  // float time
202  M_ANIMATION_POSE_REF = 0xD113, // repeat for number of referenced poses
203  // unsigned short poseIndex
204  // float influence
205 
206  // Optional submesh extreme vertex list chink
208  // unsigned short submesh_index;
209  // float extremes [n_extremes][3];
210 
211  /* Version 1.2 of the .mesh format (deprecated)
212  enum MeshChunkID {
213  M_HEADER = 0x1000,
214  // char* version : Version number check
215  M_MESH = 0x3000,
216  // bool skeletallyAnimated // important flag which affects h/w buffer policies
217  // Optional M_GEOMETRY chunk
218  M_SUBMESH = 0x4000,
219  // char* materialName
220  // bool useSharedVertices
221  // unsigned int indexCount
222  // bool indexes32Bit
223  // unsigned int* faceVertexIndices (indexCount)
224  // OR
225  // unsigned short* faceVertexIndices (indexCount)
226  // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
227  M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
228  // unsigned short operationType
229  M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
230  // Optional bone weights (repeating section)
231  // unsigned int vertexIndex;
232  // unsigned short boneIndex;
233  // float weight;
234  M_GEOMETRY = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
235  */
236  // unsigned int vertexCount
237  // float* pVertices (x, y, z order x numVertices)
238  M_GEOMETRY_NORMALS = 0x5100, //(Optional)
239  // float* pNormals (x, y, z order x numVertices)
240  M_GEOMETRY_COLOURS = 0x5200, //(Optional)
241  // unsigned long* pColours (RGBA 8888 format x numVertices)
242  M_GEOMETRY_TEXCOORDS = 0x5300 //(Optional, REPEATABLE, each one adds an extra set)
243  // unsigned short dimensions (1 for 1D, 2 for 2D, 3 for 3D)
244  // float* pTexCoords (u [v] [w] order, dimensions x numVertices)
245  /*
246  M_MESH_SKELETON_LINK = 0x6000,
247  // Optional link to skeleton
248  // char* skeletonName : name of .skeleton to use
249  M_MESH_BONE_ASSIGNMENT = 0x7000,
250  // Optional bone weights (repeating section)
251  // unsigned int vertexIndex;
252  // unsigned short boneIndex;
253  // float weight;
254  M_MESH_LOD = 0x8000,
255  // Optional LOD information
256  // unsigned short numLevels;
257  // bool manual; (true for manual alternate meshes, false for generated)
258  M_MESH_LOD_USAGE = 0x8100,
259  // Repeating section, ordered in increasing depth
260  // NB LOD 0 (full detail from 0 depth) is omitted
261  // float fromSquaredDepth;
262  M_MESH_LOD_MANUAL = 0x8110,
263  // Required if M_MESH_LOD section manual = true
264  // String manualMeshName;
265  M_MESH_LOD_GENERATED = 0x8120,
266  // Required if M_MESH_LOD section manual = false
267  // Repeating section (1 per submesh)
268  // unsigned int indexCount;
269  // bool indexes32Bit
270  // unsigned short* faceIndexes; (indexCount)
271  // OR
272  // unsigned int* faceIndexes; (indexCount)
273  M_MESH_BOUNDS = 0x9000
274  // float minx, miny, minz
275  // float maxx, maxy, maxz
276  // float radius
277 
278  // Added By DrEvil
279  // optional chunk that contains a table of submesh indexes and the names of
280  // the sub-meshes.
281  M_SUBMESH_NAME_TABLE,
282  // Subchunks of the name table. Each chunk contains an index & string
283  M_SUBMESH_NAME_TABLE_ELEMENT,
284  // short index
285  // char* name
286 
287  */
288  };
292 } // namespace
293 
294 
295 #endif
MeshChunkID
Definition of the OGRE .mesh file format.