diff options
Diffstat (limited to 'src/3rdparty/assimp/code/NFFLoader.cpp')
-rw-r--r-- | src/3rdparty/assimp/code/NFFLoader.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/3rdparty/assimp/code/NFFLoader.cpp b/src/3rdparty/assimp/code/NFFLoader.cpp index 8bec63ea3..a51c500f1 100644 --- a/src/3rdparty/assimp/code/NFFLoader.cpp +++ b/src/3rdparty/assimp/code/NFFLoader.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. @@ -54,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <assimp/IOSystem.hpp> #include <assimp/DefaultLogger.hpp> #include <assimp/scene.h> +#include <assimp/importerdesc.h> #include <memory> @@ -241,8 +243,6 @@ void NFFImporter::InternReadFile( const std::string& pFile, if( !file.get()) throw DeadlyImportError( "Failed to open NFF file " + pFile + "."); - unsigned int m = (unsigned int)file->FileSize(); - // allocate storage and copy the contents of the file to a memory buffer // (terminate it with zero) std::vector<char> mBuffer2; @@ -467,7 +467,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, for (unsigned int a = 0; a < numIdx;++a) { SkipSpaces(sz,&sz); - m = ::strtoul10(sz,&sz); + unsigned int m = ::strtoul10(sz,&sz); if (m >= (unsigned int)tempPositions.size()) { DefaultLogger::get()->error("NFF2: Vertex index overflow"); @@ -633,7 +633,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, for (std::vector<unsigned int>::const_iterator it = tempIdx.begin(), end = tempIdx.end(); it != end;++it) { - m = *it; + unsigned int m = *it; // copy colors -vertex color specifications override polygon color specifications if (hasColor) @@ -733,7 +733,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, sz = &line[1];out = currentMesh; } SkipSpaces(sz,&sz); - m = strtoul10(sz); + unsigned int m = strtoul10(sz); // ---- flip the face order out->vertices.resize(out->vertices.size()+m); @@ -965,7 +965,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, // compute the center point of the cone/cylinder - // it is its local transformation origin currentMesh.dir = center2-center1; - currentMesh.center = center1+currentMesh.dir/2.f; + currentMesh.center = center1+currentMesh.dir/(ai_real)2.0; float f; if (( f = currentMesh.dir.Length()) < 10e-3f ) @@ -1079,7 +1079,9 @@ void NFFImporter::InternReadFile( const std::string& pFile, // generate the camera if (hasCam) { - aiNode* nd = *ppcChildren = new aiNode(); + ai_assert(ppcChildren); + aiNode* nd = new aiNode(); + *ppcChildren = nd; nd->mName.Set("<NFF_Camera>"); nd->mParent = root; @@ -1103,13 +1105,15 @@ void NFFImporter::InternReadFile( const std::string& pFile, // generate light sources if (!lights.empty()) { + ai_assert(ppcChildren); pScene->mNumLights = (unsigned int)lights.size(); pScene->mLights = new aiLight*[pScene->mNumLights]; for (unsigned int i = 0; i < pScene->mNumLights;++i,++ppcChildren) { const Light& l = lights[i]; - aiNode* nd = *ppcChildren = new aiNode(); + aiNode* nd = new aiNode(); + *ppcChildren = nd; nd->mParent = root; nd->mName.length = ::ai_snprintf(nd->mName.data,1024,"<NFF_Light%u>",i); @@ -1126,7 +1130,8 @@ void NFFImporter::InternReadFile( const std::string& pFile, if (!pScene->mNumMeshes)throw DeadlyImportError("NFF: No meshes loaded"); pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = pScene->mNumMeshes]; - for (it = meshes.begin(), m = 0; it != end;++it) + unsigned int m = 0; + for (it = meshes.begin(); it != end;++it) { if ((*it).faces.empty())continue; @@ -1159,7 +1164,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, ++ppcChildren; } else { *pMeshes++ = m; - } + } // copy vertex positions mesh->mVertices = new aiVector3D[mesh->mNumVertices]; |