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)."

This commit is contained in:
Robert Osfield
2013-08-01 10:00:31 +00:00
parent 9a90ddd2d9
commit 981ed52356

View File

@@ -1427,7 +1427,7 @@ void Geometry::fixDeprecatedData()
case(PrimitiveSet::DrawArraysPrimitiveType):
{
const DrawArrays* drawArray = static_cast<const DrawArrays*>(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):