Explorar o código

Ignore points and lines imported as they screw up the meshes

Conflicts:
	Tools/Contents/polyimport/Source/polyimport.cpp
Bill Robinson %!s(int64=12) %!d(string=hai) anos
pai
achega
6cf1274903
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      Tools/Contents/polyimport/Source/polyimport.cpp

+ 8 - 2
Tools/Contents/polyimport/Source/polyimport.cpp

@@ -36,7 +36,7 @@ unsigned int addBone(aiBone *bone) {
 }
 
 void addToMesh(String prefix, Polycode::Mesh *tmesh, const struct aiScene *sc, const struct aiNode* nd, bool swapZY, bool addSubmeshes, bool listOnly) {
-	int i;
+	int i, nIgnoredPolygons = 0;
 	unsigned int n = 0, t;
 	// draw all meshes assigned to this node
 
@@ -112,6 +112,10 @@ void addToMesh(String prefix, Polycode::Mesh *tmesh, const struct aiScene *sc, c
 
          for (t = 0; t < mesh->mNumFaces; ++t) {
              const struct aiFace* face = &mesh->mFaces[t];
+			 if (face->mNumIndices != 3) {
+				 nIgnoredPolygons++;
+				 continue;
+			 }
 
              for(i = 0; i < face->mNumIndices; i++) {
                  int index = face->mIndices[i];
@@ -126,7 +130,9 @@ void addToMesh(String prefix, Polycode::Mesh *tmesh, const struct aiScene *sc, c
 			OSBasics::close(outFile);
 			delete tmesh;
 		}
-	
+		if (nIgnoredPolygons) {
+			printf("Ignored %d non-triangular polygons\n", nIgnoredPolygons);
+		}
 	}