OGRE: OgreMeshFileFormat.h Source File - OGRE Documentation

# 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-2009 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                     M_POSE_VERTEX = 0xC111,
    00178                         // unsigned long vertexIndex
    00179                         // float xoffset, yoffset, zoffset
    00180             // Optional vertex animation chunk
    00181             M_ANIMATIONS = 0xD000,
    00182                 M_ANIMATION = 0xD100,
    00183                 // char* name
    00184                 // float length
    00185                 M_ANIMATION_TRACK = 0xD110,
    00186                     // unsigned short type          // 1 == morph, 2 == pose
    00187                     // unsigned short target        // 0 for shared geometry,
    00188                                                     // 1+ for submesh index + 1
    00189                     M_ANIMATION_MORPH_KEYFRAME = 0xD111,
    00190                         // float time
    00191                         // float x,y,z          // repeat by number of vertices in original geometry
    00192                     M_ANIMATION_POSE_KEYFRAME = 0xD112,
    00193                         // float time
    00194                         M_ANIMATION_POSE_REF = 0xD113, // repeat for number of referenced poses
    00195                             // unsigned short poseIndex
    00196                             // float influence
    00197
    00198             // Optional submesh extreme vertex list chink
    00199             M_TABLE_EXTREMES = 0xE000,
    00200             // unsigned short submesh_index;
    00201             // float extremes [n_extremes][3];
    00202
    00203     /* Version 1.2 of the .mesh format (deprecated)
    00204     enum MeshChunkID {
    00205         M_HEADER                = 0x1000,
    00206             // char*          version           : Version number check
    00207         M_MESH                = 0x3000,
    00208             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
    00209             // Optional M_GEOMETRY chunk
    00210             M_SUBMESH             = 0x4000,
    00211                 // char* materialName
    00212                 // bool useSharedVertices
    00213                 // unsigned int indexCount
    00214                 // bool indexes32Bit
    00215                 // unsigned int* faceVertexIndices (indexCount)
    00216                 // OR
    00217                 // unsigned short* faceVertexIndices (indexCount)
    00218                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
    00219                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
    00220                     // unsigned short operationType
    00221                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
    00222                     // Optional bone weights (repeating section)
    00223                     // unsigned int vertexIndex;
    00224                     // unsigned short boneIndex;
    00225                     // float weight;
    00226             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
    00227             */
    00228                 // unsigned int vertexCount
    00229                 // float* pVertices (x, y, z order x numVertices)
    00230                 M_GEOMETRY_NORMALS = 0x5100,    //(Optional)
    00231                     // float* pNormals (x, y, z order x numVertices)
    00232                 M_GEOMETRY_COLOURS = 0x5200,    //(Optional)
    00233                     // unsigned long* pColours (RGBA 8888 format x numVertices)
    00234                 M_GEOMETRY_TEXCOORDS = 0x5300    //(Optional, REPEATABLE, each one adds an extra set)
    00235                     // unsigned short dimensions    (1 for 1D, 2 for 2D, 3 for 3D)
    00236                     // float* pTexCoords  (u [v] [w] order, dimensions x numVertices)
    00237             /*
    00238             M_MESH_SKELETON_LINK = 0x6000,
    00239                 // Optional link to skeleton
    00240                 // char* skeletonName           : name of .skeleton to use
    00241             M_MESH_BONE_ASSIGNMENT = 0x7000,
    00242                 // Optional bone weights (repeating section)
    00243                 // unsigned int vertexIndex;
    00244                 // unsigned short boneIndex;
    00245                 // float weight;
    00246             M_MESH_LOD = 0x8000,
    00247                 // Optional LOD information
    00248                 // unsigned short numLevels;
    00249                 // bool manual;  (true for manual alternate meshes, false for generated)
    00250                 M_MESH_LOD_USAGE = 0x8100,
    00251                 // Repeating section, ordered in increasing depth
    00252                 // NB LOD 0 (full detail from 0 depth) is omitted
    00253                 // float fromSquaredDepth;
    00254                     M_MESH_LOD_MANUAL = 0x8110,
    00255                     // Required if M_MESH_LOD section manual = true
    00256                     // String manualMeshName;
    00257                     M_MESH_LOD_GENERATED = 0x8120,
    00258                     // Required if M_MESH_LOD section manual = false
    00259                     // Repeating section (1 per submesh)
    00260                     // unsigned int indexCount;
    00261                     // bool indexes32Bit
    00262                     // unsigned short* faceIndexes;  (indexCount)
    00263                     // OR
    00264                     // unsigned int* faceIndexes;  (indexCount)
    00265             M_MESH_BOUNDS = 0x9000
    00266                 // float minx, miny, minz
    00267                 // float maxx, maxy, maxz
    00268                 // float radius
    00269
    00270             // Added By DrEvil
    00271             // optional chunk that contains a table of submesh indexes and the names of
    00272             // the sub-meshes.
    00273             M_SUBMESH_NAME_TABLE,
    00274                 // Subchunks of the name table. Each chunk contains an index & string
    00275                 M_SUBMESH_NAME_TABLE_ELEMENT,
    00276                     // short index
    00277                     // char* name
    00278
    00279     */
    00280     };
    00284 } // namespace
    00285
    00286
    00287 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:52