Procházet zdrojové kódy

Merge branch 'master' into qt_viewer_new_imagelib

Kim Kulling před 7 roky
rodič
revize
1d47d49a66
2 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 1 1
      code/SplitByBoneCountProcess.cpp
  2. 6 0
      code/glTF2Importer.cpp

+ 1 - 1
code/SplitByBoneCountProcess.cpp

@@ -393,7 +393,7 @@ void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const
             newMeshList.insert( newMeshList.end(), replaceMeshes.begin(), replaceMeshes.end());
         }
 
-        delete pNode->mMeshes;
+        delete [] pNode->mMeshes;
         pNode->mNumMeshes = static_cast<unsigned int>(newMeshList.size());
         pNode->mMeshes = new unsigned int[pNode->mNumMeshes];
         std::copy( newMeshList.begin(), newMeshList.end(), pNode->mMeshes);

+ 6 - 0
code/glTF2Importer.cpp

@@ -437,6 +437,12 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
             }
 
             for (size_t tc = 0; tc < attr.texcoord.size() && tc < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++tc) {
+                if (attr.texcoord[tc]->count != aim->mNumVertices) {
+                    DefaultLogger::get()->warn("Texcoord stream size in mesh \"" + mesh.name +
+                                               "\" does not match the vertex count");
+                    continue;
+                }
+
                 attr.texcoord[tc]->ExtractData(aim->mTextureCoords[tc]);
                 aim->mNumUVComponents[tc] = attr.texcoord[tc]->GetNumComponents();