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: '^<.*'
Priority: 3
# IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentCaseLabels: false
#IndentPPDirectives: AfterHash
IndentWidth: 4
# IndentWrappedFunctionNames: false
# 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
#ifdef __GNUC__
# pragma GCC system_header
#pragma GCC system_header
#endif
#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
# define ASSIMP_BUILD_NEED_Z_INFLATE
#define ASSIMP_BUILD_NEED_Z_INFLATE
#endif
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
# define ASSIMP_BUILD_NEED_Z_INFLATE
#define ASSIMP_BUILD_NEED_Z_INFLATE
#endif
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
# define ASSIMP_BUILD_NEED_Z_INFLATE
# define ASSIMP_BUILD_NEED_UNZIP
#define ASSIMP_BUILD_NEED_Z_INFLATE
#define ASSIMP_BUILD_NEED_UNZIP
#endif
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
# define ASSIMP_BUILD_NEED_Z_INFLATE
# define ASSIMP_BUILD_NEED_UNZIP
#define ASSIMP_BUILD_NEED_Z_INFLATE
#define ASSIMP_BUILD_NEED_UNZIP
#endif
//////////////////////////////////////////////////////////////////////////
@ -129,73 +129,71 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
# undef ASSIMP_API
//////////////////////////////////////////////////////////////////////////
/* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
//////////////////////////////////////////////////////////////////////////
# ifdef ASSIMP_BUILD_DLL_EXPORT
# define ASSIMP_API __declspec(dllexport)
# define ASSIMP_API_WINONLY __declspec(dllexport)
#undef ASSIMP_API
//////////////////////////////////////////////////////////////////////////
/* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
//////////////////////////////////////////////////////////////////////////
#ifdef ASSIMP_BUILD_DLL_EXPORT
#define ASSIMP_API __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. */
//////////////////////////////////////////////////////////////////////////
# elif (defined ASSIMP_DLL)
# define ASSIMP_API __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 */
//////////////////////////////////////////////////////////////////////////
#elif (defined ASSIMP_DLL)
#define ASSIMP_API __declspec(dllimport)
#define ASSIMP_API_WINONLY __declspec(dllimport)
#else
# define ASSIMP_API __attribute__ ((visibility("default")))
# define ASSIMP_API_WINONLY
#define ASSIMP_API
#define ASSIMP_API_WINONLY
#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
# pragma warning(disable : 4521 4512 4714 4127 4351 4510 )
# ifdef ASSIMP_BUILD_DLL_EXPORT
# pragma warning (disable : 4251)
# endif
/* Force the compiler to inline a function, if possible
#pragma warning(disable : 4521 4512 4714 4127 4351 4510)
#ifdef ASSIMP_BUILD_DLL_EXPORT
#pragma warning(disable : 4251)
#endif
/* 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). */
# define AI_WONT_RETURN __declspec(noreturn)
#define AI_WONT_RETURN __declspec(noreturn)
#elif defined(SWIG)
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
#else
# define AI_WONT_RETURN
# define AI_FORCE_INLINE inline
#define AI_WONT_RETURN
#define AI_FORCE_INLINE inline
#endif // (defined _MSC_VER)
#ifdef __GNUC__
# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
#define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
#else
# define AI_WONT_RETURN_SUFFIX
#define AI_WONT_RETURN_SUFFIX
#endif // (defined __clang__)
#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.
*/
# define C_STRUCT
# define C_ENUM
#define C_STRUCT
#define C_ENUM
#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
* entries in the DOXYFILE are: */
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
#if 0
ENABLE_PREPROCESSING = 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
SKIP_FUNCTION_MACROS = YES
#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
* effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
* to typedef all structs/enums. */
//////////////////////////////////////////////////////////////////////////
# if (defined ASSIMP_DOXYGEN_BUILD)
# define C_STRUCT
# define C_ENUM
# else
# define C_STRUCT struct
# define C_ENUM enum
# endif
//////////////////////////////////////////////////////////////////////////
#if (defined ASSIMP_DOXYGEN_BUILD)
#define C_STRUCT
#define C_ENUM
#else
#define C_STRUCT struct
#define C_ENUM enum
#endif
#endif
#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
# error Currently, Borland is unsupported. Feel free to port Assimp.
#if (defined(__BORLANDC__) || defined(__BCPLUSPLUS__))
#error Currently, Borland is unsupported. Feel free to port Assimp.
#endif
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
* without threading support. The library doesn't utilize
* threads then and is itself not threadsafe. */
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
#ifndef ASSIMP_BUILD_SINGLETHREADED
# define ASSIMP_BUILD_SINGLETHREADED
#define ASSIMP_BUILD_SINGLETHREADED
#endif
#if defined(_DEBUG) || ! defined(NDEBUG)
# define ASSIMP_BUILD_DEBUG
#if defined(_DEBUG) || !defined(NDEBUG)
#define ASSIMP_BUILD_DEBUG
#endif
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_DOUBLE_PRECISION to compile assimp
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_DOUBLE_PRECISION to compile assimp
* with double precision support (64-bit). */
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
#ifdef ASSIMP_DOUBLE_PRECISION
typedef double ai_real;
typedef signed long long int ai_int;
typedef unsigned long long int ai_uint;
typedef double ai_real;
typedef signed long long int ai_int;
typedef unsigned long long int ai_uint;
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
#define ASSIMP_AI_REAL_TEXT_PRECISION 16
#endif // ASSIMP_AI_REAL_TEXT_PRECISION
#else // ASSIMP_DOUBLE_PRECISION
typedef float ai_real;
typedef signed int ai_int;
typedef unsigned int ai_uint;
typedef float ai_real;
typedef signed int ai_int;
typedef unsigned int ai_uint;
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
#define ASSIMP_AI_REAL_TEXT_PRECISION 8
#endif // ASSIMP_AI_REAL_TEXT_PRECISION
#endif // ASSIMP_DOUBLE_PRECISION
//////////////////////////////////////////////////////////////////////////
/* Useful constants */
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/* Useful constants */
//////////////////////////////////////////////////////////////////////////
/* 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_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)
/* Tiny macro to convert from radians to degrees and back */
#define AI_DEG_TO_RAD(x) ((x)*(ai_real)0.0174532925)
#define AI_RAD_TO_DEG(x) ((x)*(ai_real)57.2957795)
#define AI_DEG_TO_RAD(x) ((x) * (ai_real)0.0174532925)
#define AI_RAD_TO_DEG(x) ((x) * (ai_real)57.2957795)
/* 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 */
#if defined(__BYTE_ORDER__)
# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
# if !defined(__BIG_ENDIAN__)
# define __BIG_ENDIAN__
# endif
# else /* little endian */
# if defined (__BIG_ENDIAN__)
# undef __BIG_ENDIAN__
# endif
# endif
#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#if !defined(__BIG_ENDIAN__)
#define __BIG_ENDIAN__
#endif
#else /* little endian */
#if defined(__BIG_ENDIAN__)
#undef __BIG_ENDIAN__
#endif
#endif
#endif
#if defined(__BIG_ENDIAN__)
# define AI_BUILD_BIG_ENDIAN
#define AI_BUILD_BIG_ENDIAN
#endif
/**
* To avoid running out of memory
* 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))
#ifndef _MSC_VER
# if __cplusplus >= 201103L // C++11
# define AI_NO_EXCEPT noexcept
# else
# define AI_NO_EXCEPT
# endif
#if __cplusplus >= 201103L // C++11
#define AI_NO_EXCEPT noexcept
#else
# if (_MSC_VER >= 1915 )
# define AI_NO_EXCEPT noexcept
# else
# define AI_NO_EXCEPT
# endif
#define AI_NO_EXCEPT
#endif
#else
#if (_MSC_VER >= 1915)
#define AI_NO_EXCEPT noexcept
#else
#define AI_NO_EXCEPT
#endif
#endif // _MSC_VER
/**
* Helper macro to set a pointer to NULL in debug builds
*/
#if (defined ASSIMP_BUILD_DEBUG)
# define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
#define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
#else
# define AI_DEBUG_INVALIDATE_PTR(x)
#define AI_DEBUG_INVALIDATE_PTR(x)
#endif
#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
#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,28 +299,24 @@ 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;
}
@ -331,26 +325,25 @@ struct aiBone {
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,8 +365,7 @@ 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,
@ -404,8 +395,7 @@ enum aiPrimitiveType
*/
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.
@ -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,8 +532,7 @@ struct aiAnimMesh
// ---------------------------------------------------------------------------
/** @brief Enumerates the methods of mesh morphing supported by Assimp.
*/
enum aiMorphingMethod
{
enum aiMorphingMethod {
/** Interpolation between morph targets */
aiMorphingMethod_VERTEX_BLEND = 0x1,
@ -558,7 +542,7 @@ enum aiMorphingMethod
/** Relative morphing between morph targets */
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.
@ -742,25 +724,25 @@ struct aiMesh
//! 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])
{
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++) {
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

View File

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