From e346396abd8ba42b62dc4bef25232916d229137d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 May 2007 14:00:51 +0000 Subject: [PATCH] From Roger James, "Here is a small fix for the ac3d plugin geode.cpp. The fix is entirely localised to ac3d::Geode::OutputTriangleStripDARR. It resolves an issue when processing a DrawArrayLengths with multiple lengths where the vertex indices were incorrect for all but the first chunk." --- src/osgPlugins/ac/Geode.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/osgPlugins/ac/Geode.cpp b/src/osgPlugins/ac/Geode.cpp index cc97fa3f7..974d05aef 100644 --- a/src/osgPlugins/ac/Geode.cpp +++ b/src/osgPlugins/ac/Geode.cpp @@ -252,25 +252,24 @@ void Geode::OutputTriangleStripDARR(const int iCurrentMaterial, const unsigned i unsigned int vindex = drawArrayLengths->getFirst(); for(osg::DrawArrayLengths::const_iterator primItr = drawArrayLengths->begin(); primItr end(); ++primItr) { - unsigned int localPrimLength; + // RFJ!!!!!!!!!! fixes for indexing + int localPrimLength= *primItr; bool evenodd=true; - localPrimLength = 3; - for(GLsizei primCount = 0; primCount < *primItr-2; ++primCount) + for(GLsizei primCount = 0; primCount < localPrimLength - 2; ++primCount) { - OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); + OutputSurfHead(iCurrentMaterial, surfaceFlags, 3, fout); if (evenodd) { - OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); - OutputVertex(vindex+1, pVertexIndices, pTexCoords, pTexIndices, fout); + OutputVertex(vindex + primCount, pVertexIndices, pTexCoords, pTexIndices, fout); + OutputVertex(vindex + primCount + 1, pVertexIndices, pTexCoords, pTexIndices, fout); } else { - OutputVertex(vindex+1, pVertexIndices, pTexCoords, pTexIndices, fout); - OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); + OutputVertex(vindex + primCount + 1 , pVertexIndices, pTexCoords, pTexIndices, fout); + OutputVertex(vindex + primCount, pVertexIndices, pTexCoords, pTexIndices, fout); } - OutputVertex(vindex+2, pVertexIndices, pTexCoords, pTexIndices, fout); - ++vindex; + OutputVertex(vindex + primCount + 2, pVertexIndices, pTexCoords, pTexIndices, fout); evenodd=!evenodd; - } - + } + vindex += localPrimLength; } } void Geode::OutputTriangleFanDARR(const int iCurrentMaterial, const unsigned int surfaceFlags,