From c39ee015d60c2af15bff0302ab853494e3475184 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 8 Jun 2012 10:26:23 +0000 Subject: [PATCH] Added ImageStream support to and tags in .p3d --- include/osgPresentation/SlideShowConstructor | 2 + src/osgPlugins/p3d/ReaderWriterP3D.cpp | 4 +- src/osgPresentation/SlideShowConstructor.cpp | 49 ++++++++------------ 3 files changed, 23 insertions(+), 32 deletions(-) diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index 04b830cb6..2469150e5 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -397,6 +397,8 @@ public: void addParagraph(const std::string& paragraph, PositionData& positionData, FontData& fontData); + osg::Image* readImage(const std::string& filename, const ImageData& imageData); + void addImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData); void addStereoImagePair(const std::string& filenameLeft, const ImageData& imageDataLeft, const std::string& filenameRight,const ImageData& imageDataRight, const PositionData& positionData); diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 9bb556f7d..7143bd9f0 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -870,13 +870,13 @@ bool ReaderWriterP3DXML::getProperties(osgDB::XmlNode*cur, osgPresentation::Slid if (getProperty(cur, "fps", value.fps)) { propertiesRead = true; - OSG_NOTIFY(osg::NOTICE)<<"read fps \""< options = _options; if (!imageData.options.empty()) @@ -853,16 +852,12 @@ void SlideShowConstructor::addImage(const std::string& filename, const PositionD options->setOptionString(imageData.options); } - - std::string foundFile = filename; osg::ref_ptr image; - osg::ref_ptr volume; - osg::ref_ptr tile; - osg::ref_ptr layer; - osgDB::DirectoryContents filenames; bool preLoad = true; + std::string foundFile = filename; + // check for wild cards if (filename.find('*')!=std::string::npos) { @@ -882,7 +877,7 @@ void SlideShowConstructor::addImage(const std::string& filename, const PositionD if (fileType == osgDB::DIRECTORY) { OSG_INFO<<"Reading directory "< volume; + osg::ref_ptr tile; + osg::ref_ptr layer; + + osg::ref_ptr image = readImage(filename, imageData); if (!image) return; bool isImageTranslucent = false; @@ -1095,26 +1101,9 @@ void SlideShowConstructor::addImage(const std::string& filename, const PositionD void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, const ImageData& imageDataLeft, const std::string& filenameRight, const ImageData& imageDataRight,const PositionData& positionData) { - osg::ref_ptr optionsLeft = _options; - if (!imageDataLeft.options.empty()) - { - optionsLeft = _options->cloneOptions(); - optionsLeft->setOptionString(imageDataLeft.options); - } - - osg::ref_ptr optionsRight = _options; - if (!imageDataRight.options.empty()) - { - optionsRight = _options->cloneOptions(); - optionsRight->setOptionString(imageDataRight.options); - } - - osg::ref_ptr imageLeft = osgDB::readImageFile(filenameLeft, optionsLeft.get()); - if (imageLeft.valid()) recordOptionsFilePath(optionsLeft.get()); - - osg::ref_ptr imageRight = (filenameRight==filenameLeft) ? imageLeft.get() : osgDB::readImageFile(filenameRight, optionsRight.get()); - if (imageRight.valid()) recordOptionsFilePath(optionsRight.get()); - + osg::ref_ptr imageLeft = readImage(filenameLeft, imageDataLeft); + osg::ref_ptr imageRight = (filenameRight==filenameLeft) ? imageLeft.get() : readImage(filenameRight, imageDataRight); + if (!imageLeft && !imageRight) return; bool isImageTranslucent = false;