|
@@ -49,11 +49,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
#define AI_MESH_H_INC
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
-# pragma GCC system_header
|
|
|
+#pragma GCC system_header
|
|
|
#endif
|
|
|
|
|
|
-#include <assimp/types.h>
|
|
|
+#ifdef _WIN32
|
|
|
+#pragma warning(disable : 4351)
|
|
|
+#endif // _WIN32
|
|
|
+
|
|
|
#include <assimp/aabb.h>
|
|
|
+#include <assimp/types.h>
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
extern "C" {
|
|
@@ -69,42 +73,42 @@ extern "C" {
|
|
|
* Maximum number of indices per face (polygon). */
|
|
|
|
|
|
#ifndef AI_MAX_FACE_INDICES
|
|
|
-# define AI_MAX_FACE_INDICES 0x7fff
|
|
|
+#define AI_MAX_FACE_INDICES 0x7fff
|
|
|
#endif
|
|
|
|
|
|
/** @def AI_MAX_BONE_WEIGHTS
|
|
|
* Maximum number of indices per face (polygon). */
|
|
|
|
|
|
#ifndef AI_MAX_BONE_WEIGHTS
|
|
|
-# define AI_MAX_BONE_WEIGHTS 0x7fffffff
|
|
|
+#define AI_MAX_BONE_WEIGHTS 0x7fffffff
|
|
|
#endif
|
|
|
|
|
|
/** @def AI_MAX_VERTICES
|
|
|
* Maximum number of vertices per mesh. */
|
|
|
|
|
|
#ifndef AI_MAX_VERTICES
|
|
|
-# define AI_MAX_VERTICES 0x7fffffff
|
|
|
+#define AI_MAX_VERTICES 0x7fffffff
|
|
|
#endif
|
|
|
|
|
|
/** @def AI_MAX_FACES
|
|
|
* Maximum number of faces per mesh. */
|
|
|
|
|
|
#ifndef AI_MAX_FACES
|
|
|
-# define AI_MAX_FACES 0x7fffffff
|
|
|
+#define AI_MAX_FACES 0x7fffffff
|
|
|
#endif
|
|
|
|
|
|
/** @def AI_MAX_NUMBER_OF_COLOR_SETS
|
|
|
* Supported number of vertex color sets per mesh. */
|
|
|
|
|
|
#ifndef AI_MAX_NUMBER_OF_COLOR_SETS
|
|
|
-# define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
|
|
|
+#define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
|
|
|
#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS
|
|
|
|
|
|
/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS
|
|
|
* Supported number of texture coord sets (UV(W) channels) per mesh */
|
|
|
|
|
|
#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS
|
|
|
-# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8
|
|
|
+#define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8
|
|
|
#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
@@ -129,39 +133,36 @@ extern "C" {
|
|
|
* @note Take a look at the @link data Data Structures page @endlink for
|
|
|
* more information on the layout and winding order of a face.
|
|
|
*/
|
|
|
-struct aiFace
|
|
|
-{
|
|
|
+struct aiFace {
|
|
|
//! Number of indices defining this face.
|
|
|
//! The maximum value for this member is #AI_MAX_FACE_INDICES.
|
|
|
unsigned int mNumIndices;
|
|
|
|
|
|
//! Pointer to the indices array. Size of the array is given in numIndices.
|
|
|
- unsigned int* mIndices;
|
|
|
+ unsigned int *mIndices;
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
//! Default constructor
|
|
|
aiFace() AI_NO_EXCEPT
|
|
|
- : mNumIndices( 0 )
|
|
|
- , mIndices( nullptr ) {
|
|
|
+ : mNumIndices(0),
|
|
|
+ mIndices(nullptr) {
|
|
|
// empty
|
|
|
}
|
|
|
|
|
|
//! Default destructor. Delete the index array
|
|
|
- ~aiFace()
|
|
|
- {
|
|
|
- delete [] mIndices;
|
|
|
+ ~aiFace() {
|
|
|
+ delete[] mIndices;
|
|
|
}
|
|
|
|
|
|
//! Copy constructor. Copy the index array
|
|
|
- aiFace( const aiFace& o)
|
|
|
- : mNumIndices(0)
|
|
|
- , mIndices( nullptr ) {
|
|
|
+ aiFace(const aiFace &o) :
|
|
|
+ mNumIndices(0), mIndices(nullptr) {
|
|
|
*this = o;
|
|
|
}
|
|
|
|
|
|
//! Assignment operator. Copy the index array
|
|
|
- aiFace& operator = ( const aiFace& o) {
|
|
|
+ aiFace &operator=(const aiFace &o) {
|
|
|
if (&o == this) {
|
|
|
return *this;
|
|
|
}
|
|
@@ -170,7 +171,7 @@ struct aiFace
|
|
|
mNumIndices = o.mNumIndices;
|
|
|
if (mNumIndices) {
|
|
|
mIndices = new unsigned int[mNumIndices];
|
|
|
- ::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
|
|
|
+ ::memcpy(mIndices, o.mIndices, mNumIndices * sizeof(unsigned int));
|
|
|
} else {
|
|
|
mIndices = nullptr;
|
|
|
}
|
|
@@ -180,7 +181,7 @@ struct aiFace
|
|
|
|
|
|
//! Comparison operator. Checks whether the index array
|
|
|
//! of two faces is identical
|
|
|
- bool operator== (const aiFace& o) const {
|
|
|
+ bool operator==(const aiFace &o) const {
|
|
|
if (mIndices == o.mIndices) {
|
|
|
return true;
|
|
|
}
|
|
@@ -204,13 +205,12 @@ struct aiFace
|
|
|
|
|
|
//! Inverse comparison operator. Checks whether the index
|
|
|
//! array of two faces is NOT identical
|
|
|
- bool operator != (const aiFace& o) const {
|
|
|
+ bool operator!=(const aiFace &o) const {
|
|
|
return !(*this == o);
|
|
|
}
|
|
|
#endif // __cplusplus
|
|
|
}; // struct aiFace
|
|
|
|
|
|
-
|
|
|
// ---------------------------------------------------------------------------
|
|
|
/** @brief A single influence of a bone on a vertex.
|
|
|
*/
|
|
@@ -226,32 +226,30 @@ struct aiVertexWeight {
|
|
|
|
|
|
//! Default constructor
|
|
|
aiVertexWeight() AI_NO_EXCEPT
|
|
|
- : mVertexId(0)
|
|
|
- , mWeight(0.0f) {
|
|
|
+ : mVertexId(0),
|
|
|
+ mWeight(0.0f) {
|
|
|
// empty
|
|
|
}
|
|
|
|
|
|
//! Initialization from a given index and vertex weight factor
|
|
|
//! \param pID ID
|
|
|
//! \param pWeight Vertex weight factor
|
|
|
- aiVertexWeight( unsigned int pID, float pWeight )
|
|
|
- : mVertexId( pID )
|
|
|
- , mWeight( pWeight ) {
|
|
|
+ aiVertexWeight(unsigned int pID, float pWeight) :
|
|
|
+ mVertexId(pID), mWeight(pWeight) {
|
|
|
// empty
|
|
|
}
|
|
|
|
|
|
- bool operator == ( const aiVertexWeight &rhs ) const {
|
|
|
- return ( mVertexId == rhs.mVertexId && mWeight == rhs.mWeight );
|
|
|
+ bool operator==(const aiVertexWeight &rhs) const {
|
|
|
+ return (mVertexId == rhs.mVertexId && mWeight == rhs.mWeight);
|
|
|
}
|
|
|
|
|
|
- bool operator != ( const aiVertexWeight &rhs ) const {
|
|
|
- return ( *this == rhs );
|
|
|
+ bool operator!=(const aiVertexWeight &rhs) const {
|
|
|
+ return (*this == rhs);
|
|
|
}
|
|
|
|
|
|
#endif // __cplusplus
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// Forward declare aiNode (pointer use only)
|
|
|
struct aiNode;
|
|
|
|
|
@@ -274,15 +272,15 @@ struct aiBone {
|
|
|
#ifndef ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS
|
|
|
// The bone armature node - used for skeleton conversion
|
|
|
// you must enable aiProcess_PopulateArmatureData to populate this
|
|
|
- C_STRUCT aiNode* mArmature;
|
|
|
+ C_STRUCT aiNode *mArmature;
|
|
|
|
|
|
// The bone node in the scene - used for skeleton conversion
|
|
|
// you must enable aiProcess_PopulateArmatureData to populate this
|
|
|
- C_STRUCT aiNode* mNode;
|
|
|
+ C_STRUCT aiNode *mNode;
|
|
|
|
|
|
#endif
|
|
|
//! The influence weights of this bone, by vertex index.
|
|
|
- C_STRUCT aiVertexWeight* mWeights;
|
|
|
+ C_STRUCT aiVertexWeight *mWeights;
|
|
|
|
|
|
/** Matrix that transforms from bone space to mesh space in bind pose.
|
|
|
*
|
|
@@ -301,56 +299,51 @@ struct aiBone {
|
|
|
|
|
|
//! Default constructor
|
|
|
aiBone() AI_NO_EXCEPT
|
|
|
- : mName()
|
|
|
- , mNumWeights( 0 )
|
|
|
- , mWeights( nullptr )
|
|
|
- , mOffsetMatrix() {
|
|
|
+ : mName(),
|
|
|
+ mNumWeights(0),
|
|
|
+ mWeights(nullptr),
|
|
|
+ mOffsetMatrix() {
|
|
|
// empty
|
|
|
}
|
|
|
|
|
|
//! Copy constructor
|
|
|
- aiBone(const aiBone& other)
|
|
|
- : mName( other.mName )
|
|
|
- , mNumWeights( other.mNumWeights )
|
|
|
- , mWeights(nullptr)
|
|
|
- , mOffsetMatrix( other.mOffsetMatrix ) {
|
|
|
+ aiBone(const aiBone &other) :
|
|
|
+ mName(other.mName), mNumWeights(other.mNumWeights), mWeights(nullptr), mOffsetMatrix(other.mOffsetMatrix) {
|
|
|
if (other.mWeights && other.mNumWeights) {
|
|
|
mWeights = new aiVertexWeight[mNumWeights];
|
|
|
- ::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
|
|
|
+ ::memcpy(mWeights, other.mWeights, mNumWeights * sizeof(aiVertexWeight));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//! Assignment operator
|
|
|
- aiBone &operator=(const aiBone& other) {
|
|
|
+ aiBone &operator=(const aiBone &other) {
|
|
|
if (this == &other) {
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
- mName = other.mName;
|
|
|
- mNumWeights = other.mNumWeights;
|
|
|
+ mName = other.mName;
|
|
|
+ mNumWeights = other.mNumWeights;
|
|
|
mOffsetMatrix = other.mOffsetMatrix;
|
|
|
|
|
|
- if (other.mWeights && other.mNumWeights)
|
|
|
- {
|
|
|
+ if (other.mWeights && other.mNumWeights) {
|
|
|
if (mWeights) {
|
|
|
delete[] mWeights;
|
|
|
}
|
|
|
|
|
|
mWeights = new aiVertexWeight[mNumWeights];
|
|
|
- ::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
|
|
|
+ ::memcpy(mWeights, other.mWeights, mNumWeights * sizeof(aiVertexWeight));
|
|
|
}
|
|
|
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
- bool operator == ( const aiBone &rhs ) const {
|
|
|
- if ( mName != rhs.mName || mNumWeights != rhs.mNumWeights ) {
|
|
|
+ bool operator==(const aiBone &rhs) const {
|
|
|
+ if (mName != rhs.mName || mNumWeights != rhs.mNumWeights) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- for ( size_t i = 0; i < mNumWeights; ++i ) {
|
|
|
- if ( mWeights[ i ] != rhs.mWeights[ i ] ) {
|
|
|
+ for (size_t i = 0; i < mNumWeights; ++i) {
|
|
|
+ if (mWeights[i] != rhs.mWeights[i]) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -359,12 +352,11 @@ struct aiBone {
|
|
|
}
|
|
|
//! Destructor - deletes the array of vertex weights
|
|
|
~aiBone() {
|
|
|
- delete [] mWeights;
|
|
|
+ delete[] mWeights;
|
|
|
}
|
|
|
#endif // __cplusplus
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// ---------------------------------------------------------------------------
|
|
|
/** @brief Enumerates the types of geometric primitives supported by Assimp.
|
|
|
*
|
|
@@ -373,27 +365,26 @@ struct aiBone {
|
|
|
* @see aiProcess_Triangulate Automatic triangulation
|
|
|
* @see AI_CONFIG_PP_SBP_REMOVE Removal of specific primitive types.
|
|
|
*/
|
|
|
-enum aiPrimitiveType
|
|
|
-{
|
|
|
+enum aiPrimitiveType {
|
|
|
/** A point primitive.
|
|
|
*
|
|
|
* This is just a single vertex in the virtual world,
|
|
|
* #aiFace contains just one index for such a primitive.
|
|
|
*/
|
|
|
- aiPrimitiveType_POINT = 0x1,
|
|
|
+ aiPrimitiveType_POINT = 0x1,
|
|
|
|
|
|
/** A line primitive.
|
|
|
*
|
|
|
* This is a line defined through a start and an end position.
|
|
|
* #aiFace contains exactly two indices for such a primitive.
|
|
|
*/
|
|
|
- aiPrimitiveType_LINE = 0x2,
|
|
|
+ aiPrimitiveType_LINE = 0x2,
|
|
|
|
|
|
/** A triangular primitive.
|
|
|
*
|
|
|
* A triangle consists of three indices.
|
|
|
*/
|
|
|
- aiPrimitiveType_TRIANGLE = 0x4,
|
|
|
+ aiPrimitiveType_TRIANGLE = 0x4,
|
|
|
|
|
|
/** A higher-level polygon with more than 3 edges.
|
|
|
*
|
|
@@ -402,10 +393,9 @@ enum aiPrimitiveType
|
|
|
* is provided for your convenience, it splits all polygons in
|
|
|
* triangles (which are much easier to handle).
|
|
|
*/
|
|
|
- aiPrimitiveType_POLYGON = 0x8,
|
|
|
+ aiPrimitiveType_POLYGON = 0x8,
|
|
|
|
|
|
-
|
|
|
- /** This value is not used. It is just here to force the
|
|
|
+/** This value is not used. It is just here to force the
|
|
|
* compiler to map this enum to a 32 Bit integer.
|
|
|
*/
|
|
|
#ifndef SWIG
|
|
@@ -417,8 +407,6 @@ enum aiPrimitiveType
|
|
|
#define AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) \
|
|
|
((n) > 3 ? aiPrimitiveType_POLYGON : (aiPrimitiveType)(1u << ((n)-1)))
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// ---------------------------------------------------------------------------
|
|
|
/** @brief An AnimMesh is an attachment to an #aiMesh stores per-vertex
|
|
|
* animations for a particular frame.
|
|
@@ -430,8 +418,7 @@ enum aiPrimitiveType
|
|
|
* established by #aiMeshAnim, which references singular mesh attachments
|
|
|
* by their ID and binds them to a time offset.
|
|
|
*/
|
|
|
-struct aiAnimMesh
|
|
|
-{
|
|
|
+struct aiAnimMesh {
|
|
|
/**Anim Mesh name */
|
|
|
C_STRUCT aiString mName;
|
|
|
|
|
@@ -441,22 +428,22 @@ struct aiAnimMesh
|
|
|
* meshes may neither add or nor remove vertex components (if
|
|
|
* a replacement array is nullptr and the corresponding source
|
|
|
* array is not, the source data is taken instead)*/
|
|
|
- C_STRUCT aiVector3D* mVertices;
|
|
|
+ C_STRUCT aiVector3D *mVertices;
|
|
|
|
|
|
/** Replacement for aiMesh::mNormals. */
|
|
|
- C_STRUCT aiVector3D* mNormals;
|
|
|
+ C_STRUCT aiVector3D *mNormals;
|
|
|
|
|
|
/** Replacement for aiMesh::mTangents. */
|
|
|
- C_STRUCT aiVector3D* mTangents;
|
|
|
+ C_STRUCT aiVector3D *mTangents;
|
|
|
|
|
|
/** Replacement for aiMesh::mBitangents. */
|
|
|
- C_STRUCT aiVector3D* mBitangents;
|
|
|
+ C_STRUCT aiVector3D *mBitangents;
|
|
|
|
|
|
/** Replacement for aiMesh::mColors */
|
|
|
- C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
+ C_STRUCT aiColor4D *mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
|
|
|
/** Replacement for aiMesh::mTextureCoords */
|
|
|
- C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
+ C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
|
|
|
/** The number of vertices in the aiAnimMesh, and thus the length of all
|
|
|
* the member arrays.
|
|
@@ -467,7 +454,7 @@ struct aiAnimMesh
|
|
|
* from language bindings.
|
|
|
*/
|
|
|
unsigned int mNumVertices;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Weight of the AnimMesh.
|
|
|
*/
|
|
@@ -476,35 +463,33 @@ struct aiAnimMesh
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
aiAnimMesh() AI_NO_EXCEPT
|
|
|
- : mVertices( nullptr )
|
|
|
- , mNormals(nullptr)
|
|
|
- , mTangents(nullptr)
|
|
|
- , mBitangents(nullptr)
|
|
|
- , mColors()
|
|
|
- , mTextureCoords()
|
|
|
- , mNumVertices( 0 )
|
|
|
- , mWeight( 0.0f )
|
|
|
- {
|
|
|
+ : mVertices(nullptr),
|
|
|
+ mNormals(nullptr),
|
|
|
+ mTangents(nullptr),
|
|
|
+ mBitangents(nullptr),
|
|
|
+ mColors(),
|
|
|
+ mTextureCoords(),
|
|
|
+ mNumVertices(0),
|
|
|
+ mWeight(0.0f) {
|
|
|
// fixme consider moving this to the ctor initializer list as well
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++){
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
|
|
mTextureCoords[a] = nullptr;
|
|
|
}
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
mColors[a] = nullptr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ~aiAnimMesh()
|
|
|
- {
|
|
|
- delete [] mVertices;
|
|
|
- delete [] mNormals;
|
|
|
- delete [] mTangents;
|
|
|
- delete [] mBitangents;
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
|
|
- delete [] mTextureCoords[a];
|
|
|
+ ~aiAnimMesh() {
|
|
|
+ delete[] mVertices;
|
|
|
+ delete[] mNormals;
|
|
|
+ delete[] mTangents;
|
|
|
+ delete[] mBitangents;
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
|
|
+ delete[] mTextureCoords[a];
|
|
|
}
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
- delete [] mColors[a];
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
+ delete[] mColors[a];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -530,14 +515,14 @@ struct aiAnimMesh
|
|
|
/** Check whether the anim mesh overrides a particular
|
|
|
* set of vertex colors on his host mesh.
|
|
|
* @param pIndex 0<index<AI_MAX_NUMBER_OF_COLOR_SETS */
|
|
|
- bool HasVertexColors( unsigned int pIndex) const {
|
|
|
+ bool HasVertexColors(unsigned int pIndex) const {
|
|
|
return pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS ? false : mColors[pIndex] != nullptr;
|
|
|
}
|
|
|
|
|
|
/** Check whether the anim mesh overrides a particular
|
|
|
* set of texture coordinates on his host mesh.
|
|
|
* @param pIndex 0<index<AI_MAX_NUMBER_OF_TEXTURECOORDS */
|
|
|
- bool HasTextureCoords( unsigned int pIndex) const {
|
|
|
+ bool HasTextureCoords(unsigned int pIndex) const {
|
|
|
return pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? false : mTextureCoords[pIndex] != nullptr;
|
|
|
}
|
|
|
|
|
@@ -547,18 +532,17 @@ struct aiAnimMesh
|
|
|
// ---------------------------------------------------------------------------
|
|
|
/** @brief Enumerates the methods of mesh morphing supported by Assimp.
|
|
|
*/
|
|
|
-enum aiMorphingMethod
|
|
|
-{
|
|
|
+enum aiMorphingMethod {
|
|
|
/** Interpolation between morph targets */
|
|
|
- aiMorphingMethod_VERTEX_BLEND = 0x1,
|
|
|
+ aiMorphingMethod_VERTEX_BLEND = 0x1,
|
|
|
|
|
|
/** Normalized morphing between morph targets */
|
|
|
- aiMorphingMethod_MORPH_NORMALIZED = 0x2,
|
|
|
+ aiMorphingMethod_MORPH_NORMALIZED = 0x2,
|
|
|
|
|
|
/** Relative morphing between morph targets */
|
|
|
- aiMorphingMethod_MORPH_RELATIVE = 0x3,
|
|
|
+ aiMorphingMethod_MORPH_RELATIVE = 0x3,
|
|
|
|
|
|
- /** This value is not used. It is just here to force the
|
|
|
+/** This value is not used. It is just here to force the
|
|
|
* compiler to map this enum to a 32 Bit integer.
|
|
|
*/
|
|
|
#ifndef SWIG
|
|
@@ -585,8 +569,7 @@ enum aiMorphingMethod
|
|
|
* aiScene::mFlags
|
|
|
* @endcode
|
|
|
*/
|
|
|
-struct aiMesh
|
|
|
-{
|
|
|
+struct aiMesh {
|
|
|
/** Bitwise combination of the members of the #aiPrimitiveType enum.
|
|
|
* This specifies which types of primitives are present in the mesh.
|
|
|
* The "SortByPrimitiveType"-Step can be used to make sure the
|
|
@@ -610,7 +593,7 @@ struct aiMesh
|
|
|
* This array is always present in a mesh. The array is
|
|
|
* mNumVertices in size.
|
|
|
*/
|
|
|
- C_STRUCT aiVector3D* mVertices;
|
|
|
+ C_STRUCT aiVector3D *mVertices;
|
|
|
|
|
|
/** Vertex normals.
|
|
|
* The array contains normalized vectors, nullptr if not present.
|
|
@@ -632,7 +615,7 @@ struct aiMesh
|
|
|
* However, this needn't apply for normals that have been taken
|
|
|
* directly from the model file.
|
|
|
*/
|
|
|
- C_STRUCT aiVector3D* mNormals;
|
|
|
+ C_STRUCT aiVector3D *mNormals;
|
|
|
|
|
|
/** Vertex tangents.
|
|
|
* The tangent of a vertex points in the direction of the positive
|
|
@@ -646,7 +629,7 @@ struct aiMesh
|
|
|
* @note If the mesh contains tangents, it automatically also
|
|
|
* contains bitangents.
|
|
|
*/
|
|
|
- C_STRUCT aiVector3D* mTangents;
|
|
|
+ C_STRUCT aiVector3D *mTangents;
|
|
|
|
|
|
/** Vertex bitangents.
|
|
|
* The bitangent of a vertex points in the direction of the positive
|
|
@@ -655,20 +638,20 @@ struct aiMesh
|
|
|
* @note If the mesh contains tangents, it automatically also contains
|
|
|
* bitangents.
|
|
|
*/
|
|
|
- C_STRUCT aiVector3D* mBitangents;
|
|
|
+ C_STRUCT aiVector3D *mBitangents;
|
|
|
|
|
|
/** Vertex color sets.
|
|
|
* A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex
|
|
|
* colors per vertex. nullptr if not present. Each array is
|
|
|
* mNumVertices in size if present.
|
|
|
*/
|
|
|
- C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
+ C_STRUCT aiColor4D *mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
|
|
|
/** Vertex texture coords, also known as UV channels.
|
|
|
* A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per
|
|
|
* vertex. nullptr if not present. The array is mNumVertices in size.
|
|
|
*/
|
|
|
- C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
+ C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
|
|
|
/** Specifies the number of components for a given UV channel.
|
|
|
* Up to three channels are supported (UVW, for accessing volume
|
|
@@ -685,7 +668,7 @@ struct aiMesh
|
|
|
* in mNumFaces. If the #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT
|
|
|
* is NOT set each face references an unique set of vertices.
|
|
|
*/
|
|
|
- C_STRUCT aiFace* mFaces;
|
|
|
+ C_STRUCT aiFace *mFaces;
|
|
|
|
|
|
/** The number of bones this mesh contains.
|
|
|
* Can be 0, in which case the mBones array is nullptr.
|
|
@@ -696,7 +679,7 @@ struct aiMesh
|
|
|
* A bone consists of a name by which it can be found in the
|
|
|
* frame hierarchy and a set of vertex weights.
|
|
|
*/
|
|
|
- C_STRUCT aiBone** mBones;
|
|
|
+ C_STRUCT aiBone **mBones;
|
|
|
|
|
|
/** The material used by this mesh.
|
|
|
* A mesh uses only a single material. If an imported model uses
|
|
@@ -718,7 +701,6 @@ struct aiMesh
|
|
|
**/
|
|
|
C_STRUCT aiString mName;
|
|
|
|
|
|
-
|
|
|
/** The number of attachment meshes. Note! Currently only works with Collada loader. */
|
|
|
unsigned int mNumAnimMeshes;
|
|
|
|
|
@@ -726,7 +708,7 @@ struct aiMesh
|
|
|
* Attachment meshes carry replacement data for some of the
|
|
|
* mesh'es vertex components (usually positions, normals).
|
|
|
* Note! Currently only works with Collada loader.*/
|
|
|
- C_STRUCT aiAnimMesh** mAnimMeshes;
|
|
|
+ C_STRUCT aiAnimMesh **mAnimMeshes;
|
|
|
|
|
|
/**
|
|
|
* Method of morphing when animeshes are specified.
|
|
@@ -737,30 +719,30 @@ struct aiMesh
|
|
|
*
|
|
|
*/
|
|
|
C_STRUCT aiAABB mAABB;
|
|
|
-
|
|
|
+
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
//! Default constructor. Initializes all members to 0
|
|
|
aiMesh() AI_NO_EXCEPT
|
|
|
- : mPrimitiveTypes( 0 )
|
|
|
- , mNumVertices( 0 )
|
|
|
- , mNumFaces( 0 )
|
|
|
- , mVertices( nullptr )
|
|
|
- , mNormals(nullptr)
|
|
|
- , mTangents(nullptr)
|
|
|
- , mBitangents(nullptr)
|
|
|
- , mColors()
|
|
|
- , mTextureCoords()
|
|
|
- , mNumUVComponents()
|
|
|
- , mFaces(nullptr)
|
|
|
- , mNumBones( 0 )
|
|
|
- , mBones(nullptr)
|
|
|
- , mMaterialIndex( 0 )
|
|
|
- , mNumAnimMeshes( 0 )
|
|
|
- , mAnimMeshes(nullptr)
|
|
|
- , mMethod( 0 )
|
|
|
- , mAABB() {
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) {
|
|
|
+ : mPrimitiveTypes(0),
|
|
|
+ mNumVertices(0),
|
|
|
+ mNumFaces(0),
|
|
|
+ mVertices(nullptr),
|
|
|
+ mNormals(nullptr),
|
|
|
+ mTangents(nullptr),
|
|
|
+ mBitangents(nullptr),
|
|
|
+ mColors(),
|
|
|
+ mTextureCoords(),
|
|
|
+ mNumUVComponents(),
|
|
|
+ mFaces(nullptr),
|
|
|
+ mNumBones(0),
|
|
|
+ mBones(nullptr),
|
|
|
+ mMaterialIndex(0),
|
|
|
+ mNumAnimMeshes(0),
|
|
|
+ mAnimMeshes(nullptr),
|
|
|
+ mMethod(0),
|
|
|
+ mAABB() {
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
|
|
|
mNumUVComponents[a] = 0;
|
|
|
mTextureCoords[a] = nullptr;
|
|
|
}
|
|
@@ -772,62 +754,57 @@ struct aiMesh
|
|
|
|
|
|
//! Deletes all storage allocated for the mesh
|
|
|
~aiMesh() {
|
|
|
- delete [] mVertices;
|
|
|
- delete [] mNormals;
|
|
|
- delete [] mTangents;
|
|
|
- delete [] mBitangents;
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
|
|
- delete [] mTextureCoords[a];
|
|
|
+ delete[] mVertices;
|
|
|
+ delete[] mNormals;
|
|
|
+ delete[] mTangents;
|
|
|
+ delete[] mBitangents;
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
|
|
+ delete[] mTextureCoords[a];
|
|
|
}
|
|
|
- for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
- delete [] mColors[a];
|
|
|
+ for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
+ delete[] mColors[a];
|
|
|
}
|
|
|
|
|
|
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
|
|
- if (mNumBones && mBones) {
|
|
|
- for( unsigned int a = 0; a < mNumBones; a++) {
|
|
|
- if(mBones[a])
|
|
|
- {
|
|
|
+ if (mNumBones && mBones) {
|
|
|
+ for (unsigned int a = 0; a < mNumBones; a++) {
|
|
|
+ if (mBones[a]) {
|
|
|
delete mBones[a];
|
|
|
}
|
|
|
}
|
|
|
- delete [] mBones;
|
|
|
+ delete[] mBones;
|
|
|
}
|
|
|
|
|
|
- if (mNumAnimMeshes && mAnimMeshes) {
|
|
|
- for( unsigned int a = 0; a < mNumAnimMeshes; a++) {
|
|
|
+ if (mNumAnimMeshes && mAnimMeshes) {
|
|
|
+ for (unsigned int a = 0; a < mNumAnimMeshes; a++) {
|
|
|
delete mAnimMeshes[a];
|
|
|
}
|
|
|
- delete [] mAnimMeshes;
|
|
|
+ delete[] mAnimMeshes;
|
|
|
}
|
|
|
|
|
|
- delete [] mFaces;
|
|
|
+ delete[] mFaces;
|
|
|
}
|
|
|
|
|
|
//! Check whether the mesh contains positions. Provided no special
|
|
|
//! scene flags are set, this will always be true
|
|
|
- bool HasPositions() const
|
|
|
- { return mVertices != nullptr && mNumVertices > 0; }
|
|
|
+ bool HasPositions() const { return mVertices != nullptr && mNumVertices > 0; }
|
|
|
|
|
|
//! Check whether the mesh contains faces. If no special scene flags
|
|
|
//! are set this should always return true
|
|
|
- bool HasFaces() const
|
|
|
- { return mFaces != nullptr && mNumFaces > 0; }
|
|
|
+ bool HasFaces() const { return mFaces != nullptr && mNumFaces > 0; }
|
|
|
|
|
|
//! Check whether the mesh contains normal vectors
|
|
|
- bool HasNormals() const
|
|
|
- { return mNormals != nullptr && mNumVertices > 0; }
|
|
|
+ bool HasNormals() const { return mNormals != nullptr && mNumVertices > 0; }
|
|
|
|
|
|
//! Check whether the mesh contains tangent and bitangent vectors
|
|
|
//! It is not possible that it contains tangents and no bitangents
|
|
|
//! (or the other way round). The existence of one of them
|
|
|
//! implies that the second is there, too.
|
|
|
- bool HasTangentsAndBitangents() const
|
|
|
- { return mTangents != nullptr && mBitangents != nullptr && mNumVertices > 0; }
|
|
|
+ bool HasTangentsAndBitangents() const { return mTangents != nullptr && mBitangents != nullptr && mNumVertices > 0; }
|
|
|
|
|
|
//! Check whether the mesh contains a vertex color set
|
|
|
//! \param pIndex Index of the vertex color set
|
|
|
- bool HasVertexColors( unsigned int pIndex) const {
|
|
|
+ bool HasVertexColors(unsigned int pIndex) const {
|
|
|
if (pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -837,7 +814,7 @@ struct aiMesh
|
|
|
|
|
|
//! Check whether the mesh contains a texture coordinate set
|
|
|
//! \param pIndex Index of the texture coordinates set
|
|
|
- bool HasTextureCoords( unsigned int pIndex) const {
|
|
|
+ bool HasTextureCoords(unsigned int pIndex) const {
|
|
|
if (pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -847,7 +824,7 @@ struct aiMesh
|
|
|
|
|
|
//! Get the number of UV channels the mesh contains
|
|
|
unsigned int GetNumUVChannels() const {
|
|
|
- unsigned int n( 0 );
|
|
|
+ unsigned int n(0);
|
|
|
while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n]) {
|
|
|
++n;
|
|
|
}
|
|
@@ -876,4 +853,3 @@ struct aiMesh
|
|
|
}
|
|
|
#endif //! extern "C"
|
|
|
#endif // AI_MESH_H_INC
|
|
|
-
|