Collada importer: Add support for line strip primitives
parent
91f6a9a721
commit
92beee9924
|
@ -2231,7 +2231,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASSIMP_BUILD_DEBUG
|
#ifdef ASSIMP_BUILD_DEBUG
|
||||||
if (primType != Prim_TriFans && primType != Prim_TriStrips &&
|
if (primType != Prim_TriFans && primType != Prim_TriStrips && primType != Prim_LineStrip &&
|
||||||
primType != Prim_Lines) { // this is ONLY to workaround a bug in SketchUp 15.3.331 where it writes the wrong 'count' when it writes out the 'lines'.
|
primType != Prim_Lines) { // this is ONLY to workaround a bug in SketchUp 15.3.331 where it writes the wrong 'count' when it writes out the 'lines'.
|
||||||
ai_assert(actualPrimitives == numPrimitives);
|
ai_assert(actualPrimitives == numPrimitives);
|
||||||
}
|
}
|
||||||
|
@ -2400,6 +2400,10 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
size_t numberOfVertices = indices.size() / numOffsets;
|
size_t numberOfVertices = indices.size() / numOffsets;
|
||||||
numPrimitives = numberOfVertices - 2;
|
numPrimitives = numberOfVertices - 2;
|
||||||
}
|
}
|
||||||
|
if (pPrimType == Prim_LineStrip) {
|
||||||
|
size_t numberOfVertices = indices.size() / numOffsets;
|
||||||
|
numPrimitives = numberOfVertices - 1;
|
||||||
|
}
|
||||||
|
|
||||||
pMesh->mFaceSize.reserve( numPrimitives);
|
pMesh->mFaceSize.reserve( numPrimitives);
|
||||||
pMesh->mFacePosIndices.reserve( indices.size() / numOffsets);
|
pMesh->mFacePosIndices.reserve( indices.size() / numOffsets);
|
||||||
|
@ -2416,6 +2420,11 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||||
CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
||||||
break;
|
break;
|
||||||
|
case Prim_LineStrip:
|
||||||
|
numPoints = 2;
|
||||||
|
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||||
|
CopyVertex(currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
||||||
|
break;
|
||||||
case Prim_Triangles:
|
case Prim_Triangles:
|
||||||
numPoints = 3;
|
numPoints = 3;
|
||||||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||||
|
|
Loading…
Reference in New Issue