Removed redudent codepaths, standardizing on the most portable Texture2D path.

This commit is contained in:
Robert Osfield 2016-06-02 14:22:25 +01:00
parent 5c7e155a69
commit 203e5f7ef8

View File

@ -226,23 +226,7 @@ osg::ref_ptr<Node> osgDB::readRefNodeFiles(osg::ArgumentParser& arguments,const
// start the stream playing. // start the stream playing.
imageStream->play(); imageStream->play();
osg::ref_ptr<osg::Geometry> pictureQuad = 0; osg::ref_ptr<osg::Geometry> pictureQuad = osg::createTexturedQuadGeometry(osg::Vec3(0.0f,0.0f,0.0f),
bool useTextureRectangle = true;
if (useTextureRectangle)
{
pictureQuad = osg::createTexturedQuadGeometry(osg::Vec3(0.0f,0.0f,0.0f),
osg::Vec3(image->s(),0.0f,0.0f),
osg::Vec3(0.0f,0.0f,image->t()),
0.0f, flip ? image->t() : 0.0, image->s(), flip ? 0.0 : image->t());
pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
new osg::TextureRectangle(image.get()),
osg::StateAttribute::ON);
}
else
{
pictureQuad = osg::createTexturedQuadGeometry(osg::Vec3(0.0f,0.0f,0.0f),
osg::Vec3(image->s(),0.0f,0.0f), osg::Vec3(image->s(),0.0f,0.0f),
osg::Vec3(0.0f,0.0f,image->t()), osg::Vec3(0.0f,0.0f,image->t()),
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f); 0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
@ -250,15 +234,11 @@ osg::ref_ptr<Node> osgDB::readRefNodeFiles(osg::ArgumentParser& arguments,const
pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0, pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
new osg::Texture2D(image.get()), new osg::Texture2D(image.get()),
osg::StateAttribute::ON); osg::StateAttribute::ON);
}
if (pictureQuad.valid())
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode; osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(pictureQuad.get()); geode->addDrawable(pictureQuad.get());
nodeList.push_back(geode.get()); nodeList.push_back(geode.get());
}
} }
else if (image.valid()) else if (image.valid())
{ {