nuclear@0: /* nuclear@0: Open Asset Import Library (assimp) nuclear@0: ---------------------------------------------------------------------- nuclear@0: nuclear@0: Copyright (c) 2006-2008, 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: #ifndef ASSIMP_Q3BSPFILEDATA_H_INC nuclear@0: #define ASSIMP_Q3BSPFILEDATA_H_INC nuclear@0: nuclear@0: #include nuclear@0: nuclear@0: namespace Assimp nuclear@0: { nuclear@0: namespace Q3BSP nuclear@0: { nuclear@0: nuclear@0: static const unsigned int CE_BSP_LIGHTMAPWIDTH = 128; nuclear@0: static const unsigned int CE_BSP_LIGHTMAPHEIGHT = 128; nuclear@0: nuclear@0: static const unsigned int CE_BSP_LIGHTMAPSIZE = 128*128*3; ///< = 128( width ) * 128 ( height ) * 3 ( channels / RGB ). nuclear@0: static const int VERION_Q3LEVEL = 46; ///< Supported version. nuclear@0: nuclear@0: /// Geometric type enumeration nuclear@0: enum Q3BSPGeoType nuclear@0: { nuclear@0: Polygon = 1, nuclear@0: Patch, nuclear@0: TriangleMesh, nuclear@0: Billboard nuclear@0: }; nuclear@0: nuclear@0: /// Integer vector. nuclear@0: struct ceVec3i nuclear@0: { nuclear@0: int x, y, z; nuclear@0: ceVec3i(): x( 0 ), y( 0 ), z( 0 ) { /* empty */ } nuclear@0: ceVec3i( int iX, int iY=0, int iZ=0) : x( iX ), y( iY ), z( iZ ) { /* empty */ } nuclear@0: }; nuclear@0: nuclear@0: /// Fileheader nuclear@0: struct sQ3BSPHeader nuclear@0: { nuclear@0: char strID[ 4 ]; //!< Should be "IBSP" nuclear@0: int iVersion; //!< 46 for standard levels nuclear@0: }; nuclear@0: nuclear@0: /// Descripes an entry. nuclear@0: struct sQ3BSPLump nuclear@0: { nuclear@0: int iOffset; ///< Offset from startpointer of file nuclear@0: int iSize; ///< Size fo part nuclear@0: }; nuclear@0: nuclear@0: struct vec2f nuclear@0: { nuclear@0: float x,y; nuclear@0: }; nuclear@0: nuclear@0: struct vec3f nuclear@0: { nuclear@0: float x, y, z; nuclear@0: }; nuclear@0: nuclear@0: /// Vertex of a Q3 level nuclear@0: struct sQ3BSPVertex nuclear@0: { nuclear@0: vec3f vPosition; ///< Position of vertex nuclear@0: vec2f vTexCoord; ///< (u,v) Texturecoordinate of detailtexture nuclear@0: vec2f vLightmap; ///< (u,v) Texturecoordinate of lightmap nuclear@0: vec3f vNormal; ///< vertex normale nuclear@0: unsigned char bColor[ 4 ]; ///< Color in RGBA nuclear@0: }; nuclear@0: nuclear@0: /// A face in bsp format info nuclear@0: struct sQ3BSPFace nuclear@0: { nuclear@0: int iTextureID; ///< Index in texture array nuclear@0: int iEffect; ///< Index in effectarray (-1 = no effect) nuclear@0: int iType; ///< 1=Polygon, 2=Patch, 3=Mesh, 4=Billboard nuclear@0: int iVertexIndex; ///< Start index of polygon nuclear@0: int iNumOfVerts; ///< Number of vertices nuclear@0: int iFaceVertexIndex; ///< Index of first mesh vertex nuclear@0: int iNumOfFaceVerts; ///< Anzahl der Meshvertices nuclear@0: int iLightmapID; ///< Index to the lightmap array nuclear@0: int iLMapCorner[ 2 ]; ///< Die Ecke der Lightmap in der Textur nuclear@0: int iLMapSize[ 2 ]; ///< Size of the lightmap stored on the texture nuclear@0: vec3f vLMapPos; ///< 3D-Ursprung der Lightmap nuclear@0: vec3f vLMapVecs[ 2 ]; ///< 3D-s-t-Vektoren nuclear@0: vec3f vNormal; ///< Polygonnormale nuclear@0: int patchWidth, patchHeight; ///< bezier patch nuclear@0: }; nuclear@0: nuclear@0: /// A quake3 texture name. nuclear@0: struct sQ3BSPTexture nuclear@0: { nuclear@0: char strName[ 64 ]; ///< Name of the texture without extention nuclear@0: int iFlags; ///< Not used nuclear@0: int iContents; ///< Not used nuclear@0: }; nuclear@0: nuclear@0: /// A lightmap of the level, size 128 x 128, RGB components. nuclear@0: struct sQ3BSPLightmap nuclear@0: { nuclear@0: unsigned char bLMapData[ CE_BSP_LIGHTMAPSIZE ]; nuclear@0: sQ3BSPLightmap() nuclear@0: { nuclear@0: memset(bLMapData, 0, CE_BSP_LIGHTMAPSIZE ); nuclear@0: } nuclear@0: }; nuclear@0: nuclear@0: struct SubPatch nuclear@0: { nuclear@0: std::vector indices; nuclear@0: int lightmapID; nuclear@0: }; nuclear@0: nuclear@0: enum eLumps nuclear@0: { nuclear@0: kEntities = 0, nuclear@0: kTextures, nuclear@0: kPlanes, nuclear@0: kNodes, nuclear@0: kLeafs, nuclear@0: kLeafFaces, nuclear@0: kLeafBrushes, nuclear@0: kModels, nuclear@0: kBrushes, nuclear@0: kBrushSides, nuclear@0: kVertices, nuclear@0: kMeshVerts, nuclear@0: kShaders, nuclear@0: kFaces, nuclear@0: kLightmaps, nuclear@0: kLightVolumes, nuclear@0: kVisData, nuclear@0: kMaxLumps nuclear@0: }; nuclear@0: nuclear@0: struct Q3BSPModel nuclear@0: { nuclear@0: std::vector m_Data; nuclear@0: std::vector m_Lumps; nuclear@0: std::vector m_Vertices; nuclear@0: std::vector m_Faces; nuclear@0: std::vector m_Indices; nuclear@0: std::vector m_Textures; nuclear@0: std::vector m_Lightmaps; nuclear@0: std::vector m_EntityData; nuclear@0: std::string m_ModelName; nuclear@0: nuclear@0: Q3BSPModel() : nuclear@0: m_Data(), nuclear@0: m_Lumps(), nuclear@0: m_Vertices(), nuclear@0: m_Faces(), nuclear@0: m_Indices(), nuclear@0: m_Textures(), nuclear@0: m_Lightmaps(), nuclear@0: m_EntityData(), nuclear@0: m_ModelName( "" ) nuclear@0: { nuclear@0: // empty nuclear@0: } nuclear@0: nuclear@0: ~Q3BSPModel() nuclear@0: { nuclear@0: for ( unsigned int i=0; i