Added --flip option to allow one to flip the source data about the x axis.

This commit is contained in:
Robert Osfield 2007-09-25 17:01:16 +00:00
parent b8ddf1f786
commit 61d0bc4eaf

View File

@ -267,9 +267,11 @@ void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
} }
osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,float height, osg::Image* image, bool useTextureRectangle, bool xyPlane) osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,float height, osg::Image* image, bool useTextureRectangle, bool xyPlane, bool option_flip)
{ {
bool flip = image->getOrigin()==osg::Image::TOP_LEFT; bool flip = image->getOrigin()==osg::Image::TOP_LEFT;
if (option_flip) flip = !flip;
if (useTextureRectangle) if (useTextureRectangle)
{ {
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos, osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos,
@ -347,7 +349,7 @@ int main(int argc, char** argv)
} }
bool fullscreen = !arguments.read("--interactive"); bool fullscreen = !arguments.read("--interactive");
bool flip = arguments.read("--flip");
osg::ref_ptr<osg::Geode> geode = new osg::Geode; osg::ref_ptr<osg::Geode> geode = new osg::Geode;
@ -408,7 +410,7 @@ int main(int argc, char** argv)
if (image) if (image)
{ {
geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image, useTextureRectangle, xyPlane)); geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image, useTextureRectangle, xyPlane, flip));
bottomright = pos + osg::Vec3(static_cast<float>(image->s()),static_cast<float>(image->t()),0.0f); bottomright = pos + osg::Vec3(static_cast<float>(image->s()),static_cast<float>(image->t()),0.0f);