ry to fix 2013-specific warnings in mesh.h

pull/3012/head
kimkulling 2020-03-19 15:10:46 +01:00
parent 4d917c97bd
commit 4de4c34fb2
4 changed files with 303 additions and 331 deletions

View File

@ -70,8 +70,8 @@ IncludeCategories:
- Regex: '^<.*' - Regex: '^<.*'
Priority: 3 Priority: 3
# IncludeIsMainRegex: '(Test)?$' # IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true IndentCaseLabels: false
IndentPPDirectives: AfterHash #IndentPPDirectives: AfterHash
IndentWidth: 4 IndentWidth: 4
# IndentWrappedFunctionNames: false # IndentWrappedFunctionNames: false
# JavaScriptQuotes: Leave # JavaScriptQuotes: Leave

View File

@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_DEFINES_H_INC #define AI_DEFINES_H_INC
#ifdef __GNUC__ #ifdef __GNUC__
# pragma GCC system_header #pragma GCC system_header
#endif #endif
#include <assimp/config.h> #include <assimp/config.h>
@ -76,21 +76,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifndef ASSIMP_BUILD_NO_COMPRESSED_X #ifndef ASSIMP_BUILD_NO_COMPRESSED_X
# define ASSIMP_BUILD_NEED_Z_INFLATE #define ASSIMP_BUILD_NEED_Z_INFLATE
#endif #endif
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
# define ASSIMP_BUILD_NEED_Z_INFLATE #define ASSIMP_BUILD_NEED_Z_INFLATE
#endif #endif
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
# define ASSIMP_BUILD_NEED_Z_INFLATE #define ASSIMP_BUILD_NEED_Z_INFLATE
# define ASSIMP_BUILD_NEED_UNZIP #define ASSIMP_BUILD_NEED_UNZIP
#endif #endif
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
# define ASSIMP_BUILD_NEED_Z_INFLATE #define ASSIMP_BUILD_NEED_Z_INFLATE
# define ASSIMP_BUILD_NEED_UNZIP #define ASSIMP_BUILD_NEED_UNZIP
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -129,73 +129,71 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef _WIN32 #ifdef _WIN32
# undef ASSIMP_API #undef ASSIMP_API
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */ /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
# ifdef ASSIMP_BUILD_DLL_EXPORT #ifdef ASSIMP_BUILD_DLL_EXPORT
# define ASSIMP_API __declspec(dllexport) #define ASSIMP_API __declspec(dllexport)
# define ASSIMP_API_WINONLY __declspec(dllexport) #define ASSIMP_API_WINONLY __declspec(dllexport)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
* an external DLL under Windows. Default is static linkage. */ * an external DLL under Windows. Default is static linkage. */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
# elif (defined ASSIMP_DLL) #elif (defined ASSIMP_DLL)
# define ASSIMP_API __declspec(dllimport) #define ASSIMP_API __declspec(dllimport)
# define ASSIMP_API_WINONLY __declspec(dllimport) #define ASSIMP_API_WINONLY __declspec(dllimport)
# else
# define ASSIMP_API
# define ASSIMP_API_WINONLY
# endif
#elif defined(SWIG)
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
#else #else
# define ASSIMP_API __attribute__ ((visibility("default"))) #define ASSIMP_API
# define ASSIMP_API_WINONLY #define ASSIMP_API_WINONLY
#endif #endif
#elif defined(SWIG)
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
#else
#define ASSIMP_API __attribute__((visibility("default")))
#define ASSIMP_API_WINONLY
#endif // _WIN32
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(disable : 4521 4512 4714 4127 4351 4510 ) #pragma warning(disable : 4521 4512 4714 4127 4351 4510)
# ifdef ASSIMP_BUILD_DLL_EXPORT #ifdef ASSIMP_BUILD_DLL_EXPORT
# pragma warning (disable : 4251) #pragma warning(disable : 4251)
# endif #endif
/* Force the compiler to inline a function, if possible /* Force the compiler to inline a function, if possible
*/ */
# define AI_FORCE_INLINE __forceinline #define AI_FORCE_INLINE __forceinline
/* Tells the compiler that a function never returns. Used in code analysis /* Tells the compiler that a function never returns. Used in code analysis
* to skip dead paths (e.g. after an assertion evaluated to false). */ * to skip dead paths (e.g. after an assertion evaluated to false). */
# define AI_WONT_RETURN __declspec(noreturn) #define AI_WONT_RETURN __declspec(noreturn)
#elif defined(SWIG) #elif defined(SWIG)
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */ /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
#else #else
# define AI_WONT_RETURN #define AI_WONT_RETURN
# define AI_FORCE_INLINE inline #define AI_FORCE_INLINE inline
#endif // (defined _MSC_VER) #endif // (defined _MSC_VER)
#ifdef __GNUC__ #ifdef __GNUC__
# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) #define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
#else #else
# define AI_WONT_RETURN_SUFFIX #define AI_WONT_RETURN_SUFFIX
#endif // (defined __clang__) #endif // (defined __clang__)
#ifdef __cplusplus #ifdef __cplusplus
/* No explicit 'struct' and 'enum' tags for C++, this keeps showing up /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
* in doxydocs. * in doxydocs.
*/ */
# define C_STRUCT #define C_STRUCT
# define C_ENUM #define C_ENUM
#else #else
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
* is defined by Doxygen's preprocessor. The corresponding * is defined by Doxygen's preprocessor. The corresponding
* entries in the DOXYFILE are: */ * entries in the DOXYFILE are: */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#if 0 #if 0
ENABLE_PREPROCESSING = YES ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES MACRO_EXPANSION = YES
@ -207,66 +205,65 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EXPAND_AS_DEFINED = C_STRUCT C_ENUM EXPAND_AS_DEFINED = C_STRUCT C_ENUM
SKIP_FUNCTION_MACROS = YES SKIP_FUNCTION_MACROS = YES
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* Doxygen gets confused if we use c-struct typedefs to avoid /* Doxygen gets confused if we use c-struct typedefs to avoid
* the explicit 'struct' notation. This trick here has the same * the explicit 'struct' notation. This trick here has the same
* effect as the TYPEDEF_HIDES_STRUCT option, but we don't need * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
* to typedef all structs/enums. */ * to typedef all structs/enums. */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
# if (defined ASSIMP_DOXYGEN_BUILD) #if (defined ASSIMP_DOXYGEN_BUILD)
# define C_STRUCT #define C_STRUCT
# define C_ENUM #define C_ENUM
# else #else
# define C_STRUCT struct #define C_STRUCT struct
# define C_ENUM enum #define C_ENUM enum
# endif #endif
#endif #endif
#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__)) #if (defined(__BORLANDC__) || defined(__BCPLUSPLUS__))
# error Currently, Borland is unsupported. Feel free to port Assimp. #error Currently, Borland is unsupported. Feel free to port Assimp.
#endif #endif
//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
/* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
* without threading support. The library doesn't utilize * without threading support. The library doesn't utilize
* threads then and is itself not threadsafe. */ * threads then and is itself not threadsafe. */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifndef ASSIMP_BUILD_SINGLETHREADED #ifndef ASSIMP_BUILD_SINGLETHREADED
# define ASSIMP_BUILD_SINGLETHREADED #define ASSIMP_BUILD_SINGLETHREADED
#endif #endif
#if defined(_DEBUG) || ! defined(NDEBUG) #if defined(_DEBUG) || !defined(NDEBUG)
# define ASSIMP_BUILD_DEBUG #define ASSIMP_BUILD_DEBUG
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_DOUBLE_PRECISION to compile assimp /* Define ASSIMP_DOUBLE_PRECISION to compile assimp
* with double precision support (64-bit). */ * with double precision support (64-bit). */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef ASSIMP_DOUBLE_PRECISION #ifdef ASSIMP_DOUBLE_PRECISION
typedef double ai_real; typedef double ai_real;
typedef signed long long int ai_int; typedef signed long long int ai_int;
typedef unsigned long long int ai_uint; typedef unsigned long long int ai_uint;
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION #ifndef ASSIMP_AI_REAL_TEXT_PRECISION
#define ASSIMP_AI_REAL_TEXT_PRECISION 16 #define ASSIMP_AI_REAL_TEXT_PRECISION 16
#endif // ASSIMP_AI_REAL_TEXT_PRECISION #endif // ASSIMP_AI_REAL_TEXT_PRECISION
#else // ASSIMP_DOUBLE_PRECISION #else // ASSIMP_DOUBLE_PRECISION
typedef float ai_real; typedef float ai_real;
typedef signed int ai_int; typedef signed int ai_int;
typedef unsigned int ai_uint; typedef unsigned int ai_uint;
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION #ifndef ASSIMP_AI_REAL_TEXT_PRECISION
#define ASSIMP_AI_REAL_TEXT_PRECISION 8 #define ASSIMP_AI_REAL_TEXT_PRECISION 8
#endif // ASSIMP_AI_REAL_TEXT_PRECISION #endif // ASSIMP_AI_REAL_TEXT_PRECISION
#endif // ASSIMP_DOUBLE_PRECISION #endif // ASSIMP_DOUBLE_PRECISION
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* Useful constants */ /* Useful constants */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/* This is PI. Hi PI. */ /* This is PI. Hi PI. */
#define AI_MATH_PI (3.141592653589793238462643383279 ) #define AI_MATH_PI (3.141592653589793238462643383279)
#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0) #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5) #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
@ -276,29 +273,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f) #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
/* Tiny macro to convert from radians to degrees and back */ /* Tiny macro to convert from radians to degrees and back */
#define AI_DEG_TO_RAD(x) ((x)*(ai_real)0.0174532925) #define AI_DEG_TO_RAD(x) ((x) * (ai_real)0.0174532925)
#define AI_RAD_TO_DEG(x) ((x)*(ai_real)57.2957795) #define AI_RAD_TO_DEG(x) ((x) * (ai_real)57.2957795)
/* Numerical limits */ /* Numerical limits */
static const ai_real ai_epsilon = (ai_real) 0.00001; static const ai_real ai_epsilon = (ai_real)0.00001;
/* Support for big-endian builds */ /* Support for big-endian builds */
#if defined(__BYTE_ORDER__) #if defined(__BYTE_ORDER__)
# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
# if !defined(__BIG_ENDIAN__) #if !defined(__BIG_ENDIAN__)
# define __BIG_ENDIAN__ #define __BIG_ENDIAN__
# endif #endif
# else /* little endian */ #else /* little endian */
# if defined (__BIG_ENDIAN__) #if defined(__BIG_ENDIAN__)
# undef __BIG_ENDIAN__ #undef __BIG_ENDIAN__
# endif #endif
# endif #endif
#endif #endif
#if defined(__BIG_ENDIAN__) #if defined(__BIG_ENDIAN__)
# define AI_BUILD_BIG_ENDIAN #define AI_BUILD_BIG_ENDIAN
#endif #endif
/** /**
* To avoid running out of memory * To avoid running out of memory
* This can be adjusted for specific use cases * This can be adjusted for specific use cases
@ -307,26 +303,26 @@ static const ai_real ai_epsilon = (ai_real) 0.00001;
#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type)) #define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
#ifndef _MSC_VER #ifndef _MSC_VER
# if __cplusplus >= 201103L // C++11 #if __cplusplus >= 201103L // C++11
# define AI_NO_EXCEPT noexcept #define AI_NO_EXCEPT noexcept
# else
# define AI_NO_EXCEPT
# endif
#else #else
# if (_MSC_VER >= 1915 ) #define AI_NO_EXCEPT
# define AI_NO_EXCEPT noexcept #endif
# else #else
# define AI_NO_EXCEPT #if (_MSC_VER >= 1915)
# endif #define AI_NO_EXCEPT noexcept
#else
#define AI_NO_EXCEPT
#endif
#endif // _MSC_VER #endif // _MSC_VER
/** /**
* Helper macro to set a pointer to NULL in debug builds * Helper macro to set a pointer to NULL in debug builds
*/ */
#if (defined ASSIMP_BUILD_DEBUG) #if (defined ASSIMP_BUILD_DEBUG)
# define AI_DEBUG_INVALIDATE_PTR(x) x = NULL; #define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
#else #else
# define AI_DEBUG_INVALIDATE_PTR(x) #define AI_DEBUG_INVALIDATE_PTR(x)
#endif #endif
#endif // !! AI_DEFINES_H_INC #endif // !! AI_DEFINES_H_INC

View File

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

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_TYPES_H_INC #define AI_TYPES_H_INC
#ifdef __GNUC__ #ifdef __GNUC__
# pragma GCC system_header #pragma GCC system_header
#endif #endif
// Some runtime headers // Some runtime headers
@ -58,24 +58,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/types.h> #include <sys/types.h>
// Our compile configuration // Our compile configuration
# include <assimp/defs.h> #include <assimp/defs.h>
// Some types moved to separate header due to size of operators // Some types moved to separate header due to size of operators
# include <assimp/color4.h> #include <assimp/color4.h>
# include <assimp/matrix3x3.h> #include <assimp/matrix3x3.h>
# include <assimp/matrix4x4.h> #include <assimp/matrix4x4.h>
# include <assimp/quaternion.h> #include <assimp/quaternion.h>
# include <assimp/vector2.h> #include <assimp/vector2.h>
# include <assimp/vector3.h> #include <assimp/vector3.h>
typedef int32_t ai_int32; typedef int32_t ai_int32;
typedef uint32_t ai_uint32; typedef uint32_t ai_uint32;
# ifdef __cplusplus #ifdef __cplusplus
# include <cstring> #include <cstring>
# include <new> // for std::nothrow_t #include <new> // for std::nothrow_t
# include <string> // for aiString::Set(const std::string&) #include <string> // for aiString::Set(const std::string&)
namespace Assimp { namespace Assimp {
//! @cond never //! @cond never
@ -93,7 +93,7 @@ namespace Intern {
* the application is determined to crash. * the application is determined to crash.
*/ */
// -------------------------------------------------------------------- // --------------------------------------------------------------------
# ifndef SWIG #ifndef SWIG
struct ASSIMP_API AllocateFromAssimpHeap { struct ASSIMP_API AllocateFromAssimpHeap {
// http://www.gotw.ca/publications/mill15.htm // http://www.gotw.ca/publications/mill15.htm
@ -108,26 +108,26 @@ struct ASSIMP_API AllocateFromAssimpHeap {
void operator delete[](void *data); void operator delete[](void *data);
}; // struct AllocateFromAssimpHeap }; // struct AllocateFromAssimpHeap
# endif #endif
} // namespace Intern } // namespace Intern
//! @endcond //! @endcond
} // namespace Assimp } // namespace Assimp
extern "C" { extern "C" {
# endif #endif
/** Maximum dimension for strings, ASSIMP strings are zero terminated. */ /** Maximum dimension for strings, ASSIMP strings are zero terminated. */
# ifdef __cplusplus #ifdef __cplusplus
static const size_t MAXLEN = 1024; static const size_t MAXLEN = 1024;
# else #else
# define MAXLEN 1024 #define MAXLEN 1024
# endif #endif
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
/** Represents a plane in a three-dimensional, euclidean space /** Represents a plane in a three-dimensional, euclidean space
*/ */
struct aiPlane { struct aiPlane {
# ifdef __cplusplus #ifdef __cplusplus
aiPlane() AI_NO_EXCEPT : a(0.f), b(0.f), c(0.f), d(0.f) {} aiPlane() AI_NO_EXCEPT : a(0.f), b(0.f), c(0.f), d(0.f) {}
aiPlane(ai_real _a, ai_real _b, ai_real _c, ai_real _d) : aiPlane(ai_real _a, ai_real _b, ai_real _c, ai_real _d) :
a(_a), b(_b), c(_c), d(_d) {} a(_a), b(_b), c(_c), d(_d) {}
@ -135,7 +135,7 @@ struct aiPlane {
aiPlane(const aiPlane &o) : aiPlane(const aiPlane &o) :
a(o.a), b(o.b), c(o.c), d(o.d) {} a(o.a), b(o.b), c(o.c), d(o.d) {}
# endif // !__cplusplus #endif // !__cplusplus
//! Plane equation //! Plane equation
ai_real a, b, c, d; ai_real a, b, c, d;
@ -145,7 +145,7 @@ struct aiPlane {
/** Represents a ray /** Represents a ray
*/ */
struct aiRay { struct aiRay {
# ifdef __cplusplus #ifdef __cplusplus
aiRay() AI_NO_EXCEPT {} aiRay() AI_NO_EXCEPT {}
aiRay(const aiVector3D &_pos, const aiVector3D &_dir) : aiRay(const aiVector3D &_pos, const aiVector3D &_dir) :
pos(_pos), dir(_dir) {} pos(_pos), dir(_dir) {}
@ -153,7 +153,7 @@ struct aiRay {
aiRay(const aiRay &o) : aiRay(const aiRay &o) :
pos(o.pos), dir(o.dir) {} pos(o.pos), dir(o.dir) {}
# endif // !__cplusplus #endif // !__cplusplus
//! Position and direction of the ray //! Position and direction of the ray
C_STRUCT aiVector3D pos, dir; C_STRUCT aiVector3D pos, dir;
@ -163,7 +163,7 @@ struct aiRay {
/** Represents a color in Red-Green-Blue space. /** Represents a color in Red-Green-Blue space.
*/ */
struct aiColor3D { struct aiColor3D {
# ifdef __cplusplus #ifdef __cplusplus
aiColor3D() AI_NO_EXCEPT : r(0.0f), g(0.0f), b(0.0f) {} aiColor3D() AI_NO_EXCEPT : r(0.0f), g(0.0f), b(0.0f) {}
aiColor3D(ai_real _r, ai_real _g, ai_real _b) : aiColor3D(ai_real _r, ai_real _g, ai_real _b) :
r(_r), g(_g), b(_b) {} r(_r), g(_g), b(_b) {}
@ -236,7 +236,7 @@ struct aiColor3D {
return std::fabs(r) < epsilon && std::fabs(g) < epsilon && std::fabs(b) < epsilon; return std::fabs(r) < epsilon && std::fabs(g) < epsilon && std::fabs(b) < epsilon;
} }
# endif // !__cplusplus #endif // !__cplusplus
//! Red, green and blue color values //! Red, green and blue color values
ai_real r, g, b; ai_real r, g, b;
@ -264,16 +264,16 @@ struct aiColor3D {
* the terminating zero). * the terminating zero).
*/ */
struct aiString { struct aiString {
# ifdef __cplusplus #ifdef __cplusplus
/** Default constructor, the string is set to have zero length */ /** Default constructor, the string is set to have zero length */
aiString() AI_NO_EXCEPT aiString() AI_NO_EXCEPT
: length(0) { : length(0) {
data[0] = '\0'; data[0] = '\0';
# ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
// Debug build: overwrite the string on its full length with ESC (27) // Debug build: overwrite the string on its full length with ESC (27)
memset(data + 1, 27, MAXLEN - 1); memset(data + 1, 27, MAXLEN - 1);
# endif #endif
} }
/** Copy constructor */ /** Copy constructor */
@ -368,10 +368,10 @@ struct aiString {
length = 0; length = 0;
data[0] = '\0'; data[0] = '\0';
# ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
// Debug build: overwrite the string on its full length with ESC (27) // Debug build: overwrite the string on its full length with ESC (27)
memset(data + 1, 27, MAXLEN - 1); memset(data + 1, 27, MAXLEN - 1);
# endif #endif
} }
/** Returns a pointer to the underlying zero-terminated array of characters */ /** Returns a pointer to the underlying zero-terminated array of characters */
@ -379,7 +379,7 @@ struct aiString {
return data; return data;
} }
# endif // !__cplusplus #endif // !__cplusplus
/** Binary length of the string excluding the terminal 0. This is NOT the /** Binary length of the string excluding the terminal 0. This is NOT the
* logical length of strings containing UTF-8 multi-byte sequences! It's * logical length of strings containing UTF-8 multi-byte sequences! It's
@ -415,9 +415,9 @@ typedef enum aiReturn {
} aiReturn; // !enum aiReturn } aiReturn; // !enum aiReturn
// just for backwards compatibility, don't use these constants anymore // just for backwards compatibility, don't use these constants anymore
# define AI_SUCCESS aiReturn_SUCCESS #define AI_SUCCESS aiReturn_SUCCESS
# define AI_FAILURE aiReturn_FAILURE #define AI_FAILURE aiReturn_FAILURE
# define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY #define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
/** Seek origins (for the virtual file system API). /** Seek origins (for the virtual file system API).
@ -469,10 +469,10 @@ enum aiDefaultLogStream {
}; // !enum aiDefaultLogStream }; // !enum aiDefaultLogStream
// just for backwards compatibility, don't use these constants anymore // just for backwards compatibility, don't use these constants anymore
# define DLS_FILE aiDefaultLogStream_FILE #define DLS_FILE aiDefaultLogStream_FILE
# define DLS_STDOUT aiDefaultLogStream_STDOUT #define DLS_STDOUT aiDefaultLogStream_STDOUT
# define DLS_STDERR aiDefaultLogStream_STDERR #define DLS_STDERR aiDefaultLogStream_STDERR
# define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER #define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
/** Stores the memory requirements for different components (e.g. meshes, materials, /** Stores the memory requirements for different components (e.g. meshes, materials,
@ -480,7 +480,7 @@ enum aiDefaultLogStream {
* @see Importer::GetMemoryRequirements() * @see Importer::GetMemoryRequirements()
*/ */
struct aiMemoryInfo { struct aiMemoryInfo {
# ifdef __cplusplus #ifdef __cplusplus
/** Default constructor */ /** Default constructor */
aiMemoryInfo() AI_NO_EXCEPT aiMemoryInfo() AI_NO_EXCEPT
@ -493,7 +493,7 @@ struct aiMemoryInfo {
lights(0), lights(0),
total(0) {} total(0) {}
# endif #endif
/** Storage allocated for texture data */ /** Storage allocated for texture data */
unsigned int textures; unsigned int textures;
@ -520,16 +520,16 @@ struct aiMemoryInfo {
unsigned int total; unsigned int total;
}; // !struct aiMemoryInfo }; // !struct aiMemoryInfo
# ifdef __cplusplus #ifdef __cplusplus
} }
# endif //! __cplusplus #endif //! __cplusplus
// Include implementation files // Include implementation files
# include "color4.inl" #include "color4.inl"
# include "matrix3x3.inl" #include "matrix3x3.inl"
# include "matrix4x4.inl" #include "matrix4x4.inl"
# include "quaternion.inl" #include "quaternion.inl"
# include "vector2.inl" #include "vector2.inl"
# include "vector3.inl" #include "vector3.inl"
#endif // AI_TYPES_H_INC #endif // AI_TYPES_H_INC