Permalink
Browse files

Added Options support to ImageSequence LOAD_* functionality

  • Loading branch information...
1 parent 89b7e93 commit 3d1cb38f068e4aea58aa827496b814c25d9a9419 @osg-training-guest osg-training-guest committed Jan 18, 2013
Showing with 7 additions and 6 deletions.
  1. +1 −1 include/osg/NodeVisitor
  2. +1 −1 include/osgDB/ImagePager
  3. +2 −2 src/osg/ImageSequence.cpp
  4. +3 −2 src/osgDB/ImagePager.cpp
View
2 include/osg/NodeVisitor
@@ -306,7 +306,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
virtual double getPreLoadTime() const = 0;
- virtual osg::Image* readImageFile(const std::string& fileName) = 0;
+ virtual osg::Image* readImageFile(const std::string& fileName, const osg::Referenced* options=0) = 0;
virtual void requestImageFile(const std::string& fileName,osg::Object* attachmentPoint, int attachmentIndex, double timeToMergeBy, const FrameStamp* framestamp, osg::ref_ptr<osg::Referenced>& imageRequest, const osg::Referenced* options=0) = 0;
View
2 include/osgDB/ImagePager
@@ -78,7 +78,7 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler
void setPreLoadTime(double preLoadTime) { _preLoadTime=preLoadTime; }
virtual double getPreLoadTime() const { return _preLoadTime; }
- virtual osg::Image* readImageFile(const std::string& fileName);
+ virtual osg::Image* readImageFile(const std::string& fileName, const osg::Referenced* options=0);
virtual void requestImageFile(const std::string& fileName, osg::Object* attachmentPoint, int attachmentIndex, double timeToMergeBy, const osg::FrameStamp* framestamp, osg::ref_ptr<osg::Referenced>& imageRequest, const osg::Referenced* options);
View
4 src/osg/ImageSequence.cpp
@@ -313,7 +313,7 @@ void ImageSequence::update(osg::NodeVisitor* nv)
{
if (!(itr->_image) && !(itr->_filename.empty()))
{
- itr->_image = irh->readImageFile(itr->_filename);
+ itr->_image = irh->readImageFile(itr->_filename, _readOptions.get());
}
}
}
@@ -368,7 +368,7 @@ void ImageSequence::update(osg::NodeVisitor* nv)
if (loadDirectly)
{
OSG_NOTICE<<"Reading file, entry="<<i<<" : _fileNames[i]="<<_imageDataList[i]._filename<<std::endl;
- osg::ref_ptr<osg::Image> image = irh->readImageFile(_imageDataList[i]._filename); // TODO, need _readOptions object.
+ osg::ref_ptr<osg::Image> image = irh->readImageFile(_imageDataList[i]._filename, _readOptions.get());
if (image.valid())
{
OSG_NOTICE<<" Assigning image "<<_imageDataList[i]._filename<<std::endl;
View
5 src/osgDB/ImagePager.cpp
@@ -323,9 +323,10 @@ int ImagePager::cancel()
return result;
}
-osg::Image* ImagePager::readImageFile(const std::string& fileName)
+osg::Image* ImagePager::readImageFile(const std::string& fileName, const osg::Referenced* options)
{
- return osgDB::readImageFile(fileName);
+ osgDB::Options* readOptions = dynamic_cast<osgDB::Options*>(const_cast<osg::Referenced*>(options));
+ return osgDB::readImageFile(fileName, readOptions);
}
void ImagePager::requestImageFile(const std::string& fileName, osg::Object* attachmentPoint, int attachmentIndex, double timeToMergeBy, const osg::FrameStamp* framestamp, osg::ref_ptr<osg::Referenced>& imageRequest, const osg::Referenced* options)

0 comments on commit 3d1cb38

Please sign in to comment.