From 057f8a8b3bc88d737ac4a6c38a9e94930063ecf9 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 13 Nov 2012 14:22:37 +0000 Subject: [PATCH] Added support for to allow user definition of when to enable OpenGL blending for an image or not. --- include/osgPresentation/SlideShowConstructor | 12 +++++++++++- src/osgPlugins/p3d/ReaderWriterP3D.cpp | 10 ++++++++++ src/osgPresentation/SlideShowConstructor.cpp | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index ed90f05ac..9a6808531 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -246,7 +246,8 @@ public: duration(-1.0), imageSequence(false), imageSequencePagingMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES), - imageSequenceInteractionMode(PLAY_AUTOMATICALLY_LIKE_MOVIE) + imageSequenceInteractionMode(PLAY_AUTOMATICALLY_LIKE_MOVIE), + blendingHint(USE_IMAGE_ALPHA) {} std::string options; @@ -271,7 +272,16 @@ public: USE_MOUSE_Y_POSITION }; ImageSequenceInteractionMode imageSequenceInteractionMode; + + enum BlendingHint + { + USE_IMAGE_ALPHA, + OFF, + ON + }; + BlendingHint blendingHint; + }; struct VolumeData diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 9f0b7ecd6..287976686 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -935,6 +935,16 @@ bool ReaderWriterP3DXML::getProperties(osgDB::XmlNode*cur, osgPresentation::Slid OSG_NOTIFY(_notifyLevel)<<"read imageSequencePagingMode \""<isImageTranslucent(); } + if (imageData.blendingHint==ImageData::ON) + { + isImageTranslucent = true; + } + else if (imageData.blendingHint==ImageData::OFF) + { + isImageTranslucent = false; + } + + float s = image->s(); float t = image->t(); @@ -1274,6 +1284,15 @@ void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, c isImageTranslucent = imageRight->isImageTranslucent(); } + if (imageDataLeft.blendingHint==ImageData::ON || imageDataRight.blendingHint==ImageData::ON) + { + isImageTranslucent = true; + } + else if (imageDataLeft.blendingHint==ImageData::OFF || imageDataRight.blendingHint==ImageData::OFF) + { + isImageTranslucent = false; + } + float s = imageLeft->s(); float t = imageLeft->t();