Added Options support to ImageSequence LOAD_* functionality

This commit is contained in:
Robert Osfield
2013-01-18 17:11:49 +00:00
parent 5fb8cd6a9c
commit 83f9d0f3e6
4 changed files with 7 additions and 6 deletions

View File

@@ -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 File

@@ -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 File

@@ -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 File

@@ -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)