diff options
Diffstat (limited to 'src/3rdparty/assimp/code/PretransformVertices.cpp')
-rw-r--r-- | src/3rdparty/assimp/code/PretransformVertices.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/3rdparty/assimp/code/PretransformVertices.cpp b/src/3rdparty/assimp/code/PretransformVertices.cpp index 8158bdd6f..0751c4556 100644 --- a/src/3rdparty/assimp/code/PretransformVertices.cpp +++ b/src/3rdparty/assimp/code/PretransformVertices.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -46,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "PretransformVertices.h" #include "ProcessHelper.h" -#include "SceneCombiner.h" +#include <assimp/SceneCombiner.h> #include "Exceptional.h" using namespace Assimp; @@ -103,7 +104,7 @@ unsigned int PretransformVertices::CountNodes( aiNode* pcNode ) // ------------------------------------------------------------------------------------------------ // Get a bitwise combination identifying the vertex format of a mesh -unsigned int PretransformVertices::GetMeshVFormat(aiMesh* pcMesh) +unsigned int PretransformVertices::GetMeshVFormat( aiMesh* pcMesh ) { // the vertex format is stored in aiMesh::mBones for later retrieval. // there isn't a good reason to compute it a few hundred times @@ -159,6 +160,11 @@ void PretransformVertices::CollectData( aiScene* pcScene, aiNode* pcNode, unsign unsigned int& num_ref = num_refs[pcNode->mMeshes[i]]; ai_assert(0 != num_ref); --num_ref; + // Save the name of the last mesh + if (num_ref==0) + { + pcMeshOut->mName = pcMesh->mName; + } if (identity) { // copy positions without modifying them @@ -397,7 +403,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in out.push_back(ntz); - node->mMeshes[i] = numIn + out.size() - 1; + node->mMeshes[i] = static_cast<unsigned int>(numIn + out.size() - 1); } } } @@ -483,7 +489,7 @@ void PretransformVertices::Execute( aiScene* pScene) memcpy(npp,pScene->mMeshes,sizeof(aiMesh*)*pScene->mNumMeshes); memcpy(npp+pScene->mNumMeshes,&apcOutMeshes[0],sizeof(aiMesh*)*apcOutMeshes.size()); - pScene->mNumMeshes += apcOutMeshes.size(); + pScene->mNumMeshes += static_cast<unsigned int>(apcOutMeshes.size()); delete[] pScene->mMeshes; pScene->mMeshes = npp; } @@ -625,9 +631,10 @@ void PretransformVertices::Execute( aiScene* pScene) // now delete all nodes in the scene and build a new // flat node graph with a root node and some level 1 children + aiNode* newRoot = new aiNode(); + newRoot->mName = pScene->mRootNode->mName; delete pScene->mRootNode; - pScene->mRootNode = new aiNode(); - pScene->mRootNode->mName.Set("<dummy_root>"); + pScene->mRootNode = newRoot; if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras) { @@ -645,7 +652,7 @@ void PretransformVertices::Execute( aiScene* pScene) { aiNode* pcNode = *nodes = new aiNode(); pcNode->mParent = pScene->mRootNode; - pcNode->mName.length = ::ai_snprintf(pcNode->mName.data,MAXLEN,"mesh_%u",i); + pcNode->mName = pScene->mMeshes[i]->mName; // setup mesh indices pcNode->mNumMeshes = 1; @@ -690,9 +697,9 @@ void PretransformVertices::Execute( aiScene* pScene) // find the dominant axis aiVector3D d = max-min; - const float div = std::max(d.x,std::max(d.y,d.z))*0.5f; + const ai_real div = std::max(d.x,std::max(d.y,d.z))*ai_real( 0.5); - d = min+d*0.5f; + d = min + d * (ai_real)0.5; for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) { aiMesh* m = pScene->mMeshes[a]; for (unsigned int i = 0; i < m->mNumVertices;++i) { @@ -721,4 +728,3 @@ void PretransformVertices::Execute( aiScene* pScene) DefaultLogger::get()->info(buffer); } } - |