From 1daae7b7b9e38a4383b5b93346342e07f5461176 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 5 May 2016 15:40:36 +0200 Subject: [PATCH 1/3] STEPFile.h: delete deleted copy ctor and move ctors. Class has a const member, so implicit creation is off anyway. Enables pre cpp11 compilation. --- code/STEPFile.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/STEPFile.h b/code/STEPFile.h index f97845dd8..252e75dbb 100644 --- a/code/STEPFile.h +++ b/code/STEPFile.h @@ -596,11 +596,6 @@ namespace STEP { LazyObject(DB& db, uint64_t id, uint64_t line, const char* type,const char* args); ~LazyObject(); - LazyObject( LazyObject const& ) = delete; - LazyObject operator=( LazyObject const& ) = delete; - LazyObject( LazyObject && ) = delete; - LazyObject operator=( LazyObject && ) = delete; - public: Object& operator * () { From 167bc579c54aa6e6360efe928bff1fb20db62a85 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 5 May 2016 15:41:12 +0200 Subject: [PATCH 2/3] Fix MSVC11 compile error in AssxmlExporter.cpp -- vsnprintf is not in std. --- code/AssxmlExporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssxmlExporter.cpp b/code/AssxmlExporter.cpp index 9e8037649..765a8f88b 100644 --- a/code/AssxmlExporter.cpp +++ b/code/AssxmlExporter.cpp @@ -77,7 +77,7 @@ static int ioprintf( IOStream * io, const char *format, ... ) { ::memset( sz, '\0', Size ); va_list va; va_start( va, format ); - int nSize = std::vsnprintf( sz, Size-1, format, va ); + int nSize = vsnprintf( sz, Size-1, format, va ); ai_assert( nSize < Size ); va_end( va ); From 896120b76a02b351fa087bf481d2550fb572f2e2 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 5 May 2016 15:41:50 +0200 Subject: [PATCH 3/3] Assimp mostly uses unsigned int where it perhaps should've used size_t, nonetheless SPBC insisted on size_t, causing lots of noisy compile warnings. --- code/SplitByBoneCountProcess.cpp | 96 ++++++++++++++++---------------- code/SplitByBoneCountProcess.h | 2 +- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/code/SplitByBoneCountProcess.cpp b/code/SplitByBoneCountProcess.cpp index 0e913932c..cbc60beec 100644 --- a/code/SplitByBoneCountProcess.cpp +++ b/code/SplitByBoneCountProcess.cpp @@ -90,7 +90,7 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene) // early out bool isNecessary = false; - for( size_t a = 0; a < pScene->mNumMeshes; ++a) + for( unsigned int a = 0; a < pScene->mNumMeshes; ++a) if( pScene->mMeshes[a]->mNumBones > mMaxBoneCount ) isNecessary = true; @@ -107,7 +107,7 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene) // build a new array of meshes for the scene std::vector meshes; - for( size_t a = 0; a < pScene->mNumMeshes; ++a) + for( unsigned int a = 0; a < pScene->mNumMeshes; ++a) { aiMesh* srcMesh = pScene->mMeshes[a]; @@ -118,9 +118,9 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene) if( !newMeshes.empty() ) { // store new meshes and indices of the new meshes - for( size_t b = 0; b < newMeshes.size(); ++b) + for( unsigned int b = 0; b < newMeshes.size(); ++b) { - mSubMeshIndices[a].push_back( meshes.size()); + mSubMeshIndices[a].push_back( static_cast(meshes.size())); meshes.push_back( newMeshes[b]); } @@ -130,13 +130,13 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene) else { // Mesh is kept unchanged - store it's new place in the mesh array - mSubMeshIndices[a].push_back( meshes.size()); + mSubMeshIndices[a].push_back( static_cast(meshes.size())); meshes.push_back( srcMesh); } } // rebuild the scene's mesh array - pScene->mNumMeshes = meshes.size(); + pScene->mNumMeshes = static_cast(meshes.size()); delete [] pScene->mMeshes; pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; std::copy( meshes.begin(), meshes.end(), pScene->mMeshes); @@ -157,33 +157,33 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector BoneWeight; + typedef std::pair BoneWeight; std::vector< std::vector > vertexBones( pMesh->mNumVertices); - for( size_t a = 0; a < pMesh->mNumBones; ++a) + for( unsigned int a = 0; a < pMesh->mNumBones; ++a) { const aiBone* bone = pMesh->mBones[a]; - for( size_t b = 0; b < bone->mNumWeights; ++b) + for( unsigned int b = 0; b < bone->mNumWeights; ++b) vertexBones[ bone->mWeights[b].mVertexId ].push_back( BoneWeight( a, bone->mWeights[b].mWeight)); } - size_t numFacesHandled = 0; + unsigned int numFacesHandled = 0; std::vector isFaceHandled( pMesh->mNumFaces, false); while( numFacesHandled < pMesh->mNumFaces ) { // which bones are used in the current submesh - size_t numBones = 0; + unsigned int numBones = 0; std::vector isBoneUsed( pMesh->mNumBones, false); // indices of the faces which are going to go into this submesh - std::vector subMeshFaces; + std::vector subMeshFaces; subMeshFaces.reserve( pMesh->mNumFaces); // accumulated vertex count of all the faces in this submesh - size_t numSubMeshVertices = 0; + unsigned int numSubMeshVertices = 0; // a small local array of new bones for the current face. State of all used bones for that face // can only be updated AFTER the face is completely analysed. Thanks to imre for the fix. - std::vector newBonesAtCurrentFace; + std::vector newBonesAtCurrentFace; // add faces to the new submesh as long as all bones affecting the faces' vertices fit in the limit - for( size_t a = 0; a < pMesh->mNumFaces; ++a) + for( unsigned int a = 0; a < pMesh->mNumFaces; ++a) { // skip if the face is already stored in a submesh if( isFaceHandled[a] ) @@ -191,12 +191,12 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormFaces[a]; // check every vertex if its bones would still fit into the current submesh - for( size_t b = 0; b < face.mNumIndices; ++b ) + for( unsigned int b = 0; b < face.mNumIndices; ++b ) { const std::vector& vb = vertexBones[face.mIndices[b]]; - for( size_t c = 0; c < vb.size(); ++c) + for( unsigned int c = 0; c < vb.size(); ++c) { - size_t boneIndex = vb[c].first; + unsigned int boneIndex = vb[c].first; // if the bone is already used in this submesh, it's ok if( isBoneUsed[boneIndex] ) continue; @@ -214,7 +214,7 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormNumVertices = numSubMeshVertices; - newMesh->mNumFaces = subMeshFaces.size(); + newMesh->mNumFaces = static_cast(subMeshFaces.size()); newMesh->mVertices = new aiVector3D[newMesh->mNumVertices]; if( pMesh->HasNormals() ) newMesh->mNormals = new aiVector3D[newMesh->mNumVertices]; @@ -251,13 +251,13 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormTangents = new aiVector3D[newMesh->mNumVertices]; newMesh->mBitangents = new aiVector3D[newMesh->mNumVertices]; } - for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) + for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) { if( pMesh->HasTextureCoords( a) ) newMesh->mTextureCoords[a] = new aiVector3D[newMesh->mNumVertices]; newMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a]; } - for( size_t a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a ) + for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a ) { if( pMesh->HasVertexColors( a) ) newMesh->mColors[a] = new aiColor4D[newMesh->mNumVertices]; @@ -265,9 +265,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormFaces = new aiFace[subMeshFaces.size()]; - size_t nvi = 0; // next vertex index - std::vector previousVertexIndices( numSubMeshVertices, std::numeric_limits::max()); // per new vertex: its index in the source mesh - for( size_t a = 0; a < subMeshFaces.size(); ++a ) + unsigned int nvi = 0; // next vertex index + std::vector previousVertexIndices( numSubMeshVertices, std::numeric_limits::max()); // per new vertex: its index in the source mesh + for( unsigned int a = 0; a < subMeshFaces.size(); ++a ) { const aiFace& srcFace = pMesh->mFaces[subMeshFaces[a]]; aiFace& dstFace = newMesh->mFaces[a]; @@ -275,9 +275,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormTangents[nvi] = pMesh->mTangents[srcIndex]; newMesh->mBitangents[nvi] = pMesh->mBitangents[srcIndex]; } - for( size_t c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c ) + for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c ) { if( pMesh->HasTextureCoords( c) ) newMesh->mTextureCoords[c][nvi] = pMesh->mTextureCoords[c][srcIndex]; } - for( size_t c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c ) + for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c ) { if( pMesh->HasVertexColors( c) ) newMesh->mColors[c][nvi] = pMesh->mColors[c][srcIndex]; @@ -310,8 +310,8 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormNumBones = 0; newMesh->mBones = new aiBone*[numBones]; - std::vector mappedBoneIndex( pMesh->mNumBones, std::numeric_limits::max()); - for( size_t a = 0; a < pMesh->mNumBones; ++a ) + std::vector mappedBoneIndex( pMesh->mNumBones, std::numeric_limits::max()); + for( unsigned int a = 0; a < pMesh->mNumBones; ++a ) { if( !isBoneUsed[a] ) continue; @@ -329,21 +329,21 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vectormNumBones == numBones ); // iterate over all new vertices and count which bones affected its old vertex in the source mesh - for( size_t a = 0; a < numSubMeshVertices; ++a ) + for( unsigned int a = 0; a < numSubMeshVertices; ++a ) { - size_t oldIndex = previousVertexIndices[a]; + unsigned int oldIndex = previousVertexIndices[a]; const std::vector& bonesOnThisVertex = vertexBones[oldIndex]; - for( size_t b = 0; b < bonesOnThisVertex.size(); ++b ) + for( unsigned int b = 0; b < bonesOnThisVertex.size(); ++b ) { - size_t newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ]; - if( newBoneIndex != std::numeric_limits::max() ) + unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ]; + if( newBoneIndex != std::numeric_limits::max() ) newMesh->mBones[newBoneIndex]->mNumWeights++; } } // allocate all bone weight arrays accordingly - for( size_t a = 0; a < newMesh->mNumBones; ++a ) + for( unsigned int a = 0; a < newMesh->mNumBones; ++a ) { aiBone* bone = newMesh->mBones[a]; ai_assert( bone->mNumWeights > 0 ); @@ -352,18 +352,18 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector& bonesOnThisVertex = vertexBones[previousIndex]; // all of the bones affecting it should be present in the new submesh, or else // the face it comprises shouldn't be present - for( size_t b = 0; b < bonesOnThisVertex.size(); ++b) + for( unsigned int b = 0; b < bonesOnThisVertex.size(); ++b) { - size_t newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ]; - ai_assert( newBoneIndex != std::numeric_limits::max() ); + unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ]; + ai_assert( newBoneIndex != std::numeric_limits::max() ); aiVertexWeight* dstWeight = newMesh->mBones[newBoneIndex]->mWeights + newMesh->mBones[newBoneIndex]->mNumWeights; newMesh->mBones[newBoneIndex]->mNumWeights++; @@ -383,22 +383,22 @@ void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const // rebuild the node's mesh index list if( pNode->mNumMeshes > 0 ) { - std::vector newMeshList; - for( size_t a = 0; a < pNode->mNumMeshes; ++a) + std::vector newMeshList; + for( unsigned int a = 0; a < pNode->mNumMeshes; ++a) { - size_t srcIndex = pNode->mMeshes[a]; - const std::vector& replaceMeshes = mSubMeshIndices[srcIndex]; + unsigned int srcIndex = pNode->mMeshes[a]; + const std::vector& replaceMeshes = mSubMeshIndices[srcIndex]; newMeshList.insert( newMeshList.end(), replaceMeshes.begin(), replaceMeshes.end()); } delete pNode->mMeshes; - pNode->mNumMeshes = newMeshList.size(); + pNode->mNumMeshes = static_cast(newMeshList.size()); pNode->mMeshes = new unsigned int[pNode->mNumMeshes]; std::copy( newMeshList.begin(), newMeshList.end(), pNode->mMeshes); } // do that also recursively for all children - for( size_t a = 0; a < pNode->mNumChildren; ++a ) + for( unsigned int a = 0; a < pNode->mNumChildren; ++a ) { UpdateNode( pNode->mChildren[a]); } diff --git a/code/SplitByBoneCountProcess.h b/code/SplitByBoneCountProcess.h index f4816952d..39f47d043 100644 --- a/code/SplitByBoneCountProcess.h +++ b/code/SplitByBoneCountProcess.h @@ -101,7 +101,7 @@ public: size_t mMaxBoneCount; /// Per mesh index: Array of indices of the new submeshes. - std::vector< std::vector > mSubMeshIndices; + std::vector< std::vector > mSubMeshIndices; }; } // end of namespace Assimp