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 Defines the helper data structures for importing MDC files nuclear@0: nuclear@0: ********************************************************************** nuclear@0: File format specification: nuclear@0: http://themdcfile.planetwolfenstein.gamespy.com/MDC_File_Format.pdf nuclear@0: ********************************************************************** nuclear@0: nuclear@0: */ nuclear@0: #ifndef AI_MDCFILEHELPER_H_INC nuclear@0: #define AI_MDCFILEHELPER_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: nuclear@0: namespace Assimp { nuclear@0: namespace MDC { nuclear@0: nuclear@0: nuclear@0: // to make it easier for us, we test the magic word against both "endianesses" nuclear@0: #define AI_MDC_MAGIC_NUMBER_BE AI_MAKE_MAGIC("CPDI") nuclear@0: #define AI_MDC_MAGIC_NUMBER_LE AI_MAKE_MAGIC("IDPC") nuclear@0: nuclear@0: // common limitations nuclear@0: #define AI_MDC_VERSION 2 nuclear@0: #define AI_MDC_MAXQPATH 64 nuclear@0: #define AI_MDC_MAX_BONES 128 nuclear@0: nuclear@0: #define AI_MDC_CVERT_BIAS 127.0f nuclear@0: #define AI_MDC_DELTA_SCALING 4.0f nuclear@0: #define AI_MDC_BASE_SCALING (1.0f / 64.0f) nuclear@0: nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC file's main header nuclear@0: */ nuclear@0: struct Header nuclear@0: { nuclear@0: uint32_t ulIdent ; nuclear@0: uint32_t ulVersion ; nuclear@0: char ucName [ AI_MDC_MAXQPATH ] ; nuclear@0: uint32_t ulFlags ; nuclear@0: uint32_t ulNumFrames ; nuclear@0: uint32_t ulNumTags ; nuclear@0: uint32_t ulNumSurfaces ; nuclear@0: uint32_t ulNumSkins ; nuclear@0: uint32_t ulOffsetBorderFrames ; nuclear@0: uint32_t ulOffsetTagNames ; nuclear@0: uint32_t ulOffsetTagFrames ; nuclear@0: uint32_t ulOffsetSurfaces ; nuclear@0: uint32_t ulOffsetEnd ; nuclear@0: } PACK_STRUCT ; nuclear@0: nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC file's surface header nuclear@0: */ nuclear@0: struct Surface nuclear@0: { nuclear@0: uint32_t ulIdent ; nuclear@0: char ucName [ AI_MDC_MAXQPATH ] ; nuclear@0: uint32_t ulFlags ; nuclear@0: uint32_t ulNumCompFrames ; nuclear@0: uint32_t ulNumBaseFrames ; nuclear@0: uint32_t ulNumShaders ; nuclear@0: uint32_t ulNumVertices ; nuclear@0: uint32_t ulNumTriangles ; nuclear@0: uint32_t ulOffsetTriangles ; nuclear@0: uint32_t ulOffsetShaders ; nuclear@0: uint32_t ulOffsetTexCoords ; nuclear@0: uint32_t ulOffsetBaseVerts ; nuclear@0: uint32_t ulOffsetCompVerts ; nuclear@0: uint32_t ulOffsetFrameBaseFrames ; nuclear@0: uint32_t ulOffsetFrameCompFrames ; nuclear@0: uint32_t ulOffsetEnd; nuclear@0: Surface() nuclear@0: { nuclear@0: ucName[AI_MDC_MAXQPATH-1] = '\0'; nuclear@0: } nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC frame nuclear@0: */ nuclear@0: struct Frame nuclear@0: { nuclear@0: //! bounding box minimum coords nuclear@0: aiVector3D bboxMin ; nuclear@0: nuclear@0: //! bounding box maximum coords nuclear@0: aiVector3D bboxMax ; nuclear@0: nuclear@0: //! local origin of the frame nuclear@0: aiVector3D localOrigin ; nuclear@0: nuclear@0: //! radius of the BB nuclear@0: float radius ; nuclear@0: nuclear@0: //! Name of the frame nuclear@0: char name [ 16 ] ; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC triangle nuclear@0: */ nuclear@0: struct Triangle nuclear@0: { nuclear@0: uint32_t aiIndices[3]; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC texture coordinate nuclear@0: */ nuclear@0: struct TexturCoord nuclear@0: { nuclear@0: float u,v; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC base vertex nuclear@0: */ nuclear@0: struct BaseVertex nuclear@0: { nuclear@0: int16_t x,y,z; nuclear@0: uint16_t normal; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC compressed vertex nuclear@0: */ nuclear@0: struct CompressedVertex nuclear@0: { nuclear@0: uint8_t xd,yd,zd,nd; nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** \brief Data structure for a MDC shader nuclear@0: */ nuclear@0: struct Shader nuclear@0: { nuclear@0: char ucName [ AI_MDC_MAXQPATH ] ; nuclear@0: uint32_t ulPath; nuclear@0: nuclear@0: } PACK_STRUCT; nuclear@0: nuclear@0: #include "assimp/Compiler/poppack1.h" nuclear@0: nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** Build a floating point vertex from the compressed data in MDC files nuclear@0: */ nuclear@0: void BuildVertex(const Frame& frame, nuclear@0: const BaseVertex& bvert, nuclear@0: const CompressedVertex& cvert, nuclear@0: aiVector3D& vXYZOut, nuclear@0: aiVector3D& vNorOut); nuclear@0: }} nuclear@0: nuclear@0: #endif // !! AI_MDCFILEHELPER_H_INC