Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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-2005 The OGRE Team
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 */
00025 #ifndef __MeshFileFormat_H__
00026 #define __MeshFileFormat_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 
00030 namespace Ogre {
00031 
00049     enum MeshChunkID {
00050         M_HEADER                = 0x1000,
00051             // char*          version           : Version number check
00052         M_MESH                = 0x3000,
00053             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
00054             // Optional M_GEOMETRY chunk
00055             M_SUBMESH             = 0x4000, 
00056                 // char* materialName
00057                 // bool useSharedVertices
00058                 // unsigned int indexCount
00059                 // bool indexes32Bit
00060                 // unsigned int* faceVertexIndices (indexCount)
00061                 // OR
00062                 // unsigned short* faceVertexIndices (indexCount)
00063                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
00064                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
00065                     // unsigned short operationType
00066                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
00067                     // Optional bone weights (repeating section)
00068                     // unsigned int vertexIndex;
00069                     // unsigned short boneIndex;
00070                     // float weight;
00071                 // Optional chunk that matches a texture name to an alias
00072                 // a texture alias is sent to the submesh material to use this texture name
00073                 // instead of the one in the texture unit with a matching alias name
00074                 M_SUBMESH_TEXTURE_ALIAS = 0x4200, // Repeating section
00075                     // char* aliasName;
00076                     // char* textureName;
00077 
00078             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
00079                 // unsigned int vertexCount
00080                 M_GEOMETRY_VERTEX_DECLARATION = 0x5100,
00081                     M_GEOMETRY_VERTEX_ELEMENT = 0x5110, // Repeating section
00082                         // unsigned short source;   // buffer bind source
00083                         // unsigned short type;     // VertexElementType
00084                         // unsigned short semantic; // VertexElementSemantic
00085                         // unsigned short offset;   // start offset in buffer in bytes
00086                         // unsigned short index;    // index of the semantic (for colours and texture coords)
00087                 M_GEOMETRY_VERTEX_BUFFER = 0x5200, // Repeating section
00088                     // unsigned short bindIndex;    // Index to bind this buffer to
00089                     // unsigned short vertexSize;   // Per-vertex size, must agree with declaration at this index
00090                     M_GEOMETRY_VERTEX_BUFFER_DATA = 0x5210,
00091                         // raw buffer data
00092             M_MESH_SKELETON_LINK = 0x6000,
00093                 // Optional link to skeleton
00094                 // char* skeletonName           : name of .skeleton to use
00095             M_MESH_BONE_ASSIGNMENT = 0x7000,
00096                 // Optional bone weights (repeating section)
00097                 // unsigned int vertexIndex;
00098                 // unsigned short boneIndex;
00099                 // float weight;
00100             M_MESH_LOD = 0x8000,
00101                 // Optional LOD information
00102                 // unsigned short numLevels;
00103                 // bool manual;  (true for manual alternate meshes, false for generated)
00104                 M_MESH_LOD_USAGE = 0x8100,
00105                 // Repeating section, ordered in increasing depth
00106                 // NB LOD 0 (full detail from 0 depth) is omitted
00107                 // float fromSquaredDepth;
00108                     M_MESH_LOD_MANUAL = 0x8110,
00109                     // Required if M_MESH_LOD section manual = true
00110                     // String manualMeshName;
00111                     M_MESH_LOD_GENERATED = 0x8120,
00112                     // Required if M_MESH_LOD section manual = false
00113                     // Repeating section (1 per submesh)
00114                     // unsigned int indexCount;
00115                     // bool indexes32Bit
00116                     // unsigned short* faceIndexes;  (indexCount)
00117                     // OR
00118                     // unsigned int* faceIndexes;  (indexCount)
00119             M_MESH_BOUNDS = 0x9000,
00120                 // float minx, miny, minz
00121                 // float maxx, maxy, maxz
00122                 // float radius
00123                     
00124             // Added By DrEvil
00125             // optional chunk that contains a table of submesh indexes and the names of
00126             // the sub-meshes.
00127             M_SUBMESH_NAME_TABLE = 0xA000,
00128                 // Subchunks of the name table. Each chunk contains an index & string
00129                 M_SUBMESH_NAME_TABLE_ELEMENT = 0xA100,
00130                     // short index
00131                     // char* name
00132             
00133             // Optional chunk which stores precomputed edge data                     
00134             M_EDGE_LISTS = 0xB000,
00135                 // Each LOD has a separate edge list
00136                 M_EDGE_LIST_LOD = 0xB100,
00137                     // unsigned short lodIndex
00138                     // bool isManual            // If manual, no edge data here, loaded from manual mesh
00139                         // unsigned long numTriangles
00140                         // unsigned long numEdgeGroups
00141                         // Triangle* triangleList
00142                             // unsigned long indexSet
00143                             // unsigned long vertexSet
00144                             // unsigned long vertIndex[3]
00145                             // unsigned long sharedVertIndex[3] 
00146                             // float normal[4] 
00147 
00148                         M_EDGE_GROUP = 0xB110,
00149                             // unsigned long vertexSet
00150                             // unsigned long numEdges
00151                             // Edge* edgeList
00152                                 // unsigned long  triIndex[2]
00153                                 // unsigned long  vertIndex[2]
00154                                 // unsigned long  sharedVertIndex[2]
00155                                 // bool degenerate
00156 
00157             // Optional poses section, referred to by pose keyframes
00158             M_POSES = 0xC000,
00159                 M_POSE = 0xC100,
00160                     // char* name (may be blank)
00161                     // unsigned short target    // 0 for shared geometry, 
00162                                                 // 1+ for submesh index + 1
00163                     M_POSE_VERTEX = 0xC111,
00164                         // unsigned long vertexIndex
00165                         // float xoffset, yoffset, zoffset
00166             // Optional vertex animation chunk
00167             M_ANIMATIONS = 0xD000, 
00168                 M_ANIMATION = 0xD100,
00169                 // char* name
00170                 // float length
00171                 M_ANIMATION_TRACK = 0xD110,
00172                     // unsigned short type          // 1 == morph, 2 == pose
00173                     // unsigned short target        // 0 for shared geometry, 
00174                                                     // 1+ for submesh index + 1
00175                     M_ANIMATION_MORPH_KEYFRAME = 0xD111,
00176                         // float time
00177                         // float x,y,z          // repeat by number of vertices in original geometry
00178                     M_ANIMATION_POSE_KEYFRAME = 0xD112,
00179                         // float time
00180                         M_ANIMATION_POSE_REF = 0xD113, // repeat for number of referenced poses
00181                             // unsigned short poseIndex 
00182                             // float influence
00183 
00184         
00185     
00186     /* Version 1.2 of the .mesh fornmat (deprecated)
00187     enum MeshChunkID {
00188         M_HEADER                = 0x1000,
00189             // char*          version           : Version number check
00190         M_MESH                = 0x3000,
00191             // bool skeletallyAnimated   // important flag which affects h/w buffer policies
00192             // Optional M_GEOMETRY chunk
00193             M_SUBMESH             = 0x4000, 
00194                 // char* materialName
00195                 // bool useSharedVertices
00196                 // unsigned int indexCount
00197                 // bool indexes32Bit
00198                 // unsigned int* faceVertexIndices (indexCount)
00199                 // OR
00200                 // unsigned short* faceVertexIndices (indexCount)
00201                 // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
00202                 M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
00203                     // unsigned short operationType
00204                 M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
00205                     // Optional bone weights (repeating section)
00206                     // unsigned int vertexIndex;
00207                     // unsigned short boneIndex;
00208                     // float weight;
00209             M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
00210             */
00211                 // unsigned int vertexCount
00212                 // float* pVertices (x, y, z order x numVertices)
00213                 M_GEOMETRY_NORMALS = 0x5100,    //(Optional)
00214                     // float* pNormals (x, y, z order x numVertices)
00215                 M_GEOMETRY_COLOURS = 0x5200,    //(Optional)
00216                     // unsigned long* pColours (RGBA 8888 format x numVertices)
00217                 M_GEOMETRY_TEXCOORDS = 0x5300,    //(Optional, REPEATABLE, each one adds an extra set)
00218                     // unsigned short dimensions    (1 for 1D, 2 for 2D, 3 for 3D)
00219                     // float* pTexCoords  (u [v] [w] order, dimensions x numVertices)
00220             /*
00221             M_MESH_SKELETON_LINK = 0x6000,
00222                 // Optional link to skeleton
00223                 // char* skeletonName           : name of .skeleton to use
00224             M_MESH_BONE_ASSIGNMENT = 0x7000,
00225                 // Optional bone weights (repeating section)
00226                 // unsigned int vertexIndex;
00227                 // unsigned short boneIndex;
00228                 // float weight;
00229             M_MESH_LOD = 0x8000,
00230                 // Optional LOD information
00231                 // unsigned short numLevels;
00232                 // bool manual;  (true for manual alternate meshes, false for generated)
00233                 M_MESH_LOD_USAGE = 0x8100,
00234                 // Repeating section, ordered in increasing depth
00235                 // NB LOD 0 (full detail from 0 depth) is omitted
00236                 // float fromSquaredDepth;
00237                     M_MESH_LOD_MANUAL = 0x8110,
00238                     // Required if M_MESH_LOD section manual = true
00239                     // String manualMeshName;
00240                     M_MESH_LOD_GENERATED = 0x8120,
00241                     // Required if M_MESH_LOD section manual = false
00242                     // Repeating section (1 per submesh)
00243                     // unsigned int indexCount;
00244                     // bool indexes32Bit
00245                     // unsigned short* faceIndexes;  (indexCount)
00246                     // OR
00247                     // unsigned int* faceIndexes;  (indexCount)
00248             M_MESH_BOUNDS = 0x9000
00249                 // float minx, miny, minz
00250                 // float maxx, maxy, maxz
00251                 // float radius
00252 
00253             // Added By DrEvil
00254             // optional chunk that contains a table of submesh indexes and the names of
00255             // the sub-meshes.
00256             M_SUBMESH_NAME_TABLE,
00257                 // Subchunks of the name table. Each chunk contains an index & string
00258                 M_SUBMESH_NAME_TABLE_ELEMENT,
00259                     // short index
00260                     // char* name
00261 
00262     */
00263     };
00264 } // namespace
00265 
00266 
00267 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:44 2006