|
@@ -1,12 +1,9 @@
|
|
-/** Helper structures for the Collada loader */
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
Open Asset Import Library (assimp)
|
|
Open Asset Import Library (assimp)
|
|
----------------------------------------------------------------------
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
Copyright (c) 2006-2020, assimp team
|
|
Copyright (c) 2006-2020, assimp team
|
|
|
|
|
|
-
|
|
|
|
All rights reserved.
|
|
All rights reserved.
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
Redistribution and use of this software in source and binary forms,
|
|
@@ -42,12 +39,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
----------------------------------------------------------------------
|
|
----------------------------------------------------------------------
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+/** Helper structures for the Collada loader */
|
|
|
|
+
|
|
#ifndef AI_COLLADAHELPER_H_INC
|
|
#ifndef AI_COLLADAHELPER_H_INC
|
|
#define AI_COLLADAHELPER_H_INC
|
|
#define AI_COLLADAHELPER_H_INC
|
|
|
|
|
|
#include <assimp/light.h>
|
|
#include <assimp/light.h>
|
|
#include <assimp/material.h>
|
|
#include <assimp/material.h>
|
|
#include <assimp/mesh.h>
|
|
#include <assimp/mesh.h>
|
|
|
|
+
|
|
#include <stdint.h>
|
|
#include <stdint.h>
|
|
#include <map>
|
|
#include <map>
|
|
#include <set>
|
|
#include <set>
|
|
@@ -58,14 +58,14 @@ struct aiMaterial;
|
|
namespace Assimp {
|
|
namespace Assimp {
|
|
namespace Collada {
|
|
namespace Collada {
|
|
|
|
|
|
-/** Collada file versions which evolved during the years ... */
|
|
|
|
|
|
+/// Collada file versions which evolved during the years ...
|
|
enum FormatVersion {
|
|
enum FormatVersion {
|
|
FV_1_5_n,
|
|
FV_1_5_n,
|
|
FV_1_4_n,
|
|
FV_1_4_n,
|
|
FV_1_3_n
|
|
FV_1_3_n
|
|
};
|
|
};
|
|
|
|
|
|
-/** Transformation types that can be applied to a node */
|
|
|
|
|
|
+/// Transformation types that can be applied to a node
|
|
enum TransformType {
|
|
enum TransformType {
|
|
TF_LOOKAT,
|
|
TF_LOOKAT,
|
|
TF_ROTATE,
|
|
TF_ROTATE,
|
|
@@ -75,7 +75,7 @@ enum TransformType {
|
|
TF_MATRIX
|
|
TF_MATRIX
|
|
};
|
|
};
|
|
|
|
|
|
-/** Different types of input data to a vertex or face */
|
|
|
|
|
|
+/// Different types of input data to a vertex or face
|
|
enum InputType {
|
|
enum InputType {
|
|
IT_Invalid,
|
|
IT_Invalid,
|
|
IT_Vertex, // special type for per-index data referring to the <vertices> element carrying the per-vertex data.
|
|
IT_Vertex, // special type for per-index data referring to the <vertices> element carrying the per-vertex data.
|
|
@@ -87,38 +87,39 @@ enum InputType {
|
|
IT_Bitangent
|
|
IT_Bitangent
|
|
};
|
|
};
|
|
|
|
|
|
-/** Supported controller types */
|
|
|
|
|
|
+/// Supported controller types
|
|
enum ControllerType {
|
|
enum ControllerType {
|
|
Skin,
|
|
Skin,
|
|
Morph
|
|
Morph
|
|
};
|
|
};
|
|
|
|
|
|
-/** Supported morph methods */
|
|
|
|
|
|
+/// Supported morph methods
|
|
enum MorphMethod {
|
|
enum MorphMethod {
|
|
Normalized,
|
|
Normalized,
|
|
Relative
|
|
Relative
|
|
};
|
|
};
|
|
|
|
|
|
-/** Common metadata keys as <Collada, Assimp> */
|
|
|
|
-typedef std::pair<std::string, std::string> MetaKeyPair;
|
|
|
|
-typedef std::vector<MetaKeyPair> MetaKeyPairVector;
|
|
|
|
|
|
+/// Common metadata keys as <Collada, Assimp>
|
|
|
|
+using MetaKeyPair = std::pair<std::string, std::string>;
|
|
|
|
+using MetaKeyPairVector = std::vector<MetaKeyPair>;
|
|
|
|
|
|
-// Collada as lower_case (native)
|
|
|
|
|
|
+/// Collada as lower_case (native)
|
|
const MetaKeyPairVector &GetColladaAssimpMetaKeys();
|
|
const MetaKeyPairVector &GetColladaAssimpMetaKeys();
|
|
|
|
+
|
|
// Collada as CamelCase (used by Assimp for consistency)
|
|
// Collada as CamelCase (used by Assimp for consistency)
|
|
const MetaKeyPairVector &GetColladaAssimpMetaKeysCamelCase();
|
|
const MetaKeyPairVector &GetColladaAssimpMetaKeysCamelCase();
|
|
|
|
|
|
-/** Convert underscore_separated to CamelCase "authoring_tool" becomes "AuthoringTool" */
|
|
|
|
|
|
+/// Convert underscore_separated to CamelCase "authoring_tool" becomes "AuthoringTool"
|
|
void ToCamelCase(std::string &text);
|
|
void ToCamelCase(std::string &text);
|
|
|
|
|
|
-/** Contains all data for one of the different transformation types */
|
|
|
|
|
|
+/// Contains all data for one of the different transformation types
|
|
struct Transform {
|
|
struct Transform {
|
|
std::string mID; ///< SID of the transform step, by which anim channels address their target node
|
|
std::string mID; ///< SID of the transform step, by which anim channels address their target node
|
|
TransformType mType;
|
|
TransformType mType;
|
|
ai_real f[16]; ///< Interpretation of data depends on the type of the transformation
|
|
ai_real f[16]; ///< Interpretation of data depends on the type of the transformation
|
|
};
|
|
};
|
|
|
|
|
|
-/** A collada camera. */
|
|
|
|
|
|
+/// A collada camera.
|
|
struct Camera {
|
|
struct Camera {
|
|
Camera() :
|
|
Camera() :
|
|
mOrtho(false),
|
|
mOrtho(false),
|
|
@@ -128,22 +129,22 @@ struct Camera {
|
|
mZNear(0.1f),
|
|
mZNear(0.1f),
|
|
mZFar(1000.f) {}
|
|
mZFar(1000.f) {}
|
|
|
|
|
|
- // Name of camera
|
|
|
|
|
|
+ /// Name of camera
|
|
std::string mName;
|
|
std::string mName;
|
|
|
|
|
|
- // True if it is an orthografic camera
|
|
|
|
|
|
+ /// True if it is an orthographic camera
|
|
bool mOrtho;
|
|
bool mOrtho;
|
|
|
|
|
|
- //! Horizontal field of view in degrees
|
|
|
|
|
|
+ /// Horizontal field of view in degrees
|
|
ai_real mHorFov;
|
|
ai_real mHorFov;
|
|
|
|
|
|
- //! Vertical field of view in degrees
|
|
|
|
|
|
+ /// Vertical field of view in degrees
|
|
ai_real mVerFov;
|
|
ai_real mVerFov;
|
|
|
|
|
|
- //! Screen aspect
|
|
|
|
|
|
+ /// Screen aspect
|
|
ai_real mAspect;
|
|
ai_real mAspect;
|
|
|
|
|
|
- //! Near& far z
|
|
|
|
|
|
+ /// Near& far z
|
|
ai_real mZNear, mZFar;
|
|
ai_real mZNear, mZFar;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -162,27 +163,27 @@ struct Light {
|
|
mOuterAngle(ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET),
|
|
mOuterAngle(ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET),
|
|
mIntensity(1.f) {}
|
|
mIntensity(1.f) {}
|
|
|
|
|
|
- //! Type of the light source aiLightSourceType + ambient
|
|
|
|
|
|
+ /// Type of the light source aiLightSourceType + ambient
|
|
unsigned int mType;
|
|
unsigned int mType;
|
|
|
|
|
|
- //! Color of the light
|
|
|
|
|
|
+ /// Color of the light
|
|
aiColor3D mColor;
|
|
aiColor3D mColor;
|
|
|
|
|
|
- //! Light attenuation
|
|
|
|
|
|
+ /// Light attenuation
|
|
ai_real mAttConstant, mAttLinear, mAttQuadratic;
|
|
ai_real mAttConstant, mAttLinear, mAttQuadratic;
|
|
|
|
|
|
- //! Spot light falloff
|
|
|
|
|
|
+ /// Spot light falloff
|
|
ai_real mFalloffAngle;
|
|
ai_real mFalloffAngle;
|
|
ai_real mFalloffExponent;
|
|
ai_real mFalloffExponent;
|
|
|
|
|
|
// -----------------------------------------------------
|
|
// -----------------------------------------------------
|
|
// FCOLLADA extension from here
|
|
// FCOLLADA extension from here
|
|
|
|
|
|
- //! ... related stuff from maja and max extensions
|
|
|
|
|
|
+ /// ... related stuff from maja and max extensions
|
|
ai_real mPenumbraAngle;
|
|
ai_real mPenumbraAngle;
|
|
ai_real mOuterAngle;
|
|
ai_real mOuterAngle;
|
|
|
|
|
|
- //! Common light intensity
|
|
|
|
|
|
+ /// Common light intensity
|
|
ai_real mIntensity;
|
|
ai_real mIntensity;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -192,30 +193,29 @@ struct InputSemanticMapEntry {
|
|
mSet(0),
|
|
mSet(0),
|
|
mType(IT_Invalid) {}
|
|
mType(IT_Invalid) {}
|
|
|
|
|
|
- //! Index of set, optional
|
|
|
|
|
|
+ /// Index of set, optional
|
|
unsigned int mSet;
|
|
unsigned int mSet;
|
|
|
|
|
|
- //! Type of referenced vertex input
|
|
|
|
|
|
+ /// Type of referenced vertex input
|
|
InputType mType;
|
|
InputType mType;
|
|
};
|
|
};
|
|
|
|
|
|
-/** Table to map from effect to vertex input semantics */
|
|
|
|
|
|
+/// Table to map from effect to vertex input semantics
|
|
struct SemanticMappingTable {
|
|
struct SemanticMappingTable {
|
|
- //! Name of material
|
|
|
|
|
|
+ /// Name of material
|
|
std::string mMatName;
|
|
std::string mMatName;
|
|
|
|
|
|
- //! List of semantic map commands, grouped by effect semantic name
|
|
|
|
|
|
+ /// List of semantic map commands, grouped by effect semantic name
|
|
std::map<std::string, InputSemanticMapEntry> mMap;
|
|
std::map<std::string, InputSemanticMapEntry> mMap;
|
|
|
|
|
|
- //! For std::find
|
|
|
|
|
|
+ /// For std::find
|
|
bool operator==(const std::string &s) const {
|
|
bool operator==(const std::string &s) const {
|
|
return s == mMatName;
|
|
return s == mMatName;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/** A reference to a mesh inside a node, including materials assigned to the various subgroups.
|
|
|
|
- * The ID refers to either a mesh or a controller which specifies the mesh
|
|
|
|
- */
|
|
|
|
|
|
+/// A reference to a mesh inside a node, including materials assigned to the various subgroups.
|
|
|
|
+/// The ID refers to either a mesh or a controller which specifies the mesh
|
|
struct MeshInstance {
|
|
struct MeshInstance {
|
|
///< ID of the mesh or controller to be instanced
|
|
///< ID of the mesh or controller to be instanced
|
|
std::string mMeshOrController;
|
|
std::string mMeshOrController;
|
|
@@ -224,25 +224,25 @@ struct MeshInstance {
|
|
std::map<std::string, SemanticMappingTable> mMaterials;
|
|
std::map<std::string, SemanticMappingTable> mMaterials;
|
|
};
|
|
};
|
|
|
|
|
|
-/** A reference to a camera inside a node*/
|
|
|
|
|
|
+/// A reference to a camera inside a node
|
|
struct CameraInstance {
|
|
struct CameraInstance {
|
|
///< ID of the camera
|
|
///< ID of the camera
|
|
std::string mCamera;
|
|
std::string mCamera;
|
|
};
|
|
};
|
|
|
|
|
|
-/** A reference to a light inside a node*/
|
|
|
|
|
|
+/// A reference to a light inside a node
|
|
struct LightInstance {
|
|
struct LightInstance {
|
|
///< ID of the camera
|
|
///< ID of the camera
|
|
std::string mLight;
|
|
std::string mLight;
|
|
};
|
|
};
|
|
|
|
|
|
-/** A reference to a node inside a node*/
|
|
|
|
|
|
+/// A reference to a node inside a node
|
|
struct NodeInstance {
|
|
struct NodeInstance {
|
|
///< ID of the node
|
|
///< ID of the node
|
|
std::string mNode;
|
|
std::string mNode;
|
|
};
|
|
};
|
|
|
|
|
|
-/** A node in a scene hierarchy */
|
|
|
|
|
|
+/// A node in a scene hierarchy
|
|
struct Node {
|
|
struct Node {
|
|
std::string mName;
|
|
std::string mName;
|
|
std::string mID;
|
|
std::string mID;
|
|
@@ -250,52 +250,53 @@ struct Node {
|
|
Node *mParent;
|
|
Node *mParent;
|
|
std::vector<Node *> mChildren;
|
|
std::vector<Node *> mChildren;
|
|
|
|
|
|
- /** Operations in order to calculate the resulting transformation to parent. */
|
|
|
|
|
|
+ /// Operations in order to calculate the resulting transformation to parent.
|
|
std::vector<Transform> mTransforms;
|
|
std::vector<Transform> mTransforms;
|
|
|
|
|
|
- /** Meshes at this node */
|
|
|
|
|
|
+ /// Meshes at this node
|
|
std::vector<MeshInstance> mMeshes;
|
|
std::vector<MeshInstance> mMeshes;
|
|
|
|
|
|
- /** Lights at this node */
|
|
|
|
|
|
+ /// Lights at this node
|
|
std::vector<LightInstance> mLights;
|
|
std::vector<LightInstance> mLights;
|
|
|
|
|
|
- /** Cameras at this node */
|
|
|
|
|
|
+ /// Cameras at this node
|
|
std::vector<CameraInstance> mCameras;
|
|
std::vector<CameraInstance> mCameras;
|
|
|
|
|
|
- /** Node instances at this node */
|
|
|
|
|
|
+ /// Node instances at this node
|
|
std::vector<NodeInstance> mNodeInstances;
|
|
std::vector<NodeInstance> mNodeInstances;
|
|
|
|
|
|
- /** Root-nodes: Name of primary camera, if any */
|
|
|
|
|
|
+ /// Root-nodes: Name of primary camera, if any
|
|
std::string mPrimaryCamera;
|
|
std::string mPrimaryCamera;
|
|
|
|
|
|
- //! Constructor. Begin with a zero parent
|
|
|
|
|
|
+ /// Constructor. Begin with a zero parent
|
|
Node() :
|
|
Node() :
|
|
mParent(nullptr) {
|
|
mParent(nullptr) {
|
|
// empty
|
|
// empty
|
|
}
|
|
}
|
|
|
|
|
|
- //! Destructor: delete all children subsequently
|
|
|
|
|
|
+ /// Destructor: delete all children subsequently
|
|
~Node() {
|
|
~Node() {
|
|
- for (std::vector<Node *>::iterator it = mChildren.begin(); it != mChildren.end(); ++it)
|
|
|
|
|
|
+ for (std::vector<Node *>::iterator it = mChildren.begin(); it != mChildren.end(); ++it) {
|
|
delete *it;
|
|
delete *it;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/** Data source array: either floats or strings */
|
|
|
|
|
|
+/// Data source array: either floats or strings
|
|
struct Data {
|
|
struct Data {
|
|
bool mIsStringArray;
|
|
bool mIsStringArray;
|
|
std::vector<ai_real> mValues;
|
|
std::vector<ai_real> mValues;
|
|
std::vector<std::string> mStrings;
|
|
std::vector<std::string> mStrings;
|
|
};
|
|
};
|
|
|
|
|
|
-/** Accessor to a data array */
|
|
|
|
|
|
+/// Accessor to a data array
|
|
struct Accessor {
|
|
struct Accessor {
|
|
size_t mCount; // in number of objects
|
|
size_t mCount; // in number of objects
|
|
size_t mSize; // size of an object, in elements (floats or strings, mostly 1)
|
|
size_t mSize; // size of an object, in elements (floats or strings, mostly 1)
|
|
size_t mOffset; // in number of values
|
|
size_t mOffset; // in number of values
|
|
size_t mStride; // Stride in number of values
|
|
size_t mStride; // Stride in number of values
|
|
std::vector<std::string> mParams; // names of the data streams in the accessors. Empty string tells to ignore.
|
|
std::vector<std::string> mParams; // names of the data streams in the accessors. Empty string tells to ignore.
|
|
- size_t mSubOffset[4]; // Suboffset inside the object for the common 4 elements. For a vector, that's XYZ, for a color RGBA and so on.
|
|
|
|
|
|
+ size_t mSubOffset[4]; // Sub-offset inside the object for the common 4 elements. For a vector, that's XYZ, for a color RGBA and so on.
|
|
// For example, SubOffset[0] denotes which of the values inside the object is the vector X component.
|
|
// For example, SubOffset[0] denotes which of the values inside the object is the vector X component.
|
|
std::string mSource; // URL of the source array
|
|
std::string mSource; // URL of the source array
|
|
mutable const Data *mData; // Pointer to the source array, if resolved. nullptr else
|
|
mutable const Data *mData; // Pointer to the source array, if resolved. nullptr else
|
|
@@ -310,12 +311,12 @@ struct Accessor {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/** A single face in a mesh */
|
|
|
|
|
|
+/// A single face in a mesh
|
|
struct Face {
|
|
struct Face {
|
|
std::vector<size_t> mIndices;
|
|
std::vector<size_t> mIndices;
|
|
};
|
|
};
|
|
|
|
|
|
-/** An input channel for mesh data, referring to a single accessor */
|
|
|
|
|
|
+/// An input channel for mesh data, referring to a single accessor
|
|
struct InputChannel {
|
|
struct InputChannel {
|
|
InputType mType; // Type of the data
|
|
InputType mType; // Type of the data
|
|
size_t mIndex; // Optional index, if multiple sets of the same data type are given
|
|
size_t mIndex; // Optional index, if multiple sets of the same data type are given
|
|
@@ -331,18 +332,19 @@ struct InputChannel {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/** Subset of a mesh with a certain material */
|
|
|
|
|
|
+/// Subset of a mesh with a certain material
|
|
struct SubMesh {
|
|
struct SubMesh {
|
|
std::string mMaterial; ///< subgroup identifier
|
|
std::string mMaterial; ///< subgroup identifier
|
|
- size_t mNumFaces; ///< number of faces in this submesh
|
|
|
|
|
|
+ size_t mNumFaces; ///< number of faces in this sub-mesh
|
|
};
|
|
};
|
|
|
|
|
|
-/** Contains data for a single mesh */
|
|
|
|
|
|
+/// Contains data for a single mesh
|
|
struct Mesh {
|
|
struct Mesh {
|
|
Mesh(const std::string &id) :
|
|
Mesh(const std::string &id) :
|
|
mId(id) {
|
|
mId(id) {
|
|
- for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i)
|
|
|
|
|
|
+ for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
|
mNumUVComponents[i] = 2;
|
|
mNumUVComponents[i] = 2;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const std::string mId;
|
|
const std::string mId;
|
|
@@ -373,11 +375,11 @@ struct Mesh {
|
|
// necessary for bone weight assignment
|
|
// necessary for bone weight assignment
|
|
std::vector<size_t> mFacePosIndices;
|
|
std::vector<size_t> mFacePosIndices;
|
|
|
|
|
|
- // Submeshes in this mesh, each with a given material
|
|
|
|
|
|
+ // Sub-meshes in this mesh, each with a given material
|
|
std::vector<SubMesh> mSubMeshes;
|
|
std::vector<SubMesh> mSubMeshes;
|
|
};
|
|
};
|
|
|
|
|
|
-/** Which type of primitives the ReadPrimitives() function is going to read */
|
|
|
|
|
|
+/// Which type of primitives the ReadPrimitives() function is going to read
|
|
enum PrimitiveType {
|
|
enum PrimitiveType {
|
|
Prim_Invalid,
|
|
Prim_Invalid,
|
|
Prim_Lines,
|
|
Prim_Lines,
|
|
@@ -389,7 +391,7 @@ enum PrimitiveType {
|
|
Prim_Polygon
|
|
Prim_Polygon
|
|
};
|
|
};
|
|
|
|
|
|
-/** A skeleton controller to deform a mesh with the use of joints */
|
|
|
|
|
|
+/// A skeleton controller to deform a mesh with the use of joints
|
|
struct Controller {
|
|
struct Controller {
|
|
// controller type
|
|
// controller type
|
|
ControllerType mType;
|
|
ControllerType mType;
|
|
@@ -424,25 +426,25 @@ struct Controller {
|
|
std::string mMorphWeight;
|
|
std::string mMorphWeight;
|
|
};
|
|
};
|
|
|
|
|
|
-/** A collada material. Pretty much the only member is a reference to an effect. */
|
|
|
|
|
|
+/// A collada material. Pretty much the only member is a reference to an effect.
|
|
struct Material {
|
|
struct Material {
|
|
std::string mName;
|
|
std::string mName;
|
|
std::string mEffect;
|
|
std::string mEffect;
|
|
};
|
|
};
|
|
|
|
|
|
-/** Type of the effect param */
|
|
|
|
|
|
+/// Type of the effect param
|
|
enum ParamType {
|
|
enum ParamType {
|
|
Param_Sampler,
|
|
Param_Sampler,
|
|
Param_Surface
|
|
Param_Surface
|
|
};
|
|
};
|
|
|
|
|
|
-/** A param for an effect. Might be of several types, but they all just refer to each other, so I summarize them */
|
|
|
|
|
|
+/// A param for an effect. Might be of several types, but they all just refer to each other, so I summarize them
|
|
struct EffectParam {
|
|
struct EffectParam {
|
|
ParamType mType;
|
|
ParamType mType;
|
|
std::string mReference; // to which other thing the param is referring to.
|
|
std::string mReference; // to which other thing the param is referring to.
|
|
};
|
|
};
|
|
|
|
|
|
-/** Shading type supported by the standard effect spec of Collada */
|
|
|
|
|
|
+/// Shading type supported by the standard effect spec of Collada
|
|
enum ShadeType {
|
|
enum ShadeType {
|
|
Shade_Invalid,
|
|
Shade_Invalid,
|
|
Shade_Constant,
|
|
Shade_Constant,
|
|
@@ -451,7 +453,7 @@ enum ShadeType {
|
|
Shade_Blinn
|
|
Shade_Blinn
|
|
};
|
|
};
|
|
|
|
|
|
-/** Represents a texture sampler in collada */
|
|
|
|
|
|
+/// Represents a texture sampler in collada
|
|
struct Sampler {
|
|
struct Sampler {
|
|
Sampler() :
|
|
Sampler() :
|
|
mWrapU(true),
|
|
mWrapU(true),
|
|
@@ -463,77 +465,66 @@ struct Sampler {
|
|
mWeighting(1.f),
|
|
mWeighting(1.f),
|
|
mMixWithPrevious(1.f) {}
|
|
mMixWithPrevious(1.f) {}
|
|
|
|
|
|
- /** Name of image reference
|
|
|
|
- */
|
|
|
|
|
|
+ /// Name of image reference
|
|
std::string mName;
|
|
std::string mName;
|
|
|
|
|
|
- /** Wrap U?
|
|
|
|
- */
|
|
|
|
|
|
+ /// Wrap U?
|
|
bool mWrapU;
|
|
bool mWrapU;
|
|
|
|
|
|
- /** Wrap V?
|
|
|
|
- */
|
|
|
|
|
|
+ /// Wrap V?
|
|
bool mWrapV;
|
|
bool mWrapV;
|
|
|
|
|
|
- /** Mirror U?
|
|
|
|
- */
|
|
|
|
|
|
+ /// Mirror U?
|
|
bool mMirrorU;
|
|
bool mMirrorU;
|
|
|
|
|
|
- /** Mirror V?
|
|
|
|
- */
|
|
|
|
|
|
+ /// Mirror V?
|
|
bool mMirrorV;
|
|
bool mMirrorV;
|
|
|
|
|
|
- /** Blend mode
|
|
|
|
- */
|
|
|
|
|
|
+ /// Blend mode
|
|
aiTextureOp mOp;
|
|
aiTextureOp mOp;
|
|
|
|
|
|
- /** UV transformation
|
|
|
|
- */
|
|
|
|
|
|
+ /// UV transformation
|
|
aiUVTransform mTransform;
|
|
aiUVTransform mTransform;
|
|
|
|
|
|
- /** Name of source UV channel
|
|
|
|
- */
|
|
|
|
|
|
+ /// Name of source UV channel
|
|
std::string mUVChannel;
|
|
std::string mUVChannel;
|
|
|
|
|
|
- /** Resolved UV channel index or UINT_MAX if not known
|
|
|
|
- */
|
|
|
|
|
|
+ /// Resolved UV channel index or UINT_MAX if not known
|
|
unsigned int mUVId;
|
|
unsigned int mUVId;
|
|
|
|
|
|
// OKINO/MAX3D extensions from here
|
|
// OKINO/MAX3D extensions from here
|
|
// -------------------------------------------------------
|
|
// -------------------------------------------------------
|
|
|
|
|
|
- /** Weighting factor
|
|
|
|
- */
|
|
|
|
|
|
+ /// Weighting factor
|
|
ai_real mWeighting;
|
|
ai_real mWeighting;
|
|
|
|
|
|
- /** Mixing factor from OKINO
|
|
|
|
- */
|
|
|
|
|
|
+ /// Mixing factor from OKINO
|
|
ai_real mMixWithPrevious;
|
|
ai_real mMixWithPrevious;
|
|
};
|
|
};
|
|
|
|
|
|
-/** A collada effect. Can contain about anything according to the Collada spec,
|
|
|
|
- but we limit our version to a reasonable subset. */
|
|
|
|
|
|
+/// A collada effect. Can contain about anything according to the Collada spec,
|
|
|
|
+/// but we limit our version to a reasonable subset.
|
|
struct Effect {
|
|
struct Effect {
|
|
- // Shading mode
|
|
|
|
|
|
+ /// Shading mode
|
|
ShadeType mShadeType;
|
|
ShadeType mShadeType;
|
|
|
|
|
|
- // Colors
|
|
|
|
|
|
+ /// Colors
|
|
aiColor4D mEmissive, mAmbient, mDiffuse, mSpecular,
|
|
aiColor4D mEmissive, mAmbient, mDiffuse, mSpecular,
|
|
mTransparent, mReflective;
|
|
mTransparent, mReflective;
|
|
|
|
|
|
- // Textures
|
|
|
|
|
|
+ /// Textures
|
|
Sampler mTexEmissive, mTexAmbient, mTexDiffuse, mTexSpecular,
|
|
Sampler mTexEmissive, mTexAmbient, mTexDiffuse, mTexSpecular,
|
|
mTexTransparent, mTexBump, mTexReflective;
|
|
mTexTransparent, mTexBump, mTexReflective;
|
|
|
|
|
|
- // Scalar factory
|
|
|
|
|
|
+ /// Scalar factory
|
|
ai_real mShininess, mRefractIndex, mReflectivity;
|
|
ai_real mShininess, mRefractIndex, mReflectivity;
|
|
ai_real mTransparency;
|
|
ai_real mTransparency;
|
|
bool mHasTransparency;
|
|
bool mHasTransparency;
|
|
bool mRGBTransparency;
|
|
bool mRGBTransparency;
|
|
bool mInvertTransparency;
|
|
bool mInvertTransparency;
|
|
|
|
|
|
- // local params referring to each other by their SID
|
|
|
|
- typedef std::map<std::string, Collada::EffectParam> ParamLibrary;
|
|
|
|
|
|
+ /// local params referring to each other by their SID
|
|
|
|
+ using ParamLibrary = std::map<std::string, Collada::EffectParam>;
|
|
ParamLibrary mParams;
|
|
ParamLibrary mParams;
|
|
|
|
|
|
// MAX3D extensions
|
|
// MAX3D extensions
|
|
@@ -561,65 +552,64 @@ struct Effect {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/** An image, meaning texture */
|
|
|
|
|
|
+/// An image, meaning texture
|
|
struct Image {
|
|
struct Image {
|
|
std::string mFileName;
|
|
std::string mFileName;
|
|
|
|
|
|
- /** Embedded image data */
|
|
|
|
|
|
+ /// Embedded image data
|
|
std::vector<uint8_t> mImageData;
|
|
std::vector<uint8_t> mImageData;
|
|
|
|
|
|
- /** File format hint of embedded image data */
|
|
|
|
|
|
+ /// File format hint of embedded image data
|
|
std::string mEmbeddedFormat;
|
|
std::string mEmbeddedFormat;
|
|
};
|
|
};
|
|
|
|
|
|
-/** An animation channel. */
|
|
|
|
|
|
+/// An animation channel.
|
|
struct AnimationChannel {
|
|
struct AnimationChannel {
|
|
- /** URL of the data to animate. Could be about anything, but we support only the
|
|
|
|
- * "NodeID/TransformID.SubElement" notation
|
|
|
|
- */
|
|
|
|
|
|
+ /// URL of the data to animate. Could be about anything, but we support only the
|
|
|
|
+ /// "NodeID/TransformID.SubElement" notation
|
|
std::string mTarget;
|
|
std::string mTarget;
|
|
|
|
|
|
- /** Source URL of the time values. Collada calls them "input". Meh. */
|
|
|
|
|
|
+ /// Source URL of the time values. Collada calls them "input". Meh.
|
|
std::string mSourceTimes;
|
|
std::string mSourceTimes;
|
|
- /** Source URL of the value values. Collada calls them "output". */
|
|
|
|
|
|
+ /// Source URL of the value values. Collada calls them "output".
|
|
std::string mSourceValues;
|
|
std::string mSourceValues;
|
|
- /** Source URL of the IN_TANGENT semantic values. */
|
|
|
|
|
|
+ /// Source URL of the IN_TANGENT semantic values.
|
|
std::string mInTanValues;
|
|
std::string mInTanValues;
|
|
- /** Source URL of the OUT_TANGENT semantic values. */
|
|
|
|
|
|
+ /// Source URL of the OUT_TANGENT semantic values.
|
|
std::string mOutTanValues;
|
|
std::string mOutTanValues;
|
|
- /** Source URL of the INTERPOLATION semantic values. */
|
|
|
|
|
|
+ /// Source URL of the INTERPOLATION semantic values.
|
|
std::string mInterpolationValues;
|
|
std::string mInterpolationValues;
|
|
};
|
|
};
|
|
|
|
|
|
-/** An animation. Container for 0-x animation channels or 0-x animations */
|
|
|
|
|
|
+/// An animation. Container for 0-x animation channels or 0-x animations
|
|
struct Animation {
|
|
struct Animation {
|
|
- /** Anim name */
|
|
|
|
|
|
+ /// Anim name
|
|
std::string mName;
|
|
std::string mName;
|
|
|
|
|
|
- /** the animation channels, if any */
|
|
|
|
|
|
+ /// the animation channels, if any
|
|
std::vector<AnimationChannel> mChannels;
|
|
std::vector<AnimationChannel> mChannels;
|
|
|
|
|
|
- /** the sub-animations, if any */
|
|
|
|
|
|
+ /// the sub-animations, if any
|
|
std::vector<Animation *> mSubAnims;
|
|
std::vector<Animation *> mSubAnims;
|
|
|
|
|
|
- /** Destructor */
|
|
|
|
|
|
+ /// Destructor
|
|
~Animation() {
|
|
~Animation() {
|
|
- for (std::vector<Animation *>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it)
|
|
|
|
|
|
+ for (std::vector<Animation *>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it) {
|
|
delete *it;
|
|
delete *it;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- /** Collect all channels in the animation hierarchy into a single channel list. */
|
|
|
|
|
|
+ /// Collect all channels in the animation hierarchy into a single channel list.
|
|
void CollectChannelsRecursively(std::vector<AnimationChannel> &channels) {
|
|
void CollectChannelsRecursively(std::vector<AnimationChannel> &channels) {
|
|
channels.insert(channels.end(), mChannels.begin(), mChannels.end());
|
|
channels.insert(channels.end(), mChannels.begin(), mChannels.end());
|
|
|
|
|
|
for (std::vector<Animation *>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it) {
|
|
for (std::vector<Animation *>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it) {
|
|
Animation *pAnim = (*it);
|
|
Animation *pAnim = (*it);
|
|
-
|
|
|
|
pAnim->CollectChannelsRecursively(channels);
|
|
pAnim->CollectChannelsRecursively(channels);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /** Combine all single-channel animations' channel into the same (parent) animation channel list. */
|
|
|
|
|
|
+ /// Combine all single-channel animations' channel into the same (parent) animation channel list.
|
|
void CombineSingleChannelAnimations() {
|
|
void CombineSingleChannelAnimations() {
|
|
CombineSingleChannelAnimationsRecursively(this);
|
|
CombineSingleChannelAnimationsRecursively(this);
|
|
}
|
|
}
|
|
@@ -658,9 +648,9 @@ struct Animation {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/** Description of a collada animation channel which has been determined to affect the current node */
|
|
|
|
|
|
+/// Description of a collada animation channel which has been determined to affect the current node
|
|
struct ChannelEntry {
|
|
struct ChannelEntry {
|
|
- const Collada::AnimationChannel *mChannel; ///> the source channel
|
|
|
|
|
|
+ const Collada::AnimationChannel *mChannel; ///< the source channel
|
|
std::string mTargetId;
|
|
std::string mTargetId;
|
|
std::string mTransformId; // the ID of the transformation step of the node which is influenced
|
|
std::string mTransformId; // the ID of the transformation step of the node which is influenced
|
|
size_t mTransformIndex; // Index into the node's transform chain to apply the channel to
|
|
size_t mTransformIndex; // Index into the node's transform chain to apply the channel to
|