nuclear@0: /* nuclear@0: Open Asset Import Library (assimp) nuclear@0: ---------------------------------------------------------------------- nuclear@0: nuclear@0: Copyright (c) 2006-2012, assimp team nuclear@0: All rights reserved. nuclear@0: nuclear@0: Redistribution and use of this software in source and binary forms, nuclear@0: with or without modification, are permitted provided that the nuclear@0: following conditions are met: nuclear@0: nuclear@0: * Redistributions of source code must retain the above nuclear@0: copyright notice, this list of conditions and the nuclear@0: following disclaimer. nuclear@0: nuclear@0: * Redistributions in binary form must reproduce the above nuclear@0: copyright notice, this list of conditions and the nuclear@0: following disclaimer in the documentation and/or other nuclear@0: materials provided with the distribution. nuclear@0: nuclear@0: * Neither the name of the assimp team, nor the names of its nuclear@0: contributors may be used to endorse or promote products nuclear@0: derived from this software without specific prior nuclear@0: written permission of the assimp team. nuclear@0: nuclear@0: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS nuclear@0: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT nuclear@0: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR nuclear@0: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT nuclear@0: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, nuclear@0: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT nuclear@0: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, nuclear@0: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY nuclear@0: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT nuclear@0: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE nuclear@0: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nuclear@0: nuclear@0: ---------------------------------------------------------------------- nuclear@0: */ nuclear@0: nuclear@0: /** @file MD2FileData.h nuclear@0: * @brief Defines helper data structures for importing MD2 files nuclear@0: * http://linux.ucla.edu/~phaethon/q3/formats/md2-schoenblum.html nuclear@0: */ nuclear@0: #ifndef AI_MD2FILEHELPER_H_INC nuclear@0: #define AI_MD2FILEHELPER_H_INC nuclear@0: nuclear@0: #include "assimp/types.h" nuclear@0: #include "assimp/mesh.h" nuclear@0: #include "assimp/anim.h" nuclear@0: nuclear@0: #include "assimp/Compiler/pushpack1.h" nuclear@0: nuclear@0: namespace Assimp { nuclear@0: namespace MD2 { nuclear@0: nuclear@0: // to make it easier for us, we test the magic word against both "endianesses" nuclear@0: #define AI_MD2_MAGIC_NUMBER_BE AI_MAKE_MAGIC("IDP2") nuclear@0: #define AI_MD2_MAGIC_NUMBER_LE AI_MAKE_MAGIC("2PDI") nuclear@0: nuclear@0: // common limitations nuclear@0: #define AI_MD2_VERSION 15 nuclear@0: #define AI_MD2_MAXQPATH 64 nuclear@0: #define AI_MD2_MAX_FRAMES 512 nuclear@0: #define AI_MD2_MAX_SKINS 32 nuclear@0: #define AI_MD2_MAX_VERTS 2048 nuclear@0: #define AI_MD2_MAX_TRIANGLES 4096 nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for the MD2 main header nuclear@0: */ nuclear@0: struct Header nuclear@0: { nuclear@0: uint32_t magic; nuclear@0: uint32_t version; nuclear@0: uint32_t skinWidth; nuclear@0: uint32_t skinHeight; nuclear@0: uint32_t frameSize; nuclear@0: uint32_t numSkins; nuclear@0: uint32_t numVertices; nuclear@0: uint32_t numTexCoords; nuclear@0: uint32_t numTriangles; nuclear@0: uint32_t numGlCommands; nuclear@0: uint32_t numFrames; nuclear@0: uint32_t offsetSkins; nuclear@0: uint32_t offsetTexCoords; nuclear@0: uint32_t offsetTriangles; nuclear@0: uint32_t offsetFrames; nuclear@0: uint32_t offsetGlCommands; nuclear@0: uint32_t offsetEnd; nuclear@0: nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MD2 OpenGl draw command nuclear@0: */ nuclear@0: struct GLCommand nuclear@0: { nuclear@0: float s, t; nuclear@0: uint32_t vertexIndex; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MD2 triangle nuclear@0: */ nuclear@0: struct Triangle nuclear@0: { nuclear@0: uint16_t vertexIndices[3]; nuclear@0: uint16_t textureIndices[3]; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MD2 vertex nuclear@0: */ nuclear@0: struct Vertex nuclear@0: { nuclear@0: uint8_t vertex[3]; nuclear@0: uint8_t lightNormalIndex; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MD2 frame nuclear@0: */ nuclear@0: struct Frame nuclear@0: { nuclear@0: float scale[3]; nuclear@0: float translate[3]; nuclear@0: char name[16]; nuclear@0: Vertex vertices[1]; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MD2 texture coordinate nuclear@0: */ nuclear@0: struct TexCoord nuclear@0: { nuclear@0: uint16_t s; nuclear@0: uint16_t t; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MD2 skin nuclear@0: */ nuclear@0: struct Skin nuclear@0: { nuclear@0: char name[AI_MD2_MAXQPATH]; /* texture file name */ nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: #include "assimp/Compiler/poppack1.h" nuclear@0: nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: //! Lookup a normal vector from Quake's normal lookup table nuclear@0: //! \param index Input index (0-161) nuclear@0: //! \param vOut Receives the output normal nuclear@0: void LookupNormalIndex(uint8_t index,aiVector3D& vOut); nuclear@0: nuclear@0: nuclear@0: } nuclear@0: } nuclear@0: nuclear@0: #endif // !! include guard nuclear@0: