vrshoot

annotate libs/assimp/MD4FileData.h @ 3:c179c72369be

rename candy->vr
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 03 Feb 2014 08:52:13 +0200
parents
children
rev   line source
nuclear@0 1 /*
nuclear@0 2 Open Asset Import Library (ASSIMP)
nuclear@0 3 ----------------------------------------------------------------------
nuclear@0 4
nuclear@0 5 Copyright (c) 2006-2010, ASSIMP Development Team
nuclear@0 6 All rights reserved.
nuclear@0 7
nuclear@0 8 Redistribution and use of this software in source and binary forms,
nuclear@0 9 with or without modification, are permitted provided that the
nuclear@0 10 following conditions are met:
nuclear@0 11
nuclear@0 12 * Redistributions of source code must retain the above
nuclear@0 13 copyright notice, this list of conditions and the
nuclear@0 14 following disclaimer.
nuclear@0 15
nuclear@0 16 * Redistributions in binary form must reproduce the above
nuclear@0 17 copyright notice, this list of conditions and the
nuclear@0 18 following disclaimer in the documentation and/or other
nuclear@0 19 materials provided with the distribution.
nuclear@0 20
nuclear@0 21 * Neither the name of the ASSIMP team, nor the names of its
nuclear@0 22 contributors may be used to endorse or promote products
nuclear@0 23 derived from this software without specific prior
nuclear@0 24 written permission of the ASSIMP Development Team.
nuclear@0 25
nuclear@0 26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
nuclear@0 27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
nuclear@0 28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
nuclear@0 29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
nuclear@0 30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
nuclear@0 31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
nuclear@0 32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
nuclear@0 33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
nuclear@0 34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
nuclear@0 35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
nuclear@0 36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nuclear@0 37
nuclear@0 38 ----------------------------------------------------------------------
nuclear@0 39 */
nuclear@0 40
nuclear@0 41 /** @file Defines the helper data structures for importing MD4 files */
nuclear@0 42 #ifndef AI_MD4FILEHELPER_H_INC
nuclear@0 43 #define AI_MD4FILEHELPER_H_INC
nuclear@0 44
nuclear@0 45 #include <string>
nuclear@0 46 #include <vector>
nuclear@0 47 #include <sstream>
nuclear@0 48
nuclear@0 49 #include "../include/aiTypes.h"
nuclear@0 50 #include "../include/aiMesh.h"
nuclear@0 51 #include "../include/aiAnim.h"
nuclear@0 52
nuclear@0 53 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
nuclear@0 54 # pragma pack(push,1)
nuclear@0 55 # define PACK_STRUCT
nuclear@0 56 #elif defined( __GNUC__ )
nuclear@0 57 # define PACK_STRUCT __attribute__((packed))
nuclear@0 58 #else
nuclear@0 59 # error Compiler not supported
nuclear@0 60 #endif
nuclear@0 61
nuclear@0 62
nuclear@0 63 namespace Assimp
nuclear@0 64 {
nuclear@0 65 // http://gongo.quakedev.com/md4.html
nuclear@0 66 namespace MD4
nuclear@0 67 {
nuclear@0 68
nuclear@0 69 #define AI_MD4_MAGIC_NUMBER_BE 'IDP4'
nuclear@0 70 #define AI_MD4_MAGIC_NUMBER_LE '4PDI'
nuclear@0 71
nuclear@0 72 // common limitations
nuclear@0 73 #define AI_MD4_VERSION 4
nuclear@0 74 #define AI_MD4_MAXQPATH 64
nuclear@0 75 #define AI_MD4_MAX_FRAMES 2028
nuclear@0 76 #define AI_MD4_MAX_SURFACES 32
nuclear@0 77 #define AI_MD4_MAX_BONES 256
nuclear@0 78 #define AI_MD4_MAX_VERTS 4096
nuclear@0 79 #define AI_MD4_MAX_TRIANGLES 8192
nuclear@0 80
nuclear@0 81 // ---------------------------------------------------------------------------
nuclear@0 82 /** \brief Data structure for the MD4 main header
nuclear@0 83 */
nuclear@0 84 // ---------------------------------------------------------------------------
nuclear@0 85 struct Header
nuclear@0 86 {
nuclear@0 87 //! magic number
nuclear@0 88 int32_t magic;
nuclear@0 89
nuclear@0 90 //! file format version
nuclear@0 91 int32_t version;
nuclear@0 92
nuclear@0 93 //! original name in .pak archive
nuclear@0 94 unsigned char name[ AI_MD4_MAXQPATH ];
nuclear@0 95
nuclear@0 96 //! number of frames in the file
nuclear@0 97 int32_t NUM_FRAMES;
nuclear@0 98
nuclear@0 99 //! number of bones in the file
nuclear@0 100 int32_t NUM_BONES;
nuclear@0 101
nuclear@0 102 //! number of surfaces in the file
nuclear@0 103 int32_t NUM_SURFACES;
nuclear@0 104
nuclear@0 105 //! offset of the first frame
nuclear@0 106 int32_t OFS_FRAMES;
nuclear@0 107
nuclear@0 108 //! offset of the first bone
nuclear@0 109 int32_t OFS_BONES;
nuclear@0 110
nuclear@0 111 //! offset of the first surface
nuclear@0 112 int32_t OFS_SURFACES;
nuclear@0 113
nuclear@0 114 //! end of file
nuclear@0 115 int32_t OFS_EOF;
nuclear@0 116 } PACK_STRUCT;
nuclear@0 117
nuclear@0 118 // ---------------------------------------------------------------------------
nuclear@0 119 /** \brief Stores the local transformation matrix of a bone
nuclear@0 120 */
nuclear@0 121 // ---------------------------------------------------------------------------
nuclear@0 122 struct BoneFrame
nuclear@0 123 {
nuclear@0 124 float matrix[3][4];
nuclear@0 125 } PACK_STRUCT;
nuclear@0 126
nuclear@0 127 // ---------------------------------------------------------------------------
nuclear@0 128 /** \brief Stores the name / parent index / flag of a node
nuclear@0 129 */
nuclear@0 130 // ---------------------------------------------------------------------------
nuclear@0 131 struct BoneName
nuclear@0 132 {
nuclear@0 133 char name[32] ;
nuclear@0 134 int parent ;
nuclear@0 135 int flags ;
nuclear@0 136 } PACK_STRUCT;
nuclear@0 137
nuclear@0 138 // ---------------------------------------------------------------------------
nuclear@0 139 /** \brief Data structure for a surface in a MD4 file
nuclear@0 140 */
nuclear@0 141 // ---------------------------------------------------------------------------
nuclear@0 142 struct Surface
nuclear@0 143 {
nuclear@0 144 int32_t ident;
nuclear@0 145 char name[64];
nuclear@0 146 char shader[64];
nuclear@0 147 int32_t shaderIndex;
nuclear@0 148 int32_t lodBias;
nuclear@0 149 int32_t minLod;
nuclear@0 150 int32_t ofsHeader;
nuclear@0 151 int32_t numVerts;
nuclear@0 152 int32_t ofsVerts;
nuclear@0 153 int32_t numTris;
nuclear@0 154 int32_t ofsTris;
nuclear@0 155 int32_t numBoneRefs;
nuclear@0 156 int32_t ofsBoneRefs;
nuclear@0 157 int32_t ofsCollapseMap;
nuclear@0 158 int32_t ofsEnd;
nuclear@0 159 } PACK_STRUCT;
nuclear@0 160
nuclear@0 161
nuclear@0 162 // ---------------------------------------------------------------------------
nuclear@0 163 /** \brief Data structure for a MD4 vertex' weight
nuclear@0 164 */
nuclear@0 165 // ---------------------------------------------------------------------------
nuclear@0 166 struct Weight
nuclear@0 167 {
nuclear@0 168 int32_t boneIndex;
nuclear@0 169 float boneWeight;
nuclear@0 170 float offset[3];
nuclear@0 171 } PACK_STRUCT;
nuclear@0 172
nuclear@0 173 // ---------------------------------------------------------------------------
nuclear@0 174 /** \brief Data structure for a vertex in a MD4 file
nuclear@0 175 */
nuclear@0 176 // ---------------------------------------------------------------------------
nuclear@0 177 struct Vertex
nuclear@0 178 {
nuclear@0 179 float vertex[3];
nuclear@0 180 float normal[3];
nuclear@0 181 float texCoords[2];
nuclear@0 182 int32_t numWeights;
nuclear@0 183 Weight weights[1];
nuclear@0 184 } PACK_STRUCT;
nuclear@0 185
nuclear@0 186 // ---------------------------------------------------------------------------
nuclear@0 187 /** \brief Data structure for a triangle in a MD4 file
nuclear@0 188 */
nuclear@0 189 // ---------------------------------------------------------------------------
nuclear@0 190 struct Triangle
nuclear@0 191 {
nuclear@0 192 int32_t indexes[3];
nuclear@0 193 } PACK_STRUCT;
nuclear@0 194
nuclear@0 195 // ---------------------------------------------------------------------------
nuclear@0 196 /** \brief Data structure for a MD4 frame
nuclear@0 197 */
nuclear@0 198 // ---------------------------------------------------------------------------
nuclear@0 199 struct Frame
nuclear@0 200 {
nuclear@0 201 float bounds[3][2];
nuclear@0 202 float localOrigin[3];
nuclear@0 203 float radius;
nuclear@0 204 BoneFrame bones[1];
nuclear@0 205 } PACK_STRUCT;
nuclear@0 206
nuclear@0 207
nuclear@0 208 // reset packing to the original value
nuclear@0 209 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
nuclear@0 210 # pragma pack( pop )
nuclear@0 211 #endif
nuclear@0 212 #undef PACK_STRUCT
nuclear@0 213
nuclear@0 214
nuclear@0 215 };
nuclear@0 216 };
nuclear@0 217
nuclear@0 218 #endif // !! AI_MD4FILEHELPER_H_INC