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,39 +226,19 @@ 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),
osg::Vec3(image->s(),0.0f,0.0f),
osg::Vec3(0.0f,0.0f,image->t()),
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
bool useTextureRectangle = true; pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
if (useTextureRectangle) new osg::Texture2D(image.get()),
{ osg::StateAttribute::ON);
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(0.0f,0.0f,image->t()),
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0, osg::ref_ptr<osg::Geode> geode = new osg::Geode;
new osg::Texture2D(image.get()), geode->addDrawable(pictureQuad.get());
osg::StateAttribute::ON); nodeList.push_back(geode.get());
}
if (pictureQuad.valid())
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(pictureQuad.get());
nodeList.push_back(geode.get());
}
} }
else if (image.valid()) else if (image.valid())
{ {