From 8e65ab7e4559bb818a4ec3fd4d2cc5fd55c79d16 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 26 Jun 2013 18:06:09 +0000 Subject: [PATCH] Replaced deprecated Geometry::set*Binding() usage --- src/osgSim/ScalarBar.cpp | 6 ++---- src/osgVolume/FixedFunctionTechnique.cpp | 6 ++---- src/osgVolume/RayTracedTechnique.cpp | 3 +-- src/osgWidget/Widget.cpp | 10 ++++------ 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/osgSim/ScalarBar.cpp b/src/osgSim/ScalarBar.cpp index 8027cabff..3280ac2c9 100644 --- a/src/osgSim/ScalarBar.cpp +++ b/src/osgSim/ScalarBar.cpp @@ -175,14 +175,12 @@ void ScalarBar::createDrawables() cs->push_back(c); cs->push_back(c); } - bar->setColorArray(cs.get()); - bar->setColorBinding(osg::Geometry::BIND_PER_VERTEX); + bar->setColorArray(cs.get(), osg::Array::BIND_PER_VERTEX); // Normal osg::ref_ptr ns(new osg::Vec3Array); ns->push_back(osg::Matrix::transform3x3(osg::Vec3(0.0f,0.0f,1.0f),matrix)); - bar->setNormalArray(ns.get()); - bar->setNormalBinding(osg::Geometry::BIND_OVERALL); + bar->setNormalArray(ns.get(), osg::Array::BIND_OVERALL); // The Quad strip that represents the bar bar->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,vs->size())); diff --git a/src/osgVolume/FixedFunctionTechnique.cpp b/src/osgVolume/FixedFunctionTechnique.cpp index 9a42c050c..12cfd8493 100644 --- a/src/osgVolume/FixedFunctionTechnique.cpp +++ b/src/osgVolume/FixedFunctionTechnique.cpp @@ -77,13 +77,11 @@ osg::Node* createCube(const osg::Vec3& center, float size, unsigned int numSlice osg::Vec3Array* normals = new osg::Vec3Array(1); (*normals)[0].set(0.0f,-1.0f,0.0f); - geom->setNormalArray(normals); - geom->setNormalBinding(osg::Geometry::BIND_OVERALL); + geom->setNormalArray(normals, osg::Array::BIND_OVERALL); osg::Vec4Array* colors = new osg::Vec4Array(1); (*colors)[0].set(1.0f,1.0f,1.0f,1.0); - geom->setColorArray(colors); - geom->setColorBinding(osg::Geometry::BIND_OVERALL); + geom->setColorArray(colors, osg::Array::BIND_OVERALL); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coords->size())); diff --git a/src/osgVolume/RayTracedTechnique.cpp b/src/osgVolume/RayTracedTechnique.cpp index b102b4130..63e6159a9 100644 --- a/src/osgVolume/RayTracedTechnique.cpp +++ b/src/osgVolume/RayTracedTechnique.cpp @@ -480,8 +480,7 @@ void RayTracedTechnique::init() osg::Vec4Array* colours = new osg::Vec4Array(1); (*colours)[0].set(1.0f,1.0f,1.0,1.0f); - geom->setColorArray(colours); - geom->setColorBinding(osg::Geometry::BIND_OVERALL); + geom->setColorArray(colours, osg::Array::BIND_OVERALL); osg::DrawElementsUShort* drawElements = new osg::DrawElementsUShort(GL_QUADS); // bottom diff --git a/src/osgWidget/Widget.cpp b/src/osgWidget/Widget.cpp index 3db3bd46d..279bd69a5 100644 --- a/src/osgWidget/Widget.cpp +++ b/src/osgWidget/Widget.cpp @@ -53,11 +53,9 @@ _minHeight (0.0f) { setUseDisplayList(false); setDataVariance(osg::Object::DYNAMIC); setVertexArray(new PointArray(4)); - setColorArray(new ColorArray(4)); - setNormalArray(_norms.get()); + setColorArray(new ColorArray(4), osg::Array::BIND_PER_VERTEX); + setNormalArray(_norms.get(), osg::Array::BIND_OVERALL); setTexCoordArray(0, texs); - setNormalBinding(osg::Geometry::BIND_OVERALL); - setColorBinding(osg::Geometry::BIND_PER_VERTEX); addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 4)); setDimensions(0.0f, 0.0f, w, h); @@ -512,8 +510,8 @@ Color Widget::getImageColorAtXY(point_type x, point_type y) const { point_type X = ((x / getWidth()) * width) + (*texs)[LL].x(); point_type Y = ((y / getHeight()) * height) + (*texs)[LR].y(); - - if (X<0.0 || X>1.0 || Y<0.0 || Y>1.0) + + if (X<0.0 || X>1.0 || Y<0.0 || Y>1.0) { OSG_INFO<<"Widget::getImageColorAtXY("<