vrshoot

annotate libs/assimp/ColladaHelper.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
rev   line source
nuclear@0 1 /** Helper structures for the Collada loader */
nuclear@0 2
nuclear@0 3 /*
nuclear@0 4 Open Asset Import Library (assimp)
nuclear@0 5 ----------------------------------------------------------------------
nuclear@0 6
nuclear@0 7 Copyright (c) 2006-2012, assimp team
nuclear@0 8 All rights reserved.
nuclear@0 9
nuclear@0 10 Redistribution and use of this software in source and binary forms,
nuclear@0 11 with or without modification, are permitted provided that the
nuclear@0 12 following conditions are met:
nuclear@0 13
nuclear@0 14 * Redistributions of source code must retain the above
nuclear@0 15 copyright notice, this list of conditions and the
nuclear@0 16 following disclaimer.
nuclear@0 17
nuclear@0 18 * Redistributions in binary form must reproduce the above
nuclear@0 19 copyright notice, this list of conditions and the
nuclear@0 20 following disclaimer in the documentation and/or other
nuclear@0 21 materials provided with the distribution.
nuclear@0 22
nuclear@0 23 * Neither the name of the assimp team, nor the names of its
nuclear@0 24 contributors may be used to endorse or promote products
nuclear@0 25 derived from this software without specific prior
nuclear@0 26 written permission of the assimp team.
nuclear@0 27
nuclear@0 28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
nuclear@0 29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
nuclear@0 30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
nuclear@0 31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
nuclear@0 32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
nuclear@0 33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
nuclear@0 34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
nuclear@0 35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
nuclear@0 36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
nuclear@0 37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
nuclear@0 38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nuclear@0 39
nuclear@0 40 ----------------------------------------------------------------------
nuclear@0 41 */
nuclear@0 42
nuclear@0 43 #ifndef AI_COLLADAHELPER_H_INC
nuclear@0 44 #define AI_COLLADAHELPER_H_INC
nuclear@0 45
nuclear@0 46 namespace Assimp {
nuclear@0 47 namespace Collada {
nuclear@0 48
nuclear@0 49 /** Collada file versions which evolved during the years ... */
nuclear@0 50 enum FormatVersion
nuclear@0 51 {
nuclear@0 52 FV_1_5_n,
nuclear@0 53 FV_1_4_n,
nuclear@0 54 FV_1_3_n
nuclear@0 55 };
nuclear@0 56
nuclear@0 57
nuclear@0 58 /** Transformation types that can be applied to a node */
nuclear@0 59 enum TransformType
nuclear@0 60 {
nuclear@0 61 TF_LOOKAT,
nuclear@0 62 TF_ROTATE,
nuclear@0 63 TF_TRANSLATE,
nuclear@0 64 TF_SCALE,
nuclear@0 65 TF_SKEW,
nuclear@0 66 TF_MATRIX
nuclear@0 67 };
nuclear@0 68
nuclear@0 69 /** Different types of input data to a vertex or face */
nuclear@0 70 enum InputType
nuclear@0 71 {
nuclear@0 72 IT_Invalid,
nuclear@0 73 IT_Vertex, // special type for per-index data referring to the <vertices> element carrying the per-vertex data.
nuclear@0 74 IT_Position,
nuclear@0 75 IT_Normal,
nuclear@0 76 IT_Texcoord,
nuclear@0 77 IT_Color,
nuclear@0 78 IT_Tangent,
nuclear@0 79 IT_Bitangent
nuclear@0 80 };
nuclear@0 81
nuclear@0 82 /** Contains all data for one of the different transformation types */
nuclear@0 83 struct Transform
nuclear@0 84 {
nuclear@0 85 std::string mID; ///< SID of the transform step, by which anim channels address their target node
nuclear@0 86 TransformType mType;
nuclear@0 87 float f[16]; ///< Interpretation of data depends on the type of the transformation
nuclear@0 88 };
nuclear@0 89
nuclear@0 90 /** A collada camera. */
nuclear@0 91 struct Camera
nuclear@0 92 {
nuclear@0 93 Camera()
nuclear@0 94 : mOrtho (false)
nuclear@0 95 , mHorFov (10e10f)
nuclear@0 96 , mVerFov (10e10f)
nuclear@0 97 , mAspect (10e10f)
nuclear@0 98 , mZNear (0.1f)
nuclear@0 99 , mZFar (1000.f)
nuclear@0 100 {}
nuclear@0 101
nuclear@0 102 // Name of camera
nuclear@0 103 std::string mName;
nuclear@0 104
nuclear@0 105 // True if it is an orthografic camera
nuclear@0 106 bool mOrtho;
nuclear@0 107
nuclear@0 108 //! Horizontal field of view in degrees
nuclear@0 109 float mHorFov;
nuclear@0 110
nuclear@0 111 //! Vertical field of view in degrees
nuclear@0 112 float mVerFov;
nuclear@0 113
nuclear@0 114 //! Screen aspect
nuclear@0 115 float mAspect;
nuclear@0 116
nuclear@0 117 //! Near& far z
nuclear@0 118 float mZNear, mZFar;
nuclear@0 119 };
nuclear@0 120
nuclear@0 121 #define aiLightSource_AMBIENT 0xdeaddead
nuclear@0 122 #define ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET 1e9f
nuclear@0 123
nuclear@0 124 /** A collada light source. */
nuclear@0 125 struct Light
nuclear@0 126 {
nuclear@0 127 Light()
nuclear@0 128 : mAttConstant (1.f)
nuclear@0 129 , mAttLinear (0.f)
nuclear@0 130 , mAttQuadratic (0.f)
nuclear@0 131 , mFalloffAngle (180.f)
nuclear@0 132 , mFalloffExponent (0.f)
nuclear@0 133 , mPenumbraAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET)
nuclear@0 134 , mOuterAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET)
nuclear@0 135 , mIntensity (1.f)
nuclear@0 136 {}
nuclear@0 137
nuclear@0 138 //! Type of the light source aiLightSourceType + ambient
nuclear@0 139 unsigned int mType;
nuclear@0 140
nuclear@0 141 //! Color of the light
nuclear@0 142 aiColor3D mColor;
nuclear@0 143
nuclear@0 144 //! Light attenuation
nuclear@0 145 float mAttConstant,mAttLinear,mAttQuadratic;
nuclear@0 146
nuclear@0 147 //! Spot light falloff
nuclear@0 148 float mFalloffAngle;
nuclear@0 149 float mFalloffExponent;
nuclear@0 150
nuclear@0 151 // -----------------------------------------------------
nuclear@0 152 // FCOLLADA extension from here
nuclear@0 153
nuclear@0 154 //! ... related stuff from maja and max extensions
nuclear@0 155 float mPenumbraAngle;
nuclear@0 156 float mOuterAngle;
nuclear@0 157
nuclear@0 158 //! Common light intensity
nuclear@0 159 float mIntensity;
nuclear@0 160 };
nuclear@0 161
nuclear@0 162 /** Short vertex index description */
nuclear@0 163 struct InputSemanticMapEntry
nuclear@0 164 {
nuclear@0 165 InputSemanticMapEntry()
nuclear@0 166 : mSet (0)
nuclear@0 167 {}
nuclear@0 168
nuclear@0 169 //! Index of set, optional
nuclear@0 170 unsigned int mSet;
nuclear@0 171
nuclear@0 172 //! Name of referenced vertex input
nuclear@0 173 InputType mType;
nuclear@0 174 };
nuclear@0 175
nuclear@0 176 /** Table to map from effect to vertex input semantics */
nuclear@0 177 struct SemanticMappingTable
nuclear@0 178 {
nuclear@0 179 //! Name of material
nuclear@0 180 std::string mMatName;
nuclear@0 181
nuclear@0 182 //! List of semantic map commands, grouped by effect semantic name
nuclear@0 183 std::map<std::string, InputSemanticMapEntry> mMap;
nuclear@0 184
nuclear@0 185 //! For std::find
nuclear@0 186 bool operator == (const std::string& s) const {
nuclear@0 187 return s == mMatName;
nuclear@0 188 }
nuclear@0 189 };
nuclear@0 190
nuclear@0 191 /** A reference to a mesh inside a node, including materials assigned to the various subgroups.
nuclear@0 192 * The ID refers to either a mesh or a controller which specifies the mesh
nuclear@0 193 */
nuclear@0 194 struct MeshInstance
nuclear@0 195 {
nuclear@0 196 ///< ID of the mesh or controller to be instanced
nuclear@0 197 std::string mMeshOrController;
nuclear@0 198
nuclear@0 199 ///< Map of materials by the subgroup ID they're applied to
nuclear@0 200 std::map<std::string, SemanticMappingTable> mMaterials;
nuclear@0 201 };
nuclear@0 202
nuclear@0 203 /** A reference to a camera inside a node*/
nuclear@0 204 struct CameraInstance
nuclear@0 205 {
nuclear@0 206 ///< ID of the camera
nuclear@0 207 std::string mCamera;
nuclear@0 208 };
nuclear@0 209
nuclear@0 210 /** A reference to a light inside a node*/
nuclear@0 211 struct LightInstance
nuclear@0 212 {
nuclear@0 213 ///< ID of the camera
nuclear@0 214 std::string mLight;
nuclear@0 215 };
nuclear@0 216
nuclear@0 217 /** A reference to a node inside a node*/
nuclear@0 218 struct NodeInstance
nuclear@0 219 {
nuclear@0 220 ///< ID of the node
nuclear@0 221 std::string mNode;
nuclear@0 222 };
nuclear@0 223
nuclear@0 224 /** A node in a scene hierarchy */
nuclear@0 225 struct Node
nuclear@0 226 {
nuclear@0 227 std::string mName;
nuclear@0 228 std::string mID;
nuclear@0 229 std::string mSID;
nuclear@0 230 Node* mParent;
nuclear@0 231 std::vector<Node*> mChildren;
nuclear@0 232
nuclear@0 233 /** Operations in order to calculate the resulting transformation to parent. */
nuclear@0 234 std::vector<Transform> mTransforms;
nuclear@0 235
nuclear@0 236 /** Meshes at this node */
nuclear@0 237 std::vector<MeshInstance> mMeshes;
nuclear@0 238
nuclear@0 239 /** Lights at this node */
nuclear@0 240 std::vector<LightInstance> mLights;
nuclear@0 241
nuclear@0 242 /** Cameras at this node */
nuclear@0 243 std::vector<CameraInstance> mCameras;
nuclear@0 244
nuclear@0 245 /** Node instances at this node */
nuclear@0 246 std::vector<NodeInstance> mNodeInstances;
nuclear@0 247
nuclear@0 248 /** Rootnodes: Name of primary camera, if any */
nuclear@0 249 std::string mPrimaryCamera;
nuclear@0 250
nuclear@0 251 //! Constructor. Begin with a zero parent
nuclear@0 252 Node() {
nuclear@0 253 mParent = NULL;
nuclear@0 254 }
nuclear@0 255
nuclear@0 256 //! Destructor: delete all children subsequently
nuclear@0 257 ~Node() {
nuclear@0 258 for( std::vector<Node*>::iterator it = mChildren.begin(); it != mChildren.end(); ++it)
nuclear@0 259 delete *it;
nuclear@0 260 }
nuclear@0 261 };
nuclear@0 262
nuclear@0 263 /** Data source array: either floats or strings */
nuclear@0 264 struct Data
nuclear@0 265 {
nuclear@0 266 bool mIsStringArray;
nuclear@0 267 std::vector<float> mValues;
nuclear@0 268 std::vector<std::string> mStrings;
nuclear@0 269 };
nuclear@0 270
nuclear@0 271 /** Accessor to a data array */
nuclear@0 272 struct Accessor
nuclear@0 273 {
nuclear@0 274 size_t mCount; // in number of objects
nuclear@0 275 size_t mSize; // size of an object, in elements (floats or strings, mostly 1)
nuclear@0 276 size_t mOffset; // in number of values
nuclear@0 277 size_t mStride; // Stride in number of values
nuclear@0 278 std::vector<std::string> mParams; // names of the data streams in the accessors. Empty string tells to ignore.
nuclear@0 279 size_t mSubOffset[4]; // Suboffset inside the object for the common 4 elements. For a vector, thats XYZ, for a color RGBA and so on.
nuclear@0 280 // For example, SubOffset[0] denotes which of the values inside the object is the vector X component.
nuclear@0 281 std::string mSource; // URL of the source array
nuclear@0 282 mutable const Data* mData; // Pointer to the source array, if resolved. NULL else
nuclear@0 283
nuclear@0 284 Accessor()
nuclear@0 285 {
nuclear@0 286 mCount = 0; mSize = 0; mOffset = 0; mStride = 0; mData = NULL;
nuclear@0 287 mSubOffset[0] = mSubOffset[1] = mSubOffset[2] = mSubOffset[3] = 0;
nuclear@0 288 }
nuclear@0 289 };
nuclear@0 290
nuclear@0 291 /** A single face in a mesh */
nuclear@0 292 struct Face
nuclear@0 293 {
nuclear@0 294 std::vector<size_t> mIndices;
nuclear@0 295 };
nuclear@0 296
nuclear@0 297 /** An input channel for mesh data, referring to a single accessor */
nuclear@0 298 struct InputChannel
nuclear@0 299 {
nuclear@0 300 InputType mType; // Type of the data
nuclear@0 301 size_t mIndex; // Optional index, if multiple sets of the same data type are given
nuclear@0 302 size_t mOffset; // Index offset in the indices array of per-face indices. Don't ask, can't explain that any better.
nuclear@0 303 std::string mAccessor; // ID of the accessor where to read the actual values from.
nuclear@0 304 mutable const Accessor* mResolved; // Pointer to the accessor, if resolved. NULL else
nuclear@0 305
nuclear@0 306 InputChannel() { mType = IT_Invalid; mIndex = 0; mOffset = 0; mResolved = NULL; }
nuclear@0 307 };
nuclear@0 308
nuclear@0 309 /** Subset of a mesh with a certain material */
nuclear@0 310 struct SubMesh
nuclear@0 311 {
nuclear@0 312 std::string mMaterial; ///< subgroup identifier
nuclear@0 313 size_t mNumFaces; ///< number of faces in this submesh
nuclear@0 314 };
nuclear@0 315
nuclear@0 316 /** Contains data for a single mesh */
nuclear@0 317 struct Mesh
nuclear@0 318 {
nuclear@0 319 Mesh()
nuclear@0 320 {
nuclear@0 321 for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i)
nuclear@0 322 mNumUVComponents[i] = 2;
nuclear@0 323 }
nuclear@0 324
nuclear@0 325 // just to check if there's some sophisticated addressing involved...
nuclear@0 326 // which we don't support, and therefore should warn about.
nuclear@0 327 std::string mVertexID;
nuclear@0 328
nuclear@0 329 // Vertex data addressed by vertex indices
nuclear@0 330 std::vector<InputChannel> mPerVertexData;
nuclear@0 331
nuclear@0 332 // actual mesh data, assembled on encounter of a <p> element. Verbose format, not indexed
nuclear@0 333 std::vector<aiVector3D> mPositions;
nuclear@0 334 std::vector<aiVector3D> mNormals;
nuclear@0 335 std::vector<aiVector3D> mTangents;
nuclear@0 336 std::vector<aiVector3D> mBitangents;
nuclear@0 337 std::vector<aiVector3D> mTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
nuclear@0 338 std::vector<aiColor4D> mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
nuclear@0 339
nuclear@0 340 unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
nuclear@0 341
nuclear@0 342 // Faces. Stored are only the number of vertices for each face.
nuclear@0 343 // 1 == point, 2 == line, 3 == triangle, 4+ == poly
nuclear@0 344 std::vector<size_t> mFaceSize;
nuclear@0 345
nuclear@0 346 // Position indices for all faces in the sequence given in mFaceSize -
nuclear@0 347 // necessary for bone weight assignment
nuclear@0 348 std::vector<size_t> mFacePosIndices;
nuclear@0 349
nuclear@0 350 // Submeshes in this mesh, each with a given material
nuclear@0 351 std::vector<SubMesh> mSubMeshes;
nuclear@0 352 };
nuclear@0 353
nuclear@0 354 /** Which type of primitives the ReadPrimitives() function is going to read */
nuclear@0 355 enum PrimitiveType
nuclear@0 356 {
nuclear@0 357 Prim_Invalid,
nuclear@0 358 Prim_Lines,
nuclear@0 359 Prim_LineStrip,
nuclear@0 360 Prim_Triangles,
nuclear@0 361 Prim_TriStrips,
nuclear@0 362 Prim_TriFans,
nuclear@0 363 Prim_Polylist,
nuclear@0 364 Prim_Polygon
nuclear@0 365 };
nuclear@0 366
nuclear@0 367 /** A skeleton controller to deform a mesh with the use of joints */
nuclear@0 368 struct Controller
nuclear@0 369 {
nuclear@0 370 // the URL of the mesh deformed by the controller.
nuclear@0 371 std::string mMeshId;
nuclear@0 372
nuclear@0 373 // accessor URL of the joint names
nuclear@0 374 std::string mJointNameSource;
nuclear@0 375
nuclear@0 376 ///< The bind shape matrix, as array of floats. I'm not sure what this matrix actually describes, but it can't be ignored in all cases
nuclear@0 377 float mBindShapeMatrix[16];
nuclear@0 378
nuclear@0 379 // accessor URL of the joint inverse bind matrices
nuclear@0 380 std::string mJointOffsetMatrixSource;
nuclear@0 381
nuclear@0 382 // input channel: joint names.
nuclear@0 383 InputChannel mWeightInputJoints;
nuclear@0 384 // input channel: joint weights
nuclear@0 385 InputChannel mWeightInputWeights;
nuclear@0 386
nuclear@0 387 // Number of weights per vertex.
nuclear@0 388 std::vector<size_t> mWeightCounts;
nuclear@0 389
nuclear@0 390 // JointIndex-WeightIndex pairs for all vertices
nuclear@0 391 std::vector< std::pair<size_t, size_t> > mWeights;
nuclear@0 392 };
nuclear@0 393
nuclear@0 394 /** A collada material. Pretty much the only member is a reference to an effect. */
nuclear@0 395 struct Material
nuclear@0 396 {
nuclear@0 397 std::string mEffect;
nuclear@0 398 };
nuclear@0 399
nuclear@0 400 /** Type of the effect param */
nuclear@0 401 enum ParamType
nuclear@0 402 {
nuclear@0 403 Param_Sampler,
nuclear@0 404 Param_Surface
nuclear@0 405 };
nuclear@0 406
nuclear@0 407 /** A param for an effect. Might be of several types, but they all just refer to each other, so I summarize them */
nuclear@0 408 struct EffectParam
nuclear@0 409 {
nuclear@0 410 ParamType mType;
nuclear@0 411 std::string mReference; // to which other thing the param is referring to.
nuclear@0 412 };
nuclear@0 413
nuclear@0 414 /** Shading type supported by the standard effect spec of Collada */
nuclear@0 415 enum ShadeType
nuclear@0 416 {
nuclear@0 417 Shade_Invalid,
nuclear@0 418 Shade_Constant,
nuclear@0 419 Shade_Lambert,
nuclear@0 420 Shade_Phong,
nuclear@0 421 Shade_Blinn
nuclear@0 422 };
nuclear@0 423
nuclear@0 424 /** Represents a texture sampler in collada */
nuclear@0 425 struct Sampler
nuclear@0 426 {
nuclear@0 427 Sampler()
nuclear@0 428 : mWrapU (true)
nuclear@0 429 , mWrapV (true)
nuclear@0 430 , mMirrorU ()
nuclear@0 431 , mMirrorV ()
nuclear@0 432 , mOp (aiTextureOp_Multiply)
nuclear@0 433 , mUVId (UINT_MAX)
nuclear@0 434 , mWeighting (1.f)
nuclear@0 435 , mMixWithPrevious (1.f)
nuclear@0 436 {}
nuclear@0 437
nuclear@0 438 /** Name of image reference
nuclear@0 439 */
nuclear@0 440 std::string mName;
nuclear@0 441
nuclear@0 442 /** Wrap U?
nuclear@0 443 */
nuclear@0 444 bool mWrapU;
nuclear@0 445
nuclear@0 446 /** Wrap V?
nuclear@0 447 */
nuclear@0 448 bool mWrapV;
nuclear@0 449
nuclear@0 450 /** Mirror U?
nuclear@0 451 */
nuclear@0 452 bool mMirrorU;
nuclear@0 453
nuclear@0 454 /** Mirror V?
nuclear@0 455 */
nuclear@0 456 bool mMirrorV;
nuclear@0 457
nuclear@0 458 /** Blend mode
nuclear@0 459 */
nuclear@0 460 aiTextureOp mOp;
nuclear@0 461
nuclear@0 462 /** UV transformation
nuclear@0 463 */
nuclear@0 464 aiUVTransform mTransform;
nuclear@0 465
nuclear@0 466 /** Name of source UV channel
nuclear@0 467 */
nuclear@0 468 std::string mUVChannel;
nuclear@0 469
nuclear@0 470 /** Resolved UV channel index or UINT_MAX if not known
nuclear@0 471 */
nuclear@0 472 unsigned int mUVId;
nuclear@0 473
nuclear@0 474 // OKINO/MAX3D extensions from here
nuclear@0 475 // -------------------------------------------------------
nuclear@0 476
nuclear@0 477 /** Weighting factor
nuclear@0 478 */
nuclear@0 479 float mWeighting;
nuclear@0 480
nuclear@0 481 /** Mixing factor from OKINO
nuclear@0 482 */
nuclear@0 483 float mMixWithPrevious;
nuclear@0 484 };
nuclear@0 485
nuclear@0 486 /** A collada effect. Can contain about anything according to the Collada spec,
nuclear@0 487 but we limit our version to a reasonable subset. */
nuclear@0 488 struct Effect
nuclear@0 489 {
nuclear@0 490 // Shading mode
nuclear@0 491 ShadeType mShadeType;
nuclear@0 492
nuclear@0 493 // Colors
nuclear@0 494 aiColor4D mEmissive, mAmbient, mDiffuse, mSpecular,
nuclear@0 495 mTransparent, mReflective;
nuclear@0 496
nuclear@0 497 // Textures
nuclear@0 498 Sampler mTexEmissive, mTexAmbient, mTexDiffuse, mTexSpecular,
nuclear@0 499 mTexTransparent, mTexBump, mTexReflective;
nuclear@0 500
nuclear@0 501 // Scalar factory
nuclear@0 502 float mShininess, mRefractIndex, mReflectivity;
nuclear@0 503 float mTransparency;
nuclear@0 504
nuclear@0 505 // local params referring to each other by their SID
nuclear@0 506 typedef std::map<std::string, Collada::EffectParam> ParamLibrary;
nuclear@0 507 ParamLibrary mParams;
nuclear@0 508
nuclear@0 509 // MAX3D extensions
nuclear@0 510 // ---------------------------------------------------------
nuclear@0 511 // Double-sided?
nuclear@0 512 bool mDoubleSided, mWireframe, mFaceted;
nuclear@0 513
nuclear@0 514 Effect()
nuclear@0 515 : mShadeType (Shade_Phong)
nuclear@0 516 , mEmissive ( 0, 0, 0, 1)
nuclear@0 517 , mAmbient ( 0.1f, 0.1f, 0.1f, 1)
nuclear@0 518 , mDiffuse ( 0.6f, 0.6f, 0.6f, 1)
nuclear@0 519 , mSpecular ( 0.4f, 0.4f, 0.4f, 1)
nuclear@0 520 , mTransparent ( 0, 0, 0, 1)
nuclear@0 521 , mShininess (10.0f)
nuclear@0 522 , mRefractIndex (1.f)
nuclear@0 523 , mReflectivity (1.f)
nuclear@0 524 , mTransparency (0.f)
nuclear@0 525 , mDoubleSided (false)
nuclear@0 526 , mWireframe (false)
nuclear@0 527 , mFaceted (false)
nuclear@0 528 {
nuclear@0 529 }
nuclear@0 530 };
nuclear@0 531
nuclear@0 532 /** An image, meaning texture */
nuclear@0 533 struct Image
nuclear@0 534 {
nuclear@0 535 std::string mFileName;
nuclear@0 536
nuclear@0 537 /** If image file name is zero, embedded image data
nuclear@0 538 */
nuclear@0 539 std::vector<uint8_t> mImageData;
nuclear@0 540
nuclear@0 541 /** If image file name is zero, file format of
nuclear@0 542 * embedded image data.
nuclear@0 543 */
nuclear@0 544 std::string mEmbeddedFormat;
nuclear@0 545
nuclear@0 546 };
nuclear@0 547
nuclear@0 548 /** An animation channel. */
nuclear@0 549 struct AnimationChannel
nuclear@0 550 {
nuclear@0 551 /** URL of the data to animate. Could be about anything, but we support only the
nuclear@0 552 * "NodeID/TransformID.SubElement" notation
nuclear@0 553 */
nuclear@0 554 std::string mTarget;
nuclear@0 555
nuclear@0 556 /** Source URL of the time values. Collada calls them "input". Meh. */
nuclear@0 557 std::string mSourceTimes;
nuclear@0 558 /** Source URL of the value values. Collada calls them "output". */
nuclear@0 559 std::string mSourceValues;
nuclear@0 560 };
nuclear@0 561
nuclear@0 562 /** An animation. Container for 0-x animation channels or 0-x animations */
nuclear@0 563 struct Animation
nuclear@0 564 {
nuclear@0 565 /** Anim name */
nuclear@0 566 std::string mName;
nuclear@0 567
nuclear@0 568 /** the animation channels, if any */
nuclear@0 569 std::vector<AnimationChannel> mChannels;
nuclear@0 570
nuclear@0 571 /** the sub-animations, if any */
nuclear@0 572 std::vector<Animation*> mSubAnims;
nuclear@0 573
nuclear@0 574 /** Destructor */
nuclear@0 575 ~Animation()
nuclear@0 576 {
nuclear@0 577 for( std::vector<Animation*>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it)
nuclear@0 578 delete *it;
nuclear@0 579 }
nuclear@0 580 };
nuclear@0 581
nuclear@0 582 /** Description of a collada animation channel which has been determined to affect the current node */
nuclear@0 583 struct ChannelEntry
nuclear@0 584 {
nuclear@0 585 const Collada::AnimationChannel* mChannel; ///> the source channel
nuclear@0 586 std::string mTransformId; // the ID of the transformation step of the node which is influenced
nuclear@0 587 size_t mTransformIndex; // Index into the node's transform chain to apply the channel to
nuclear@0 588 size_t mSubElement; // starting index inside the transform data
nuclear@0 589
nuclear@0 590 // resolved data references
nuclear@0 591 const Collada::Accessor* mTimeAccessor; ///> Collada accessor to the time values
nuclear@0 592 const Collada::Data* mTimeData; ///> Source data array for the time values
nuclear@0 593 const Collada::Accessor* mValueAccessor; ///> Collada accessor to the key value values
nuclear@0 594 const Collada::Data* mValueData; ///> Source datat array for the key value values
nuclear@0 595
nuclear@0 596 ChannelEntry() { mChannel = NULL; mSubElement = 0; }
nuclear@0 597 };
nuclear@0 598
nuclear@0 599 } // end of namespace Collada
nuclear@0 600 } // end of namespace Assimp
nuclear@0 601
nuclear@0 602 #endif // AI_COLLADAHELPER_H_INC