Replaced deprecated osg::Geometry::set*Binding() usage.

This commit is contained in:
Robert Osfield 2013-06-27 09:59:33 +00:00
parent 87add5f508
commit 592c580721
6 changed files with 132 additions and 146 deletions

View File

@ -50,8 +50,7 @@ osg::Geometry* createEaseMotionGeometry(osgAnimation::Motion* motion) {
geom->setUseDisplayList(false); geom->setUseDisplayList(false);
geom->setVertexArray(v); geom->setVertexArray(v);
geom->setColorArray(cols); geom->setColorArray(cols, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size())); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size()));
return geom; return geom;

View File

@ -53,9 +53,7 @@ osg::Geode* createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors); geometry->setColorArray (colors, osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry ); geode->addDrawable( geometry );
@ -70,8 +68,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
geometry->setVertexArray (vertices.get()); geometry->setVertexArray (vertices.get());
geometry->setColorArray (colors.get()); geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
float step = size / static_cast<float>(nsplit); float step = size / static_cast<float>(nsplit);
float s = 0.5f/4.0f; float s = 0.5f/4.0f;

View File

@ -49,9 +49,7 @@ osg::ref_ptr<osg::Geode> createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get()); geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() ); geode->addDrawable( geometry.get() );

View File

@ -59,8 +59,7 @@ osg::Geode* createAxis()
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
geometry->setVertexArray(vertices); geometry->setVertexArray(vertices);
geometry->setColorArray(colors); geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false); geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);

View File

@ -210,8 +210,7 @@ osgDB::ReaderWriter::ReadResult ImageReaderWriter::local_readNode(const std::str
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

View File

@ -229,8 +229,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
(*normals)[5].set(1.0f,0.0f,0.0f); (*normals)[5].set(1.0f,0.0f,0.0f);
(*normals)[6].set(0.0f,0.0f,1.0f); (*normals)[6].set(0.0f,0.0f,1.0f);
(*normals)[7].set(0.0f,0.0f,1.0f); (*normals)[7].set(0.0f,0.0f,1.0f);
geom->setNormalArray(normals); geom->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
osg::Vec2Array* tcoords = new osg::Vec2Array(8); osg::Vec2Array* tcoords = new osg::Vec2Array(8);
(*tcoords)[0].set(0.0f,0.0f); (*tcoords)[0].set(0.0f,0.0f);
@ -245,8 +244,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8));
@ -277,8 +275,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec3Array* normals = new osg::Vec3Array(1); osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,-1.0f,0.0f); (*normals)[0].set(0.0f,-1.0f,0.0f);
geom->setNormalArray(normals); geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4); osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,1.0f); (*tcoords)[0].set(0.0f,1.0f);
@ -289,8 +286,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
@ -357,8 +353,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec3Array* normals = new osg::Vec3Array(1); osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,1.0f,0.0f); (*normals)[0].set(0.0f,1.0f,0.0f);
geom->setNormalArray(normals); geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4); osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(1.0f,1.0f); (*tcoords)[0].set(1.0f,1.0f);
@ -369,8 +364,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));