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

@ -149,13 +149,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#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
#endif // _WIN32
#ifdef _MSC_VER
#pragma warning(disable : 4521 4512 4714 4127 4351 4510)
@ -226,7 +224,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#error Currently, Borland is unsupported. Feel free to port Assimp.
#endif
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
* without threading support. The library doesn't utilize
@ -298,7 +295,6 @@ static const ai_real ai_epsilon = (ai_real) 0.00001;
#define AI_BUILD_BIG_ENDIAN
#endif
/**
* To avoid running out of memory
* This can be adjusted for specific use cases

View File

@ -52,8 +52,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#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" {
@ -129,8 +133,7 @@ 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;
@ -142,21 +145,19 @@ struct aiFace
//! Default constructor
aiFace() AI_NO_EXCEPT
: mNumIndices( 0 )
, mIndices( nullptr ) {
: mNumIndices(0),
mIndices(nullptr) {
// empty
}
//! Default destructor. Delete the index array
~aiFace()
{
~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;
}
@ -210,7 +211,6 @@ struct aiFace
#endif // __cplusplus
}; // struct aiFace
// ---------------------------------------------------------------------------
/** @brief A single influence of a bone on a vertex.
*/
@ -226,17 +226,16 @@ 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
}
@ -251,7 +250,6 @@ struct aiVertexWeight {
#endif // __cplusplus
};
// Forward declare aiNode (pointer use only)
struct aiNode;
@ -301,26 +299,22 @@ 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));
}
}
//! Assignment operator
aiBone &operator=(const aiBone &other) {
if (this == &other) {
@ -331,8 +325,7 @@ struct aiBone {
mNumWeights = other.mNumWeights;
mOffsetMatrix = other.mOffsetMatrix;
if (other.mWeights && other.mNumWeights)
{
if (other.mWeights && other.mNumWeights) {
if (mWeights) {
delete[] mWeights;
}
@ -364,7 +357,6 @@ struct aiBone {
#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,7 +395,6 @@ enum aiPrimitiveType
*/
aiPrimitiveType_POLYGON = 0x8,
/** This value is not used. It is just here to force the
* compiler to map this enum to a 32 Bit integer.
*/
@ -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;
@ -476,15 +463,14 @@ 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++) {
mTextureCoords[a] = nullptr;
@ -494,8 +480,7 @@ struct aiAnimMesh
}
}
~aiAnimMesh()
{
~aiAnimMesh() {
delete[] mVertices;
delete[] mNormals;
delete[] mTangents;
@ -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,
@ -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
@ -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;
@ -742,24 +724,24 @@ 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() {
: 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;
@ -786,8 +768,7 @@ struct aiMesh
// DO NOT REMOVE THIS ADDITIONAL CHECK
if (mNumBones && mBones) {
for (unsigned int a = 0; a < mNumBones; a++) {
if(mBones[a])
{
if (mBones[a]) {
delete mBones[a];
}
}
@ -806,24 +787,20 @@ struct aiMesh
//! 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
@ -876,4 +853,3 @@ struct aiMesh
}
#endif //! extern "C"
#endif // AI_MESH_H_INC