From c1ebc3ac0c2ee3d0396be5b7c5ffe8a61902063f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 27 Jun 2013 08:44:15 +0000 Subject: [PATCH] Replaced deprecated osg::Geometry::set*Binding() usage --- src/osgPlugins/OpenFlight/GeometryRecords.cpp | 8 ++++---- src/osgPlugins/mdl/VTXReader.cpp | 3 +-- src/osgPlugins/obj/ReaderWriterOBJ.cpp | 3 +-- src/osgPlugins/shp/ESRIShapeParser.cpp | 3 +-- src/osgPlugins/txp/TXPParser.cpp | 9 +++------ 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/osgPlugins/OpenFlight/GeometryRecords.cpp b/src/osgPlugins/OpenFlight/GeometryRecords.cpp index ec11b7390..460fdbbbf 100644 --- a/src/osgPlugins/OpenFlight/GeometryRecords.cpp +++ b/src/osgPlugins/OpenFlight/GeometryRecords.cpp @@ -581,7 +581,7 @@ protected: if (isGouraud()) { // Color per vertex - geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX); + if (geometry->getColorArray()) geometry->getColorArray()->setBinding(osg::Array::BIND_PER_VERTEX); } else { @@ -597,7 +597,7 @@ protected: // Normal binding if (isLit()) { - geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX ); + if (geometry->getNormalArray()) geometry->getNormalArray()->setBinding(osg::Array::BIND_PER_VERTEX); } else { @@ -1411,7 +1411,7 @@ protected: if (mesh->isGouraud()) { // Color per vertex - geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX); + if (geometry->getColorArray()) geometry->getColorArray()->setBinding(osg::Array::BIND_PER_VERTEX); } else { @@ -1428,7 +1428,7 @@ protected: // Normal binding if (mesh->isLit()) { - geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX ); + if (geometry->getNormalArray()) geometry->getNormalArray()->setBinding(osg::Array::BIND_PER_VERTEX); } else { diff --git a/src/osgPlugins/mdl/VTXReader.cpp b/src/osgPlugins/mdl/VTXReader.cpp index 5400dfc1e..dfa046dd0 100644 --- a/src/osgPlugins/mdl/VTXReader.cpp +++ b/src/osgPlugins/mdl/VTXReader.cpp @@ -289,8 +289,7 @@ ref_ptr VTXReader::processStripGroup(int lodNum, std::istream * str, // Create the geometry and add the vertex data to it geom = new Geometry(); geom->setVertexArray(vertexArray.get()); - geom->setNormalArray(normalArray.get()); - geom->setNormalBinding(Geometry::BIND_PER_VERTEX); + geom->setNormalArray(normalArray.get(), Array::BIND_PER_VERTEX); geom->setTexCoordArray(0, texcoordArray.get()); // Create and fill the index array diff --git a/src/osgPlugins/obj/ReaderWriterOBJ.cpp b/src/osgPlugins/obj/ReaderWriterOBJ.cpp index 05dfe2014..64b8df884 100644 --- a/src/osgPlugins/obj/ReaderWriterOBJ.cpp +++ b/src/osgPlugins/obj/ReaderWriterOBJ.cpp @@ -495,8 +495,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model, if (vertices) geometry->setVertexArray(vertices); if (normals) { - geometry->setNormalArray(normals); - geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + geometry->setNormalArray(normals, osg::Array::BIND_PER_VERTEX); } if (texcoords) { diff --git a/src/osgPlugins/shp/ESRIShapeParser.cpp b/src/osgPlugins/shp/ESRIShapeParser.cpp index f043517ed..bd236c80b 100644 --- a/src/osgPlugins/shp/ESRIShapeParser.cpp +++ b/src/osgPlugins/shp/ESRIShapeParser.cpp @@ -564,8 +564,7 @@ void ESRIShapeParser::_process( const std::vector &mpatch // Lets mark poorly supported primitives with red, otherwise white osg::ref_ptr colors = new osg::Vec4Array; - geometry->setColorArray(colors.get()); - geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX ); + geometry->setColorArray(colors.get(), osg::Array::BIND_PER_VERTEX ); for( i = 0; i < p->numParts; i++ ) { diff --git a/src/osgPlugins/txp/TXPParser.cpp b/src/osgPlugins/txp/TXPParser.cpp index 3edc3f523..8201a5da9 100644 --- a/src/osgPlugins/txp/TXPParser.cpp +++ b/src/osgPlugins/txp/TXPParser.cpp @@ -1192,13 +1192,11 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(supLineColor); - linesGeom->setColorArray(colors); - linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL); + linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL); osg::Vec3Array* normals = new osg::Vec3Array; normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f)); - linesGeom->setNormalArray(normals); - linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL); + linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL); linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,supports->size()*2)); @@ -1441,8 +1439,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) geometry->setVertexArray(vertices.get()); if (normals.valid()) { - geometry->setNormalArray(normals.get()); - geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + geometry->setNormalArray(normals.get(), osg::Array::BIND_PER_VERTEX); } bool local;