From d7cba048f5982383c78d21008bbe710e04dbbb0e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Oct 2011 11:00:29 +0000 Subject: [PATCH] Added support for using negative scale_x, scale_y and scale_z values in the tag to allow presentations to flip the imagery --- src/osgPresentation/SlideShowConstructor.cpp | 28 +++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 62622233b..8cf519fb4 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -1750,10 +1750,12 @@ bool DraggerVolumeTileCallback::receive(const osgManipulator::MotionCommand& com } } -void SlideShowConstructor::addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData) +void SlideShowConstructor::addVolume(const std::string& filename, const PositionData& in_positionData, const VolumeData& volumeData) { // osg::Object::DataVariance defaultMatrixDataVariance = osg::Object::DYNAMIC; // STATIC + PositionData positionData(in_positionData); + std::string foundFile = filename; osg::ref_ptr image; osg::ref_ptr volume; @@ -1821,6 +1823,30 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position if (!image && !volume) return; + if (positionData.scale.x()<0.0) + { + image->flipHorizontal(); + positionData.scale.x() = fabs(positionData.scale.x()); + + OSG_INFO<<"addVolume(..) image->flipHorizontal();"<flipVertical(); + positionData.scale.y() = fabs(positionData.scale.y()); + + OSG_INFO<<"addVolume(..) image->flipVertical();"<flipDepth(); + positionData.scale.z() = fabs(positionData.scale.z()); + + OSG_INFO<<"addVolume(..) image->flipDepth();"<