Removed deprecated Geometry::set*Binding() usage

This commit is contained in:
Robert Osfield 2013-06-26 17:58:57 +00:00
parent 9f0bbbf831
commit 5a25a93bdd
5 changed files with 21 additions and 34 deletions

View File

@ -156,25 +156,21 @@ void RigGeometry::copyFrom(osg::Geometry& from)
if (from.getNormalArray())
{
if (!copyToSelf) target.setNormalArray(from.getNormalArray());
target.setNormalBinding(from.getNormalBinding());
}
if (from.getColorArray())
{
if (!copyToSelf) target.setColorArray(from.getColorArray());
target.setColorBinding(from.getColorBinding());
}
if (from.getSecondaryColorArray())
{
if (!copyToSelf) target.setSecondaryColorArray(from.getSecondaryColorArray());
target.setSecondaryColorBinding(from.getSecondaryColorBinding());
}
if (from.getFogCoordArray())
{
if (!copyToSelf) target.setFogCoordArray(from.getFogCoordArray());
target.setFogCoordBinding(from.getFogCoordBinding());
}
for(unsigned int ti=0;ti<from.getNumTexCoordArrays();++ti)

View File

@ -144,7 +144,7 @@ struct KeystoneUpdateCallback : public osg::Drawable::UpdateCallback
}
geometry->dirtyBound();
}
osg::ref_ptr<Keystone> _keystone;
};
@ -163,8 +163,7 @@ osg::Geode* Keystone::createKeystoneDistortionMesh()
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
colours->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
geometry->setColorArray(colours.get());
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours.get(), osg::Array::BIND_OVERALL);
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
geometry->setVertexArray(vertices.get());
@ -195,7 +194,7 @@ osg::Geode* Keystone::createKeystoneDistortionMesh()
for(unsigned i=0; i<numColumns-1; i++)
{
unsigned int vi = j*numColumns+i;
elements->push_back(vi+numColumns);
elements->push_back(vi);
elements->push_back(vi+1);
@ -205,7 +204,7 @@ osg::Geode* Keystone::createKeystoneDistortionMesh()
elements->push_back(vi+1+numColumns);
}
}
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
geometry->getOrCreateStateSet()->setRenderBinDetails(0, "RenderBin");
@ -230,8 +229,7 @@ osg::Node* Keystone::createGrid()
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
colours->push_back(getGridColor());
geometry->setColorArray(colours.get());
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours.get(), osg::Array::BIND_OVERALL);
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
geometry->setVertexArray(vertices.get());
@ -244,7 +242,7 @@ osg::Node* Keystone::createGrid()
osg::Vec2 heightVector(0.0f, 1.0f);
unsigned int numIntervals = 7;
// border line
{
unsigned int vi = texcoords->size();
@ -422,7 +420,7 @@ bool KeystoneHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionA
if (!viewport) return false;
if (ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN && ((ea.getModKeyMask()==osgGA::GUIEventAdapter::MODKEY_LEFT_CTRL || ea.getModKeyMask()==osgGA::GUIEventAdapter::MODKEY_RIGHT_CTRL)))
if (ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN && ((ea.getModKeyMask()==osgGA::GUIEventAdapter::MODKEY_LEFT_CTRL || ea.getModKeyMask()==osgGA::GUIEventAdapter::MODKEY_RIGHT_CTRL)))
{
if (ea.getUnmodifiedKey()=='g')
{
@ -544,15 +542,15 @@ bool Keystone::writeToFile()
// we don't want to write the UDC to the keystone file so take a reference to it, and set the pointer to NULL.
osg::ref_ptr<osg::UserDataContainer> temp_udc = getUserDataContainer();
setUserDataContainer(0);
OSG_NOTICE<<"Writing keystone to: "<<filename<<std::endl;
// write the keystone out to disk
osgDB::writeObjectFile(*this, filename);
// reassign the UDC
setUserDataContainer(temp_udc.get());
return true;
}
else
@ -573,7 +571,7 @@ bool Keystone::loadKeystoneFiles(osg::DisplaySettings* ds)
{
const std::string& filename = *itr;
osg::ref_ptr<osgViewer::Keystone> keystone = osgDB::readFile<osgViewer::Keystone>(filename);
if (keystone.valid())
if (keystone.valid())
{
keystone->setUserValue("filename",filename);
ds->getKeystones().push_back(keystone.get());
@ -585,9 +583,9 @@ bool Keystone::loadKeystoneFiles(osg::DisplaySettings* ds)
keystone = new Keystone;
keystone->setUserValue("filename",filename);
ds->getKeystones().push_back(keystone.get());
keystonesLoaded = true;
keystonesLoaded = true;
}
}
}
}
return keystonesLoaded;
}

View File

@ -699,8 +699,7 @@ osg::Geometry* StatsHandler::createBackgroundRectangle(const osg::Vec3& pos, con
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(color);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colors, osg::Array::BIND_OVERALL);
osg::DrawElementsUShort *base = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_FAN,0);
base->push_back(0);
@ -748,8 +747,7 @@ protected:
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(color);
setColorArray(colors);
setColorBinding(osg::Geometry::BIND_OVERALL);
setColorArray(colors, osg::Array::BIND_OVERALL);
setDrawCallback(new GraphUpdateCallback(pos, width, height, viewerStats, stats, max, nameBegin, nameEnd));
}
@ -880,8 +878,7 @@ osg::Geometry* StatsHandler::createGeometry(const osg::Vec3& pos, float height,
osg::Vec4Array* colours = new osg::Vec4Array;
colours->push_back(colour);
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, numBlocks*4));
@ -1034,8 +1031,7 @@ osg::Geometry* StatsHandler::createFrameMarkers(const osg::Vec3& pos, float heig
osg::Vec4Array* colours = new osg::Vec4Array;
colours->push_back(colour);
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINES, 0, numBlocks*2));
@ -1061,8 +1057,7 @@ osg::Geometry* StatsHandler::createTick(const osg::Vec3& pos, float height, cons
osg::Vec4Array* colours = new osg::Vec4Array;
colours->push_back(colour);
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINES, 0, numTicks*2));

View File

@ -120,8 +120,7 @@ osg::Geometry* PanoramicSphericalDisplay::createParoramicSphericalDisplayDistort
// pass the created vertex array to the points geometry object.
geometry->setVertexArray(vertices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->setTexCoordArray(0,texcoords0);
if (texcoords1) geometry->setTexCoordArray(1,texcoords1);

View File

@ -162,8 +162,7 @@ osg::Geometry* SphericalDisplay::create3DSphericalDisplayDistortionMesh(const os
// pass the created vertex array to the points geometry object.
geometry->setVertexArray(vertices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->setTexCoordArray(0,texcoords0);
if (texcoords1) geometry->setTexCoordArray(1,texcoords1);