浏览代码

Merge pull request #34 from assimp/msvc-pch

- LWO: fix crash when computing normals for meshes that contain line or point faces.
Alexander Gessler 12 年之前
父节点
当前提交
48591e17b1
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      code/LWOLoader.cpp

+ 4 - 0
code/LWOLoader.cpp

@@ -467,6 +467,10 @@ void LWOImporter::ComputeNormals(aiMesh* mesh, const std::vector<unsigned int>&
 	for (; begin != end; ++begin)	{
 		aiFace& face = *begin;
 
+		if(face.mNumIndices < 3) {
+			continue;
+		}
+
 		// LWO doc: "the normal is defined as the cross product of the first and last edges"
 		aiVector3D* pV1 = mesh->mVertices + face.mIndices[0];
 		aiVector3D* pV2 = mesh->mVertices + face.mIndices[1];