Replaced deprecated Geometry::set*Binding() usage

This commit is contained in:
Robert Osfield
2013-06-26 18:06:09 +00:00
parent 5a25a93bdd
commit 8e65ab7e45
4 changed files with 9 additions and 16 deletions

View File

@@ -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<osg::Vec3Array> 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()));

View File

@@ -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()));

View File

@@ -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

View File

@@ -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("<<x<<", "<<y<<") Texture coordinate out of range, X="<<X<<", Y="<<Y<<std::endl;
return Color();