Clean up up osg::Geometry, removing long deprecated support for array indices and BIND_PER_PRIMITIVE binding that forced OpenGL slow paths. osg::Geometry is now smaller and only supports OpenGL fasts paths.

New methods osg::Geometry::containsDeprecatedData() and osg::Geometry::fixDeprecatedData() provide a means for converting geometries that still use the array indices and BIND_PER_PRIMITIVE across to complient
versions.

Cleaned up the rest of the OSG where use of array indices and BIND_PER_PRIMITIVE were accessed or used.
This commit is contained in:
Robert Osfield
2013-06-18 11:18:28 +00:00
parent 05b72e9b4c
commit 7d40c7258f
35 changed files with 1379 additions and 2880 deletions

View File

@@ -129,40 +129,52 @@ void Geometry::write(DataOutputStream* out){
out->writeArray(getFogCoordIndices());
}
// Write texture coord arrays
Geometry::ArrayDataList& tcal = getTexCoordArrayList();
Geometry::ArrayList& tcal = getTexCoordArrayList();
out->writeInt(tcal.size());
unsigned int j;
for(j=0;j<tcal.size();j++)
{
// Write coords if valid
out->writeBool(tcal[j].array.valid());
if (tcal[j].array.valid()){
out->writeArray(tcal[j].array.get());
out->writeBool(tcal[j].valid());
if (tcal[j].valid()){
out->writeArray(tcal[j].get());
}
// Write indices if valid
out->writeBool(tcal[j].indices.valid());
if (tcal[j].indices.valid()){
out->writeArray(tcal[j].indices.get());
const osg::IndexArray* indices = getTexCoordIndices(j);
out->writeBool(indices!=0);
if (indices!=0){
out->writeArray(indices);
}
}
// Write vertex attributes
Geometry::ArrayDataList& vaal = getVertexAttribArrayList();
Geometry::ArrayList& vaal = getVertexAttribArrayList();
out->writeInt(vaal.size());
for(j=0;j<vaal.size();j++)
{
// Write coords if valid
const osg::Geometry::ArrayData& arrayData = vaal[j];
out->writeBinding(arrayData.binding);
out->writeBool(arrayData.normalize==GL_TRUE);
out->writeBool(arrayData.array.valid());
if (arrayData.array.valid()){
out->writeArray(arrayData.array.get());
const osg::Array* array = vaal[j].get();
if (array)
{
out->writeBinding(static_cast<osg::Geometry::AttributeBinding>(array->getBinding()));
out->writeBool(array->getNormalize());
out->writeBool(true);
out->writeArray(array);
// Write indices if valid
const osg::IndexArray* indices = getVertexAttribIndices(j);
out->writeBool(indices!=0);
if (indices!=0){
out->writeArray(indices);
}
}
// Write indices if valid
out->writeBool(arrayData.indices.valid());
if (arrayData.indices.valid()){
out->writeArray(arrayData.indices.get());
else
{
out->writeBinding(BIND_OFF);
out->writeBool(false);
out->writeBool(false);
out->writeBool(false);
}
}
}