OgreMeshFileFormat.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2012 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __MeshFileFormat_H__
00029 #define __MeshFileFormat_H__
00030 
00031 #include "OgrePrerequisites.h"
00032 
00033 namespace Ogre {
00034 
00058     enum MeshChunkID {
00059         M_HEADER                = 0x1000,
00060             // char*          version           : Version number check
00061         M_MESH                = 0x3000,
00062             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
00063             // Optional M_GEOMETRY chunk
00064             M_SUBMESH             = 0x4000, 
00065                 // char* materialName
00066                 // bool useSharedVertices
00067                 // unsigned int indexCount
00068                 // bool indexes32Bit
00069                 // unsigned int* faceVertexIndices (indexCount)
00070                 // OR
00071                 // unsigned short* faceVertexIndices (indexCount)
00072                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
00073                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
00074                     // unsigned short operationType
00075                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
00076                     // Optional bone weights (repeating section)
00077                     // unsigned int vertexIndex;
00078                     // unsigned short boneIndex;
00079                     // float weight;
00080                 // Optional chunk that matches a texture name to an alias
00081                 // a texture alias is sent to the submesh material to use this texture name
00082                 // instead of the one in the texture unit with a matching alias name
00083                 M_SUBMESH_TEXTURE_ALIAS = 0x4200, // Repeating section
00084                     // char* aliasName;
00085                     // char* textureName;
00086 
00087             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
00088                 // unsigned int vertexCount
00089                 M_GEOMETRY_VERTEX_DECLARATION = 0x5100,
00090                     M_GEOMETRY_VERTEX_ELEMENT = 0x5110, // Repeating section
00091                         // unsigned short source;   // buffer bind source
00092                         // unsigned short type;     // VertexElementType
00093                         // unsigned short semantic; // VertexElementSemantic
00094                         // unsigned short offset;   // start offset in buffer in bytes
00095                         // unsigned short index;    // index of the semantic (for colours and texture coords)
00096                 M_GEOMETRY_VERTEX_BUFFER = 0x5200, // Repeating section
00097                     // unsigned short bindIndex;    // Index to bind this buffer to
00098                     // unsigned short vertexSize;   // Per-vertex size, must agree with declaration at this index
00099                     M_GEOMETRY_VERTEX_BUFFER_DATA = 0x5210,
00100                         // raw buffer data
00101             M_MESH_SKELETON_LINK = 0x6000,
00102                 // Optional link to skeleton
00103                 // char* skeletonName           : name of .skeleton to use
00104             M_MESH_BONE_ASSIGNMENT = 0x7000,
00105                 // Optional bone weights (repeating section)
00106                 // unsigned int vertexIndex;
00107                 // unsigned short boneIndex;
00108                 // float weight;
00109             M_MESH_LOD = 0x8000,
00110                 // Optional LOD information
00111                 // string strategyName;
00112                 // unsigned short numLevels;
00113                 // bool manual;  (true for manual alternate meshes, false for generated)
00114                 M_MESH_LOD_USAGE = 0x8100,
00115                 // Repeating section, ordered in increasing depth
00116                 // NB LOD 0 (full detail from 0 depth) is omitted
00117                 // LOD value - this is a distance, a pixel count etc, based on strategy
00118                 // float lodValue;
00119                     M_MESH_LOD_MANUAL = 0x8110,
00120                     // Required if M_MESH_LOD section manual = true
00121                     // String manualMeshName;
00122                     M_MESH_LOD_GENERATED = 0x8120,
00123                     // Required if M_MESH_LOD section manual = false
00124                     // Repeating section (1 per submesh)
00125                     // unsigned int indexCount;
00126                     // bool indexes32Bit
00127                     // unsigned short* faceIndexes;  (indexCount)
00128                     // OR
00129                     // unsigned int* faceIndexes;  (indexCount)
00130             M_MESH_BOUNDS = 0x9000,
00131                 // float minx, miny, minz
00132                 // float maxx, maxy, maxz
00133                 // float radius
00134                     
00135             // Added By DrEvil
00136             // optional chunk that contains a table of submesh indexes and the names of
00137             // the sub-meshes.
00138             M_SUBMESH_NAME_TABLE = 0xA000,
00139                 // Subchunks of the name table. Each chunk contains an index & string
00140                 M_SUBMESH_NAME_TABLE_ELEMENT = 0xA100,
00141                     // short index
00142                     // char* name
00143             
00144             // Optional chunk which stores precomputed edge data                     
00145             M_EDGE_LISTS = 0xB000,
00146                 // Each LOD has a separate edge list
00147                 M_EDGE_LIST_LOD = 0xB100,
00148                     // unsigned short lodIndex
00149                     // bool isManual            // If manual, no edge data here, loaded from manual mesh
00150                         // bool isClosed
00151                         // unsigned long numTriangles
00152                         // unsigned long numEdgeGroups
00153                         // Triangle* triangleList
00154                             // unsigned long indexSet
00155                             // unsigned long vertexSet
00156                             // unsigned long vertIndex[3]
00157                             // unsigned long sharedVertIndex[3] 
00158                             // float normal[4] 
00159 
00160                         M_EDGE_GROUP = 0xB110,
00161                             // unsigned long vertexSet
00162                             // unsigned long triStart
00163                             // unsigned long triCount
00164                             // unsigned long numEdges
00165                             // Edge* edgeList
00166                                 // unsigned long  triIndex[2]
00167                                 // unsigned long  vertIndex[2]
00168                                 // unsigned long  sharedVertIndex[2]
00169                                 // bool degenerate
00170 
00171             // Optional poses section, referred to by pose keyframes
00172             M_POSES = 0xC000,
00173                 M_POSE = 0xC100,
00174                     // char* name (may be blank)
00175                     // unsigned short target    // 0 for shared geometry, 
00176                                                 // 1+ for submesh index + 1
00177                     // bool includesNormals [1.8+]
00178                     M_POSE_VERTEX = 0xC111,
00179                         // unsigned long vertexIndex
00180                         // float xoffset, yoffset, zoffset
00181                         // float xnormal, ynormal, znormal (optional, 1.8+)
00182             // Optional vertex animation chunk
00183             M_ANIMATIONS = 0xD000, 
00184                 M_ANIMATION = 0xD100,
00185                 // char* name
00186                 // float length
00187                 M_ANIMATION_BASEINFO = 0xD105,
00188                 // [Optional] base keyframe information (pose animation only)
00189                 // char* baseAnimationName (blank for self)
00190                 // float baseKeyFrameTime
00191         
00192                 M_ANIMATION_TRACK = 0xD110,
00193                     // unsigned short type          // 1 == morph, 2 == pose
00194                     // unsigned short target        // 0 for shared geometry, 
00195                                                     // 1+ for submesh index + 1
00196                     M_ANIMATION_MORPH_KEYFRAME = 0xD111,
00197                         // float time
00198                         // bool includesNormals [1.8+]
00199                         // float x,y,z          // repeat by number of vertices in original geometry
00200                     M_ANIMATION_POSE_KEYFRAME = 0xD112,
00201                         // float time
00202                         M_ANIMATION_POSE_REF = 0xD113, // repeat for number of referenced poses
00203                             // unsigned short poseIndex 
00204                             // float influence
00205 
00206             // Optional submesh extreme vertex list chink
00207             M_TABLE_EXTREMES = 0xE000,
00208             // unsigned short submesh_index;
00209             // float extremes [n_extremes][3];
00210 
00211     /* Version 1.2 of the .mesh format (deprecated)
00212     enum MeshChunkID {
00213         M_HEADER                = 0x1000,
00214             // char*          version           : Version number check
00215         M_MESH                = 0x3000,
00216             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
00217             // Optional M_GEOMETRY chunk
00218             M_SUBMESH             = 0x4000, 
00219                 // char* materialName
00220                 // bool useSharedVertices
00221                 // unsigned int indexCount
00222                 // bool indexes32Bit
00223                 // unsigned int* faceVertexIndices (indexCount)
00224                 // OR
00225                 // unsigned short* faceVertexIndices (indexCount)
00226                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
00227                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
00228                     // unsigned short operationType
00229                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
00230                     // Optional bone weights (repeating section)
00231                     // unsigned int vertexIndex;
00232                     // unsigned short boneIndex;
00233                     // float weight;
00234             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
00235             */
00236                 // unsigned int vertexCount
00237                 // float* pVertices (x, y, z order x numVertices)
00238                 M_GEOMETRY_NORMALS = 0x5100,    //(Optional)
00239                     // float* pNormals (x, y, z order x numVertices)
00240                 M_GEOMETRY_COLOURS = 0x5200,    //(Optional)
00241                     // unsigned long* pColours (RGBA 8888 format x numVertices)
00242                 M_GEOMETRY_TEXCOORDS = 0x5300    //(Optional, REPEATABLE, each one adds an extra set)
00243                     // unsigned short dimensions    (1 for 1D, 2 for 2D, 3 for 3D)
00244                     // float* pTexCoords  (u [v] [w] order, dimensions x numVertices)
00245             /*
00246             M_MESH_SKELETON_LINK = 0x6000,
00247                 // Optional link to skeleton
00248                 // char* skeletonName           : name of .skeleton to use
00249             M_MESH_BONE_ASSIGNMENT = 0x7000,
00250                 // Optional bone weights (repeating section)
00251                 // unsigned int vertexIndex;
00252                 // unsigned short boneIndex;
00253                 // float weight;
00254             M_MESH_LOD = 0x8000,
00255                 // Optional LOD information
00256                 // unsigned short numLevels;
00257                 // bool manual;  (true for manual alternate meshes, false for generated)
00258                 M_MESH_LOD_USAGE = 0x8100,
00259                 // Repeating section, ordered in increasing depth
00260                 // NB LOD 0 (full detail from 0 depth) is omitted
00261                 // float fromSquaredDepth;
00262                     M_MESH_LOD_MANUAL = 0x8110,
00263                     // Required if M_MESH_LOD section manual = true
00264                     // String manualMeshName;
00265                     M_MESH_LOD_GENERATED = 0x8120,
00266                     // Required if M_MESH_LOD section manual = false
00267                     // Repeating section (1 per submesh)
00268                     // unsigned int indexCount;
00269                     // bool indexes32Bit
00270                     // unsigned short* faceIndexes;  (indexCount)
00271                     // OR
00272                     // unsigned int* faceIndexes;  (indexCount)
00273             M_MESH_BOUNDS = 0x9000
00274                 // float minx, miny, minz
00275                 // float maxx, maxy, maxz
00276                 // float radius
00277 
00278             // Added By DrEvil
00279             // optional chunk that contains a table of submesh indexes and the names of
00280             // the sub-meshes.
00281             M_SUBMESH_NAME_TABLE,
00282                 // Subchunks of the name table. Each chunk contains an index & string
00283                 M_SUBMESH_NAME_TABLE_ELEMENT,
00284                     // short index
00285                     // char* name
00286 
00287     */
00288     };
00292 } // namespace
00293 
00294 
00295 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:24 2012