فهرست منبع

Move vertex copy operation into switch statement.

We will be adding special handling for Tristrips in an upcoming commit,
which unfortunately doesn't map to a common copy loop as it is.
Johannes Ebersold 10 سال پیش
والد
کامیت
7c4bf383d7
1فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 8 6
      code/ColladaParser.cpp

+ 8 - 6
code/ColladaParser.cpp

@@ -2109,16 +2109,24 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPer
 		{
 			case Prim_Lines:
 				numPoints = 2; 
+				for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
+					CopyPrimitive(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
 				break;
 			case Prim_Triangles: 
 				numPoints = 3; 
+				for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
+					CopyPrimitive(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
 				break;
 			case Prim_Polylist: 
 				numPoints = pVCount[currentPrimitive];
+				for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
+					CopyPrimitive(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
 				break;
 			case Prim_TriFans: 
 			case Prim_Polygon:
 				numPoints = indices.size() / numOffsets; 
+				for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
+					CopyPrimitive(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
 				break;
 			default:
 				// LineStrip and TriStrip not supported due to expected index unmangling
@@ -2128,12 +2136,6 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPer
 
 		// store the face size to later reconstruct the face from
 		pMesh->mFaceSize.push_back( numPoints);
-
-		// gather that number of vertices
-		for( size_t b = 0; b < numPoints; b++)
-		{
-			CopyPrimitive(b, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
-		}
 	}