From c1dc3901e72be072e6d7d76397ef48c6d6736758 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 28 Dec 2018 11:17:27 +0100 Subject: [PATCH] fix more findings. --- code/SceneCombiner.cpp | 6 +++++- code/XGLLoader.cpp | 6 +++--- code/glTF2Asset.h | 6 +++++- code/glTF2Importer.cpp | 6 ++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/code/SceneCombiner.cpp b/code/SceneCombiner.cpp index 883447372..2271194ca 100644 --- a/code/SceneCombiner.cpp +++ b/code/SceneCombiner.cpp @@ -738,7 +738,11 @@ void SceneCombiner::MergeBones(aiMesh* out,std::vector::const_iterator // And copy the final weights - adjust the vertex IDs by the // face index offset of the corresponding mesh. - for (std::vector< BoneSrcIndex >::const_iterator wmit = (*boneIt).pSrcBones.begin(); wmit != wend; ++wmit) { + for (std::vector< BoneSrcIndex >::const_iterator wmit = (*boneIt).pSrcBones.begin(); wmit != (*boneIt).pSrcBones.end(); ++wmit) { + if (wmit == wend) { + break; + } + aiBone* pip = (*wmit).first; for (unsigned int mp = 0; mp < pip->mNumWeights;++mp,++avw) { const aiVertexWeight& vfi = pip->mWeights[mp]; diff --git a/code/XGLLoader.cpp b/code/XGLLoader.cpp index 196f20e90..2dfd51284 100644 --- a/code/XGLLoader.cpp +++ b/code/XGLLoader.cpp @@ -370,7 +370,7 @@ aiLight* XGLImporter::ReadDirectionalLight() // ------------------------------------------------------------------------------------------------ aiNode* XGLImporter::ReadObject(TempScope& scope, bool skipFirst, const char* closetag) { - std::unique_ptr nd(new aiNode()); + aiNode *nd = new aiNode; std::vector children; std::vector meshes; @@ -453,11 +453,11 @@ aiNode* XGLImporter::ReadObject(TempScope& scope, bool skipFirst, const char* cl nd->mChildren = new aiNode*[nd->mNumChildren](); for(unsigned int i = 0; i < nd->mNumChildren; ++i) { nd->mChildren[i] = children[i]; - children[i]->mParent = nd.get(); + children[i]->mParent = nd; } } - return nd.release(); + return nd; } // ------------------------------------------------------------------------------------------------ diff --git a/code/glTF2Asset.h b/code/glTF2Asset.h index 92be82f3b..6672dd7a9 100644 --- a/code/glTF2Asset.h +++ b/code/glTF2Asset.h @@ -656,7 +656,11 @@ namespace glTF2 } ortographic; } cameraProperties; - Camera() {} + Camera() + : type(Perspective) + , cameraProperties() { + // empty + } void Read(Value& obj, Asset& r); }; diff --git a/code/glTF2Importer.cpp b/code/glTF2Importer.cpp index 107281a33..20c28f498 100755 --- a/code/glTF2Importer.cpp +++ b/code/glTF2Importer.cpp @@ -763,6 +763,12 @@ static void BuildVertexWeightMapping(Mesh::Primitive& primitive, std::vectorExtractData(indices16); } + // + if (nullptr == indices8 && nullptr == indices16) { + // Something went completely wrong! + ai_assert(false); + return; + } for (int i = 0; i < num_vertices; ++i) { for (int j = 0; j < 4; ++j) {