From ca3ce4703d229ea394033e96b0295ef651b4349b Mon Sep 17 00:00:00 2001 From: Wolfgang Herget Date: Thu, 20 Nov 2014 13:12:09 +0100 Subject: [PATCH] Rename ColladaParser::CopyPrimitive to ::CopyVertex. That's a bit closer to what the function actually does. --- code/ColladaParser.cpp | 22 +++++++++++----------- code/ColladaParser.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index eb40d9d31..3d63168b8 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -2125,12 +2125,12 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector& pP case Prim_Lines: numPoints = 2; for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++) - CopyPrimitive(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(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); + CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); break; case Prim_TriStrips: numPoints = 3; @@ -2139,14 +2139,14 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector& pP case Prim_Polylist: numPoints = pVCount[currentPrimitive]; for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++) - CopyPrimitive(polylistStartVertex + currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, 0, indices); + CopyVertex(polylistStartVertex + currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, 0, indices); polylistStartVertex += numPoints; 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); + CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); break; default: // LineStrip is not supported due to expected index unmangling @@ -2163,7 +2163,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector& pP return numPrimitives; } -void ColladaParser::CopyPrimitive(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Mesh* pMesh, std::vector& pPerIndexChannels, size_t currentPrimitive, const std::vector& indices){ +void ColladaParser::CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Mesh* pMesh, std::vector& pPerIndexChannels, size_t currentPrimitive, const std::vector& indices){ // don't overrun the boundaries of the index list size_t maxIndexRequested = currentPrimitive * numOffsets * numPoints + (currentVertex + 1) * numOffsets - 1; ai_assert(maxIndexRequested < indices.size()); @@ -2189,14 +2189,14 @@ void ColladaParser::CopyPrimitive(size_t currentVertex, size_t numOffsets, size_ void ColladaParser::ReadPrimTriStrips(size_t numOffsets, size_t perVertexOffset, Mesh* pMesh, std::vector& pPerIndexChannels, size_t currentPrimitive, const std::vector& indices){ if (currentPrimitive % 2 != 0){ //odd tristrip triangles need their indices mangled, to preserve winding direction - CopyPrimitive(1, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); - CopyPrimitive(0, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); - CopyPrimitive(2, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(1, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(0, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(2, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); } else {//for non tristrips or even tristrip triangles - CopyPrimitive(0, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); - CopyPrimitive(1, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); - CopyPrimitive(2, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(0, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(1, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); + CopyVertex(2, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); } } diff --git a/code/ColladaParser.h b/code/ColladaParser.h index 931f16ca0..561ff05b3 100644 --- a/code/ColladaParser.h +++ b/code/ColladaParser.h @@ -181,7 +181,7 @@ protected: size_t pNumPrimitives, const std::vector& pVCount, Collada::PrimitiveType pPrimType); /** Copies the data for a single primitive into the mesh, based on the InputChannels */ - void CopyPrimitive(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, + void CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Collada::Mesh* pMesh, std::vector& pPerIndexChannels, size_t currentPrimitive, const std::vector& indices);