vrshoot

annotate libs/assimp/ASEParser.h @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +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-2012, assimp 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 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
nuclear@0 42 /** @file Defines the helper data structures for importing ASE files */
nuclear@0 43 #ifndef AI_ASEFILEHELPER_H_INC
nuclear@0 44 #define AI_ASEFILEHELPER_H_INC
nuclear@0 45
nuclear@0 46 // STL/CRT headers
nuclear@0 47 #include <string>
nuclear@0 48 #include <vector>
nuclear@0 49 #include <list>
nuclear@0 50
nuclear@0 51 // public ASSIMP headers
nuclear@0 52 #include "assimp/types.h"
nuclear@0 53 #include "assimp/mesh.h"
nuclear@0 54 #include "assimp/anim.h"
nuclear@0 55
nuclear@0 56 // for some helper routines like IsSpace()
nuclear@0 57 #include "ParsingUtils.h"
nuclear@0 58 #include "qnan.h"
nuclear@0 59
nuclear@0 60 // ASE is quite similar to 3ds. We can reuse some structures
nuclear@0 61 #include "3DSLoader.h"
nuclear@0 62
nuclear@0 63 namespace Assimp {
nuclear@0 64 namespace ASE {
nuclear@0 65
nuclear@0 66 using namespace D3DS;
nuclear@0 67
nuclear@0 68 // ---------------------------------------------------------------------------
nuclear@0 69 /** Helper structure representing an ASE material */
nuclear@0 70 struct Material : public D3DS::Material
nuclear@0 71 {
nuclear@0 72 //! Default constructor
nuclear@0 73 Material() : pcInstance(NULL), bNeed (false)
nuclear@0 74 {}
nuclear@0 75
nuclear@0 76 //! Contains all sub materials of this material
nuclear@0 77 std::vector<Material> avSubMaterials;
nuclear@0 78
nuclear@0 79 //! aiMaterial object
nuclear@0 80 aiMaterial* pcInstance;
nuclear@0 81
nuclear@0 82 //! Can we remove this material?
nuclear@0 83 bool bNeed;
nuclear@0 84 };
nuclear@0 85
nuclear@0 86 // ---------------------------------------------------------------------------
nuclear@0 87 /** Helper structure to represent an ASE file face */
nuclear@0 88 struct Face : public FaceWithSmoothingGroup
nuclear@0 89 {
nuclear@0 90 //! Default constructor. Initializes everything with 0
nuclear@0 91 Face()
nuclear@0 92 {
nuclear@0 93 mColorIndices[0] = mColorIndices[1] = mColorIndices[2] = 0;
nuclear@0 94 for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i)
nuclear@0 95 {
nuclear@0 96 amUVIndices[i][0] = amUVIndices[i][1] = amUVIndices[i][2] = 0;
nuclear@0 97 }
nuclear@0 98
nuclear@0 99 iMaterial = DEFAULT_MATINDEX;
nuclear@0 100 iFace = 0;
nuclear@0 101 }
nuclear@0 102
nuclear@0 103 //! special value to indicate that no material index has
nuclear@0 104 //! been assigned to a face. The default material index
nuclear@0 105 //! will replace this value later.
nuclear@0 106 static const unsigned int DEFAULT_MATINDEX = 0xFFFFFFFF;
nuclear@0 107
nuclear@0 108
nuclear@0 109
nuclear@0 110 //! Indices into each list of texture coordinates
nuclear@0 111 unsigned int amUVIndices[AI_MAX_NUMBER_OF_TEXTURECOORDS][3];
nuclear@0 112
nuclear@0 113 //! Index into the list of vertex colors
nuclear@0 114 unsigned int mColorIndices[3];
nuclear@0 115
nuclear@0 116 //! (Sub)Material index to be assigned to this face
nuclear@0 117 unsigned int iMaterial;
nuclear@0 118
nuclear@0 119 //! Index of the face. It is not specified whether it is
nuclear@0 120 //! a requirement of the file format that all faces are
nuclear@0 121 //! written in sequential order, so we have to expect this case
nuclear@0 122 unsigned int iFace;
nuclear@0 123 };
nuclear@0 124
nuclear@0 125 // ---------------------------------------------------------------------------
nuclear@0 126 /** Helper structure to represent an ASE file bone */
nuclear@0 127 struct Bone
nuclear@0 128 {
nuclear@0 129 //! Constructor
nuclear@0 130 Bone()
nuclear@0 131 {
nuclear@0 132 static int iCnt = 0;
nuclear@0 133
nuclear@0 134 // Generate a default name for the bone
nuclear@0 135 char szTemp[128];
nuclear@0 136 ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
nuclear@0 137 mName = szTemp;
nuclear@0 138 }
nuclear@0 139
nuclear@0 140 //! Construction from an existing name
nuclear@0 141 Bone( const std::string& name)
nuclear@0 142 : mName (name)
nuclear@0 143 {}
nuclear@0 144
nuclear@0 145 //! Name of the bone
nuclear@0 146 std::string mName;
nuclear@0 147 };
nuclear@0 148
nuclear@0 149 // ---------------------------------------------------------------------------
nuclear@0 150 /** Helper structure to represent an ASE file bone vertex */
nuclear@0 151 struct BoneVertex
nuclear@0 152 {
nuclear@0 153 //! Bone and corresponding vertex weight.
nuclear@0 154 //! -1 for unrequired bones ....
nuclear@0 155 std::vector<std::pair<int,float> > mBoneWeights;
nuclear@0 156
nuclear@0 157 //! Position of the bone vertex.
nuclear@0 158 //! MUST be identical to the vertex position
nuclear@0 159 //aiVector3D mPosition;
nuclear@0 160 };
nuclear@0 161
nuclear@0 162 // ---------------------------------------------------------------------------
nuclear@0 163 /** Helper structure to represent an ASE file animation */
nuclear@0 164 struct Animation
nuclear@0 165 {
nuclear@0 166 enum Type
nuclear@0 167 {
nuclear@0 168 TRACK = 0x0,
nuclear@0 169 BEZIER = 0x1,
nuclear@0 170 TCB = 0x2
nuclear@0 171 } mRotationType, mScalingType, mPositionType;
nuclear@0 172
nuclear@0 173 Animation()
nuclear@0 174 : mRotationType (TRACK)
nuclear@0 175 , mScalingType (TRACK)
nuclear@0 176 , mPositionType (TRACK)
nuclear@0 177 {}
nuclear@0 178
nuclear@0 179 //! List of track rotation keyframes
nuclear@0 180 std::vector< aiQuatKey > akeyRotations;
nuclear@0 181
nuclear@0 182 //! List of track position keyframes
nuclear@0 183 std::vector< aiVectorKey > akeyPositions;
nuclear@0 184
nuclear@0 185 //! List of track scaling keyframes
nuclear@0 186 std::vector< aiVectorKey > akeyScaling;
nuclear@0 187
nuclear@0 188 };
nuclear@0 189
nuclear@0 190 // ---------------------------------------------------------------------------
nuclear@0 191 /** Helper structure to represent the inheritance information of an ASE node */
nuclear@0 192 struct InheritanceInfo
nuclear@0 193 {
nuclear@0 194 //! Default constructor
nuclear@0 195 InheritanceInfo()
nuclear@0 196 {
nuclear@0 197 // set the inheritance flag for all axes by default to true
nuclear@0 198 for (unsigned int i = 0; i < 3;++i)
nuclear@0 199 abInheritPosition[i] = abInheritRotation[i] = abInheritScaling[i] = true;
nuclear@0 200 }
nuclear@0 201
nuclear@0 202 //! Inherit the parent's position?, axis order is x,y,z
nuclear@0 203 bool abInheritPosition[3];
nuclear@0 204
nuclear@0 205 //! Inherit the parent's rotation?, axis order is x,y,z
nuclear@0 206 bool abInheritRotation[3];
nuclear@0 207
nuclear@0 208 //! Inherit the parent's scaling?, axis order is x,y,z
nuclear@0 209 bool abInheritScaling[3];
nuclear@0 210 };
nuclear@0 211
nuclear@0 212 // ---------------------------------------------------------------------------
nuclear@0 213 /** Represents an ASE file node. Base class for mesh, light and cameras */
nuclear@0 214 struct BaseNode
nuclear@0 215 {
nuclear@0 216 enum Type {Light, Camera, Mesh, Dummy} mType;
nuclear@0 217
nuclear@0 218 //! Constructor. Creates a default name for the node
nuclear@0 219 BaseNode(Type _mType)
nuclear@0 220 : mType (_mType)
nuclear@0 221 , mProcessed (false)
nuclear@0 222 {
nuclear@0 223 // generate a default name for the node
nuclear@0 224 static int iCnt = 0;
nuclear@0 225 char szTemp[128]; // should be sufficiently large
nuclear@0 226 ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
nuclear@0 227 mName = szTemp;
nuclear@0 228
nuclear@0 229 // Set mTargetPosition to qnan
nuclear@0 230 const float qnan = get_qnan();
nuclear@0 231 mTargetPosition.x = qnan;
nuclear@0 232 }
nuclear@0 233
nuclear@0 234 //! Name of the mesh
nuclear@0 235 std::string mName;
nuclear@0 236
nuclear@0 237 //! Name of the parent of the node
nuclear@0 238 //! "" if there is no parent ...
nuclear@0 239 std::string mParent;
nuclear@0 240
nuclear@0 241 //! Transformation matrix of the node
nuclear@0 242 aiMatrix4x4 mTransform;
nuclear@0 243
nuclear@0 244 //! Target position (target lights and cameras)
nuclear@0 245 aiVector3D mTargetPosition;
nuclear@0 246
nuclear@0 247 //! Specifies which axes transformations a node inherits
nuclear@0 248 //! from its parent ...
nuclear@0 249 InheritanceInfo inherit;
nuclear@0 250
nuclear@0 251 //! Animation channels for the node
nuclear@0 252 Animation mAnim;
nuclear@0 253
nuclear@0 254 //! Needed for lights and cameras: target animation channel
nuclear@0 255 //! Should contain position keys only.
nuclear@0 256 Animation mTargetAnim;
nuclear@0 257
nuclear@0 258 bool mProcessed;
nuclear@0 259 };
nuclear@0 260
nuclear@0 261 // ---------------------------------------------------------------------------
nuclear@0 262 /** Helper structure to represent an ASE file mesh */
nuclear@0 263 struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode
nuclear@0 264 {
nuclear@0 265 //! Constructor.
nuclear@0 266 Mesh()
nuclear@0 267 : BaseNode (BaseNode::Mesh)
nuclear@0 268 , bSkip (false)
nuclear@0 269 {
nuclear@0 270 // use 2 texture vertex components by default
nuclear@0 271 for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
nuclear@0 272 this->mNumUVComponents[c] = 2;
nuclear@0 273
nuclear@0 274 // setup the default material index by default
nuclear@0 275 iMaterialIndex = Face::DEFAULT_MATINDEX;
nuclear@0 276 }
nuclear@0 277
nuclear@0 278 //! List of all texture coordinate sets
nuclear@0 279 std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
nuclear@0 280
nuclear@0 281 //! List of all vertex color sets.
nuclear@0 282 std::vector<aiColor4D> mVertexColors;
nuclear@0 283
nuclear@0 284 //! List of all bone vertices
nuclear@0 285 std::vector<BoneVertex> mBoneVertices;
nuclear@0 286
nuclear@0 287 //! List of all bones
nuclear@0 288 std::vector<Bone> mBones;
nuclear@0 289
nuclear@0 290 //! Material index of the mesh
nuclear@0 291 unsigned int iMaterialIndex;
nuclear@0 292
nuclear@0 293 //! Number of vertex components for each UVW set
nuclear@0 294 unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
nuclear@0 295
nuclear@0 296 //! used internally
nuclear@0 297 bool bSkip;
nuclear@0 298 };
nuclear@0 299
nuclear@0 300 // ---------------------------------------------------------------------------
nuclear@0 301 /** Helper structure to represent an ASE light source */
nuclear@0 302 struct Light : public BaseNode
nuclear@0 303 {
nuclear@0 304 enum LightType
nuclear@0 305 {
nuclear@0 306 OMNI,
nuclear@0 307 TARGET,
nuclear@0 308 FREE,
nuclear@0 309 DIRECTIONAL
nuclear@0 310 };
nuclear@0 311
nuclear@0 312 //! Constructor.
nuclear@0 313 Light()
nuclear@0 314 : BaseNode (BaseNode::Light)
nuclear@0 315 , mLightType (OMNI)
nuclear@0 316 , mColor (1.f,1.f,1.f)
nuclear@0 317 , mIntensity (1.f) // light is white by default
nuclear@0 318 , mAngle (45.f)
nuclear@0 319 , mFalloff (0.f)
nuclear@0 320 {
nuclear@0 321 }
nuclear@0 322
nuclear@0 323 LightType mLightType;
nuclear@0 324 aiColor3D mColor;
nuclear@0 325 float mIntensity;
nuclear@0 326 float mAngle; // in degrees
nuclear@0 327 float mFalloff;
nuclear@0 328 };
nuclear@0 329
nuclear@0 330 // ---------------------------------------------------------------------------
nuclear@0 331 /** Helper structure to represent an ASE camera */
nuclear@0 332 struct Camera : public BaseNode
nuclear@0 333 {
nuclear@0 334 enum CameraType
nuclear@0 335 {
nuclear@0 336 FREE,
nuclear@0 337 TARGET
nuclear@0 338 };
nuclear@0 339
nuclear@0 340 //! Constructor
nuclear@0 341 Camera()
nuclear@0 342 : BaseNode (BaseNode::Camera)
nuclear@0 343 , mFOV (0.75f) // in radians
nuclear@0 344 , mNear (0.1f)
nuclear@0 345 , mFar (1000.f) // could be zero
nuclear@0 346 , mCameraType (FREE)
nuclear@0 347 {
nuclear@0 348 }
nuclear@0 349
nuclear@0 350 float mFOV, mNear, mFar;
nuclear@0 351 CameraType mCameraType;
nuclear@0 352 };
nuclear@0 353
nuclear@0 354 // ---------------------------------------------------------------------------
nuclear@0 355 /** Helper structure to represent an ASE helper object (dummy) */
nuclear@0 356 struct Dummy : public BaseNode
nuclear@0 357 {
nuclear@0 358 //! Constructor
nuclear@0 359 Dummy()
nuclear@0 360 : BaseNode (BaseNode::Dummy)
nuclear@0 361 {
nuclear@0 362 }
nuclear@0 363 };
nuclear@0 364
nuclear@0 365 // Parameters to Parser::Parse()
nuclear@0 366 #define AI_ASE_NEW_FILE_FORMAT 200
nuclear@0 367 #define AI_ASE_OLD_FILE_FORMAT 110
nuclear@0 368
nuclear@0 369 // Internally we're a little bit more tolerant
nuclear@0 370 #define AI_ASE_IS_NEW_FILE_FORMAT() (iFileFormat >= 200)
nuclear@0 371 #define AI_ASE_IS_OLD_FILE_FORMAT() (iFileFormat < 200)
nuclear@0 372
nuclear@0 373 // -------------------------------------------------------------------------------
nuclear@0 374 /** \brief Class to parse ASE files
nuclear@0 375 */
nuclear@0 376 class Parser
nuclear@0 377 {
nuclear@0 378
nuclear@0 379 private:
nuclear@0 380
nuclear@0 381 Parser() {}
nuclear@0 382
nuclear@0 383 public:
nuclear@0 384
nuclear@0 385 // -------------------------------------------------------------------
nuclear@0 386 //! Construct a parser from a given input file which is
nuclear@0 387 //! guaranted to be terminated with zero.
nuclear@0 388 //! @param szFile Input file
nuclear@0 389 //! @param fileFormatDefault Assumed file format version. If the
nuclear@0 390 //! file format is specified in the file the new value replaces
nuclear@0 391 //! the default value.
nuclear@0 392 Parser (const char* szFile, unsigned int fileFormatDefault);
nuclear@0 393
nuclear@0 394 // -------------------------------------------------------------------
nuclear@0 395 //! Parses the file into the parsers internal representation
nuclear@0 396 void Parse();
nuclear@0 397
nuclear@0 398
nuclear@0 399 private:
nuclear@0 400
nuclear@0 401 // -------------------------------------------------------------------
nuclear@0 402 //! Parse the *SCENE block in a file
nuclear@0 403 void ParseLV1SceneBlock();
nuclear@0 404
nuclear@0 405 // -------------------------------------------------------------------
nuclear@0 406 //! Parse the *MESH_SOFTSKINVERTS block in a file
nuclear@0 407 void ParseLV1SoftSkinBlock();
nuclear@0 408
nuclear@0 409 // -------------------------------------------------------------------
nuclear@0 410 //! Parse the *MATERIAL_LIST block in a file
nuclear@0 411 void ParseLV1MaterialListBlock();
nuclear@0 412
nuclear@0 413 // -------------------------------------------------------------------
nuclear@0 414 //! Parse a *<xxx>OBJECT block in a file
nuclear@0 415 //! \param mesh Node to be filled
nuclear@0 416 void ParseLV1ObjectBlock(BaseNode& mesh);
nuclear@0 417
nuclear@0 418 // -------------------------------------------------------------------
nuclear@0 419 //! Parse a *MATERIAL blocks in a material list
nuclear@0 420 //! \param mat Material structure to be filled
nuclear@0 421 void ParseLV2MaterialBlock(Material& mat);
nuclear@0 422
nuclear@0 423 // -------------------------------------------------------------------
nuclear@0 424 //! Parse a *NODE_TM block in a file
nuclear@0 425 //! \param mesh Node (!) object to be filled
nuclear@0 426 void ParseLV2NodeTransformBlock(BaseNode& mesh);
nuclear@0 427
nuclear@0 428 // -------------------------------------------------------------------
nuclear@0 429 //! Parse a *TM_ANIMATION block in a file
nuclear@0 430 //! \param mesh Mesh object to be filled
nuclear@0 431 void ParseLV2AnimationBlock(BaseNode& mesh);
nuclear@0 432 void ParseLV3PosAnimationBlock(ASE::Animation& anim);
nuclear@0 433 void ParseLV3ScaleAnimationBlock(ASE::Animation& anim);
nuclear@0 434 void ParseLV3RotAnimationBlock(ASE::Animation& anim);
nuclear@0 435
nuclear@0 436 // -------------------------------------------------------------------
nuclear@0 437 //! Parse a *MESH block in a file
nuclear@0 438 //! \param mesh Mesh object to be filled
nuclear@0 439 void ParseLV2MeshBlock(Mesh& mesh);
nuclear@0 440
nuclear@0 441 // -------------------------------------------------------------------
nuclear@0 442 //! Parse a *LIGHT_SETTINGS block in a file
nuclear@0 443 //! \param light Light object to be filled
nuclear@0 444 void ParseLV2LightSettingsBlock(Light& light);
nuclear@0 445
nuclear@0 446 // -------------------------------------------------------------------
nuclear@0 447 //! Parse a *CAMERA_SETTINGS block in a file
nuclear@0 448 //! \param cam Camera object to be filled
nuclear@0 449 void ParseLV2CameraSettingsBlock(Camera& cam);
nuclear@0 450
nuclear@0 451 // -------------------------------------------------------------------
nuclear@0 452 //! Parse the *MAP_XXXXXX blocks in a material
nuclear@0 453 //! \param map Texture structure to be filled
nuclear@0 454 void ParseLV3MapBlock(Texture& map);
nuclear@0 455
nuclear@0 456 // -------------------------------------------------------------------
nuclear@0 457 //! Parse a *MESH_VERTEX_LIST block in a file
nuclear@0 458 //! \param iNumVertices Value of *MESH_NUMVERTEX, if present.
nuclear@0 459 //! Otherwise zero. This is used to check the consistency of the file.
nuclear@0 460 //! A warning is sent to the logger if the validations fails.
nuclear@0 461 //! \param mesh Mesh object to be filled
nuclear@0 462 void ParseLV3MeshVertexListBlock(
nuclear@0 463 unsigned int iNumVertices,Mesh& mesh);
nuclear@0 464
nuclear@0 465 // -------------------------------------------------------------------
nuclear@0 466 //! Parse a *MESH_FACE_LIST block in a file
nuclear@0 467 //! \param iNumFaces Value of *MESH_NUMFACES, if present.
nuclear@0 468 //! Otherwise zero. This is used to check the consistency of the file.
nuclear@0 469 //! A warning is sent to the logger if the validations fails.
nuclear@0 470 //! \param mesh Mesh object to be filled
nuclear@0 471 void ParseLV3MeshFaceListBlock(
nuclear@0 472 unsigned int iNumFaces,Mesh& mesh);
nuclear@0 473
nuclear@0 474 // -------------------------------------------------------------------
nuclear@0 475 //! Parse a *MESH_TVERT_LIST block in a file
nuclear@0 476 //! \param iNumVertices Value of *MESH_NUMTVERTEX, if present.
nuclear@0 477 //! Otherwise zero. This is used to check the consistency of the file.
nuclear@0 478 //! A warning is sent to the logger if the validations fails.
nuclear@0 479 //! \param mesh Mesh object to be filled
nuclear@0 480 //! \param iChannel Output UVW channel
nuclear@0 481 void ParseLV3MeshTListBlock(
nuclear@0 482 unsigned int iNumVertices,Mesh& mesh, unsigned int iChannel = 0);
nuclear@0 483
nuclear@0 484 // -------------------------------------------------------------------
nuclear@0 485 //! Parse a *MESH_TFACELIST block in a file
nuclear@0 486 //! \param iNumFaces Value of *MESH_NUMTVFACES, if present.
nuclear@0 487 //! Otherwise zero. This is used to check the consistency of the file.
nuclear@0 488 //! A warning is sent to the logger if the validations fails.
nuclear@0 489 //! \param mesh Mesh object to be filled
nuclear@0 490 //! \param iChannel Output UVW channel
nuclear@0 491 void ParseLV3MeshTFaceListBlock(
nuclear@0 492 unsigned int iNumFaces,Mesh& mesh, unsigned int iChannel = 0);
nuclear@0 493
nuclear@0 494 // -------------------------------------------------------------------
nuclear@0 495 //! Parse an additional mapping channel
nuclear@0 496 //! (specified via *MESH_MAPPINGCHANNEL)
nuclear@0 497 //! \param iChannel Channel index to be filled
nuclear@0 498 //! \param mesh Mesh object to be filled
nuclear@0 499 void ParseLV3MappingChannel(
nuclear@0 500 unsigned int iChannel, Mesh& mesh);
nuclear@0 501
nuclear@0 502 // -------------------------------------------------------------------
nuclear@0 503 //! Parse a *MESH_CVERTLIST block in a file
nuclear@0 504 //! \param iNumVertices Value of *MESH_NUMCVERTEX, if present.
nuclear@0 505 //! Otherwise zero. This is used to check the consistency of the file.
nuclear@0 506 //! A warning is sent to the logger if the validations fails.
nuclear@0 507 //! \param mesh Mesh object to be filled
nuclear@0 508 void ParseLV3MeshCListBlock(
nuclear@0 509 unsigned int iNumVertices, Mesh& mesh);
nuclear@0 510
nuclear@0 511 // -------------------------------------------------------------------
nuclear@0 512 //! Parse a *MESH_CFACELIST block in a file
nuclear@0 513 //! \param iNumFaces Value of *MESH_NUMCVFACES, if present.
nuclear@0 514 //! Otherwise zero. This is used to check the consistency of the file.
nuclear@0 515 //! A warning is sent to the logger if the validations fails.
nuclear@0 516 //! \param mesh Mesh object to be filled
nuclear@0 517 void ParseLV3MeshCFaceListBlock(
nuclear@0 518 unsigned int iNumFaces, Mesh& mesh);
nuclear@0 519
nuclear@0 520 // -------------------------------------------------------------------
nuclear@0 521 //! Parse a *MESH_NORMALS block in a file
nuclear@0 522 //! \param mesh Mesh object to be filled
nuclear@0 523 void ParseLV3MeshNormalListBlock(Mesh& mesh);
nuclear@0 524
nuclear@0 525 // -------------------------------------------------------------------
nuclear@0 526 //! Parse a *MESH_WEIGHTSblock in a file
nuclear@0 527 //! \param mesh Mesh object to be filled
nuclear@0 528 void ParseLV3MeshWeightsBlock(Mesh& mesh);
nuclear@0 529
nuclear@0 530 // -------------------------------------------------------------------
nuclear@0 531 //! Parse the bone list of a file
nuclear@0 532 //! \param mesh Mesh object to be filled
nuclear@0 533 //! \param iNumBones Number of bones in the mesh
nuclear@0 534 void ParseLV4MeshBones(unsigned int iNumBones,Mesh& mesh);
nuclear@0 535
nuclear@0 536 // -------------------------------------------------------------------
nuclear@0 537 //! Parse the bone vertices list of a file
nuclear@0 538 //! \param mesh Mesh object to be filled
nuclear@0 539 //! \param iNumVertices Number of vertices to be parsed
nuclear@0 540 void ParseLV4MeshBonesVertices(unsigned int iNumVertices,Mesh& mesh);
nuclear@0 541
nuclear@0 542 // -------------------------------------------------------------------
nuclear@0 543 //! Parse a *MESH_FACE block in a file
nuclear@0 544 //! \param out receive the face data
nuclear@0 545 void ParseLV4MeshFace(ASE::Face& out);
nuclear@0 546
nuclear@0 547 // -------------------------------------------------------------------
nuclear@0 548 //! Parse a *MESH_VERT block in a file
nuclear@0 549 //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
nuclear@0 550 //! \param apOut Output buffer (3 floats)
nuclear@0 551 //! \param rIndexOut Output index
nuclear@0 552 void ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut);
nuclear@0 553
nuclear@0 554 // -------------------------------------------------------------------
nuclear@0 555 //! Parse a *MESH_VERT block in a file
nuclear@0 556 //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
nuclear@0 557 //! \param apOut Output buffer (3 floats)
nuclear@0 558 void ParseLV4MeshFloatTriple(float* apOut);
nuclear@0 559
nuclear@0 560 // -------------------------------------------------------------------
nuclear@0 561 //! Parse a *MESH_TFACE block in a file
nuclear@0 562 //! (also works for MESH_CFACE)
nuclear@0 563 //! \param apOut Output buffer (3 ints)
nuclear@0 564 //! \param rIndexOut Output index
nuclear@0 565 void ParseLV4MeshLongTriple(unsigned int* apOut, unsigned int& rIndexOut);
nuclear@0 566
nuclear@0 567 // -------------------------------------------------------------------
nuclear@0 568 //! Parse a *MESH_TFACE block in a file
nuclear@0 569 //! (also works for MESH_CFACE)
nuclear@0 570 //! \param apOut Output buffer (3 ints)
nuclear@0 571 void ParseLV4MeshLongTriple(unsigned int* apOut);
nuclear@0 572
nuclear@0 573 // -------------------------------------------------------------------
nuclear@0 574 //! Parse a single float element
nuclear@0 575 //! \param fOut Output float
nuclear@0 576 void ParseLV4MeshFloat(float& fOut);
nuclear@0 577
nuclear@0 578 // -------------------------------------------------------------------
nuclear@0 579 //! Parse a single int element
nuclear@0 580 //! \param iOut Output integer
nuclear@0 581 void ParseLV4MeshLong(unsigned int& iOut);
nuclear@0 582
nuclear@0 583 // -------------------------------------------------------------------
nuclear@0 584 //! Skip everything to the next: '*' or '\0'
nuclear@0 585 bool SkipToNextToken();
nuclear@0 586
nuclear@0 587 // -------------------------------------------------------------------
nuclear@0 588 //! Skip the current section until the token after the closing }.
nuclear@0 589 //! This function handles embedded subsections correctly
nuclear@0 590 bool SkipSection();
nuclear@0 591
nuclear@0 592 // -------------------------------------------------------------------
nuclear@0 593 //! Output a warning to the logger
nuclear@0 594 //! \param szWarn Warn message
nuclear@0 595 void LogWarning(const char* szWarn);
nuclear@0 596
nuclear@0 597 // -------------------------------------------------------------------
nuclear@0 598 //! Output a message to the logger
nuclear@0 599 //! \param szWarn Message
nuclear@0 600 void LogInfo(const char* szWarn);
nuclear@0 601
nuclear@0 602 // -------------------------------------------------------------------
nuclear@0 603 //! Output an error to the logger
nuclear@0 604 //! \param szWarn Error message
nuclear@0 605 void LogError(const char* szWarn);
nuclear@0 606
nuclear@0 607 // -------------------------------------------------------------------
nuclear@0 608 //! Parse a string, enclosed in double quotation marks
nuclear@0 609 //! \param out Output string
nuclear@0 610 //! \param szName Name of the enclosing element -> used in error
nuclear@0 611 //! messages.
nuclear@0 612 //! \return false if an error occured
nuclear@0 613 bool ParseString(std::string& out,const char* szName);
nuclear@0 614
nuclear@0 615 public:
nuclear@0 616
nuclear@0 617 //! Pointer to current data
nuclear@0 618 const char* filePtr;
nuclear@0 619
nuclear@0 620 //! background color to be passed to the viewer
nuclear@0 621 //! QNAN if none was found
nuclear@0 622 aiColor3D m_clrBackground;
nuclear@0 623
nuclear@0 624 //! Base ambient color to be passed to all materials
nuclear@0 625 //! QNAN if none was found
nuclear@0 626 aiColor3D m_clrAmbient;
nuclear@0 627
nuclear@0 628 //! List of all materials found in the file
nuclear@0 629 std::vector<Material> m_vMaterials;
nuclear@0 630
nuclear@0 631 //! List of all meshes found in the file
nuclear@0 632 std::vector<Mesh> m_vMeshes;
nuclear@0 633
nuclear@0 634 //! List of all dummies found in the file
nuclear@0 635 std::vector<Dummy> m_vDummies;
nuclear@0 636
nuclear@0 637 //! List of all lights found in the file
nuclear@0 638 std::vector<Light> m_vLights;
nuclear@0 639
nuclear@0 640 //! List of all cameras found in the file
nuclear@0 641 std::vector<Camera> m_vCameras;
nuclear@0 642
nuclear@0 643 //! Current line in the file
nuclear@0 644 unsigned int iLineNumber;
nuclear@0 645
nuclear@0 646 //! First frame
nuclear@0 647 unsigned int iFirstFrame;
nuclear@0 648
nuclear@0 649 //! Last frame
nuclear@0 650 unsigned int iLastFrame;
nuclear@0 651
nuclear@0 652 //! Frame speed - frames per second
nuclear@0 653 unsigned int iFrameSpeed;
nuclear@0 654
nuclear@0 655 //! Ticks per frame
nuclear@0 656 unsigned int iTicksPerFrame;
nuclear@0 657
nuclear@0 658 //! true if the last character read was an end-line character
nuclear@0 659 bool bLastWasEndLine;
nuclear@0 660
nuclear@0 661 //! File format version
nuclear@0 662 unsigned int iFileFormat;
nuclear@0 663 };
nuclear@0 664
nuclear@0 665
nuclear@0 666 } // Namespace ASE
nuclear@0 667 } // Namespace ASSIMP
nuclear@0 668
nuclear@0 669 #endif // !! include guard