From 981ed523564d74be8a7de8b9ce86637a545c252d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 1 Aug 2013 10:00:31 +0000 Subject: [PATCH] From Tom Jolley, "I found a couple more bugs after closely looking at the small piece of deprecated geometry in my model. There were problems with more than one primitive in a couple places. The first was the number of vertices were not being accumulated for DrawArraysPrimitiveType (caused another crash). The second is I had to move target_vindex and source_pindex before the PrimitiveSetList loop so they don't get reset on the next primitive (otherwise you end up with a lot of zeros in per vertex lists)." --- src/osg/Geometry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index ad37a8326..1df20446a 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -1427,7 +1427,7 @@ void Geometry::fixDeprecatedData() case(PrimitiveSet::DrawArraysPrimitiveType): { const DrawArrays* drawArray = static_cast(primitiveset); - numVertices = drawArray->getCount(); + numVertices += drawArray->getCount(); break; } case(PrimitiveSet::DrawArrayLengthsPrimitiveType): @@ -1540,6 +1540,8 @@ void Geometry::fixDeprecatedData() // start the primitiveNum at -1 as we increment it the first time through when // we start processing the primitive sets. int primitiveNum = -1; + int target_vindex = 0; + int source_pindex = -1; for(PrimitiveSetList::iterator itr = _primitives.begin(); itr != _primitives.end(); ++itr) @@ -1558,8 +1560,6 @@ void Geometry::fixDeprecatedData() } // copy the vertex data across to the new arays - int source_pindex = -1; - int target_vindex = 0; switch(primitiveset->getType()) { case(PrimitiveSet::DrawArraysPrimitiveType):