Changed the generation of primtive set to use DrawElementsUShort for even

index sets that can be represented by UBytes, thisis to try to keep to
fast paths more likely to be supported by graphics drivers.
This commit is contained in:
Robert Osfield 2004-07-01 14:27:22 +00:00
parent a0eead991f
commit 2598b02243

View File

@ -472,18 +472,12 @@ void TriStripVisitor::stripify(Geometry& geom)
std::copy(indices.begin(),indices.end(),std::back_inserter(*elements));
new_primitives.push_back(elements);
}
else if (maxValue>=256)
else
{
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(GL_QUADS);
std::copy(indices.begin(),indices.end(),std::back_inserter(*elements));
new_primitives.push_back(elements);
}
else
{
osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(GL_QUADS);
std::copy(indices.begin(),indices.end(),std::back_inserter(*elements));
new_primitives.push_back(elements);
}
}
}
}
@ -519,16 +513,9 @@ void TriStripVisitor::stripify(Geometry& geom)
std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements));
new_primitives.push_back(elements);
}
else if (maxValue>=256)
{
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr->m_Type);
elements->reserve(pitr->m_Indices.size());
std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements));
new_primitives.push_back(elements);
}
else
{
osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(pitr->m_Type);
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr->m_Type);
elements->reserve(pitr->m_Indices.size());
std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements));
new_primitives.push_back(elements);