# 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-2006 Torus Knot Software Ltd
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023
    00024 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __MeshFileFormat_H__
    00030 #define __MeshFileFormat_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 namespace Ogre {
    00035
    00053     enum MeshChunkID {
    00054         M_HEADER                = 0x1000,
    00055             // char*          version           : Version number check
    00056         M_MESH                = 0x3000,
    00057             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
    00058             // Optional M_GEOMETRY chunk
    00059             M_SUBMESH             = 0x4000,
    00060                 // char* materialName
    00061                 // bool useSharedVertices
    00062                 // unsigned int indexCount
    00063                 // bool indexes32Bit
    00064                 // unsigned int* faceVertexIndices (indexCount)
    00065                 // OR
    00066                 // unsigned short* faceVertexIndices (indexCount)
    00067                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
    00068                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
    00069                     // unsigned short operationType
    00070                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
    00071                     // Optional bone weights (repeating section)
    00072                     // unsigned int vertexIndex;
    00073                     // unsigned short boneIndex;
    00074                     // float weight;
    00075                 // Optional chunk that matches a texture name to an alias
    00076                 // a texture alias is sent to the submesh material to use this texture name
    00077                 // instead of the one in the texture unit with a matching alias name
    00078                 M_SUBMESH_TEXTURE_ALIAS = 0x4200, // Repeating section
    00079                     // char* aliasName;
    00080                     // char* textureName;
    00081
    00082             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
    00083                 // unsigned int vertexCount
    00084                 M_GEOMETRY_VERTEX_DECLARATION = 0x5100,
    00085                     M_GEOMETRY_VERTEX_ELEMENT = 0x5110, // Repeating section
    00086                         // unsigned short source;   // buffer bind source
    00087                         // unsigned short type;     // VertexElementType
    00088                         // unsigned short semantic; // VertexElementSemantic
    00089                         // unsigned short offset;   // start offset in buffer in bytes
    00090                         // unsigned short index;    // index of the semantic (for colours and texture coords)
    00091                 M_GEOMETRY_VERTEX_BUFFER = 0x5200, // Repeating section
    00092                     // unsigned short bindIndex;    // Index to bind this buffer to
    00093                     // unsigned short vertexSize;   // Per-vertex size, must agree with declaration at this index
    00094                     M_GEOMETRY_VERTEX_BUFFER_DATA = 0x5210,
    00095                         // raw buffer data
    00096             M_MESH_SKELETON_LINK = 0x6000,
    00097                 // Optional link to skeleton
    00098                 // char* skeletonName           : name of .skeleton to use
    00099             M_MESH_BONE_ASSIGNMENT = 0x7000,
    00100                 // Optional bone weights (repeating section)
    00101                 // unsigned int vertexIndex;
    00102                 // unsigned short boneIndex;
    00103                 // float weight;
    00104             M_MESH_LOD = 0x8000,
    00105                 // Optional LOD information
    00106                 // unsigned short numLevels;
    00107                 // bool manual;  (true for manual alternate meshes, false for generated)
    00108                 M_MESH_LOD_USAGE = 0x8100,
    00109                 // Repeating section, ordered in increasing depth
    00110                 // NB LOD 0 (full detail from 0 depth) is omitted
    00111                 // float fromSquaredDepth;
    00112                     M_MESH_LOD_MANUAL = 0x8110,
    00113                     // Required if M_MESH_LOD section manual = true
    00114                     // String manualMeshName;
    00115                     M_MESH_LOD_GENERATED = 0x8120,
    00116                     // Required if M_MESH_LOD section manual = false
    00117                     // Repeating section (1 per submesh)
    00118                     // unsigned int indexCount;
    00119                     // bool indexes32Bit
    00120                     // unsigned short* faceIndexes;  (indexCount)
    00121                     // OR
    00122                     // unsigned int* faceIndexes;  (indexCount)
    00123             M_MESH_BOUNDS = 0x9000,
    00124                 // float minx, miny, minz
    00125                 // float maxx, maxy, maxz
    00126                 // float radius
    00127
    00128             // Added By DrEvil
    00129             // optional chunk that contains a table of submesh indexes and the names of
    00130             // the sub-meshes.
    00131             M_SUBMESH_NAME_TABLE = 0xA000,
    00132                 // Subchunks of the name table. Each chunk contains an index & string
    00133                 M_SUBMESH_NAME_TABLE_ELEMENT = 0xA100,
    00134                     // short index
    00135                     // char* name
    00136
    00137             // Optional chunk which stores precomputed edge data
    00138             M_EDGE_LISTS = 0xB000,
    00139                 // Each LOD has a separate edge list
    00140                 M_EDGE_LIST_LOD = 0xB100,
    00141                     // unsigned short lodIndex
    00142                     // bool isManual            // If manual, no edge data here, loaded from manual mesh
    00143                         // bool isClosed
    00144                         // unsigned long numTriangles
    00145                         // unsigned long numEdgeGroups
    00146                         // Triangle* triangleList
    00147                             // unsigned long indexSet
    00148                             // unsigned long vertexSet
    00149                             // unsigned long vertIndex[3]
    00150                             // unsigned long sharedVertIndex[3]
    00151                             // float normal[4]
    00152
    00153                         M_EDGE_GROUP = 0xB110,
    00154                             // unsigned long vertexSet
    00155                             // unsigned long triStart
    00156                             // unsigned long triCount
    00157                             // unsigned long numEdges
    00158                             // Edge* edgeList
    00159                                 // unsigned long  triIndex[2]
    00160                                 // unsigned long  vertIndex[2]
    00161                                 // unsigned long  sharedVertIndex[2]
    00162                                 // bool degenerate
    00163
    00164             // Optional poses section, referred to by pose keyframes
    00165             M_POSES = 0xC000,
    00166                 M_POSE = 0xC100,
    00167                     // char* name (may be blank)
    00168                     // unsigned short target    // 0 for shared geometry,
    00169                                                 // 1+ for submesh index + 1
    00170                     M_POSE_VERTEX = 0xC111,
    00171                         // unsigned long vertexIndex
    00172                         // float xoffset, yoffset, zoffset
    00173             // Optional vertex animation chunk
    00174             M_ANIMATIONS = 0xD000,
    00175                 M_ANIMATION = 0xD100,
    00176                 // char* name
    00177                 // float length
    00178                 M_ANIMATION_TRACK = 0xD110,
    00179                     // unsigned short type          // 1 == morph, 2 == pose
    00180                     // unsigned short target        // 0 for shared geometry,
    00181                                                     // 1+ for submesh index + 1
    00182                     M_ANIMATION_MORPH_KEYFRAME = 0xD111,
    00183                         // float time
    00184                         // float x,y,z          // repeat by number of vertices in original geometry
    00185                     M_ANIMATION_POSE_KEYFRAME = 0xD112,
    00186                         // float time
    00187                         M_ANIMATION_POSE_REF = 0xD113, // repeat for number of referenced poses
    00188                             // unsigned short poseIndex
    00189                             // float influence
    00190
    00191             // Optional submesh extreme vertex list chink
    00192             M_TABLE_EXTREMES = 0xE000,
    00193             // unsigned short submesh_index;
    00194             // float extremes [n_extremes][3];
    00195
    00196     /* Version 1.2 of the .mesh format (deprecated)
    00197     enum MeshChunkID {
    00198         M_HEADER                = 0x1000,
    00199             // char*          version           : Version number check
    00200         M_MESH                = 0x3000,
    00201             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
    00202             // Optional M_GEOMETRY chunk
    00203             M_SUBMESH             = 0x4000,
    00204                 // char* materialName
    00205                 // bool useSharedVertices
    00206                 // unsigned int indexCount
    00207                 // bool indexes32Bit
    00208                 // unsigned int* faceVertexIndices (indexCount)
    00209                 // OR
    00210                 // unsigned short* faceVertexIndices (indexCount)
    00211                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
    00212                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
    00213                     // unsigned short operationType
    00214                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
    00215                     // Optional bone weights (repeating section)
    00216                     // unsigned int vertexIndex;
    00217                     // unsigned short boneIndex;
    00218                     // float weight;
    00219             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
    00220             */
    00221                 // unsigned int vertexCount
    00222                 // float* pVertices (x, y, z order x numVertices)
    00223                 M_GEOMETRY_NORMALS = 0x5100,    //(Optional)
    00224                     // float* pNormals (x, y, z order x numVertices)
    00225                 M_GEOMETRY_COLOURS = 0x5200,    //(Optional)
    00226                     // unsigned long* pColours (RGBA 8888 format x numVertices)
    00227                 M_GEOMETRY_TEXCOORDS = 0x5300,    //(Optional, REPEATABLE, each one adds an extra set)
    00228                     // unsigned short dimensions    (1 for 1D, 2 for 2D, 3 for 3D)
    00229                     // float* pTexCoords  (u [v] [w] order, dimensions x numVertices)
    00230             /*
    00231             M_MESH_SKELETON_LINK = 0x6000,
    00232                 // Optional link to skeleton
    00233                 // char* skeletonName           : name of .skeleton to use
    00234             M_MESH_BONE_ASSIGNMENT = 0x7000,
    00235                 // Optional bone weights (repeating section)
    00236                 // unsigned int vertexIndex;
    00237                 // unsigned short boneIndex;
    00238                 // float weight;
    00239             M_MESH_LOD = 0x8000,
    00240                 // Optional LOD information
    00241                 // unsigned short numLevels;
    00242                 // bool manual;  (true for manual alternate meshes, false for generated)
    00243                 M_MESH_LOD_USAGE = 0x8100,
    00244                 // Repeating section, ordered in increasing depth
    00245                 // NB LOD 0 (full detail from 0 depth) is omitted
    00246                 // float fromSquaredDepth;
    00247                     M_MESH_LOD_MANUAL = 0x8110,
    00248                     // Required if M_MESH_LOD section manual = true
    00249                     // String manualMeshName;
    00250                     M_MESH_LOD_GENERATED = 0x8120,
    00251                     // Required if M_MESH_LOD section manual = false
    00252                     // Repeating section (1 per submesh)
    00253                     // unsigned int indexCount;
    00254                     // bool indexes32Bit
    00255                     // unsigned short* faceIndexes;  (indexCount)
    00256                     // OR
    00257                     // unsigned int* faceIndexes;  (indexCount)
    00258             M_MESH_BOUNDS = 0x9000
    00259                 // float minx, miny, minz
    00260                 // float maxx, maxy, maxz
    00261                 // float radius
    00262
    00263             // Added By DrEvil
    00264             // optional chunk that contains a table of submesh indexes and the names of
    00265             // the sub-meshes.
    00266             M_SUBMESH_NAME_TABLE,
    00267                 // Subchunks of the name table. Each chunk contains an index & string
    00268                 M_SUBMESH_NAME_TABLE_ELEMENT,
    00269                     // short index
    00270                     // char* name
    00271
    00272     */
    00273     };
    00274 } // namespace
    00275
    00276
    00277 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:32:18 2009