From 7201ce1960594414b0238ebb97340bc0bb973861 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Sep 2009 10:54:08 +0000 Subject: [PATCH] Updated volume setup code to use the new ImageDetails structure. --- src/osgPresentation/SlideShowConstructor.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 854b1a869..bcaf7117e 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -1537,6 +1537,8 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position if (!image) return; + osg::ref_ptr details = dynamic_cast(image->getUserData()); + osg::ref_ptr matrix = details ? details->getMatrix() : dynamic_cast(image->getUserData()); osg::ref_ptr volume = new osgVolume::Volume; osg::ref_ptr tile = new osgVolume::VolumeTile; @@ -1544,9 +1546,13 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position osg::ref_ptr layer = new osgVolume::ImageLayer(image.get()); layer->rescaleToZeroToOneRange(); + if (details) + { + layer->setTexelOffset(details->getTexelOffset()); + layer->setTexelScale(details->getTexelScale()); + } - osg::RefMatrix* matrix = dynamic_cast(image->getUserData()); - if (matrix) + if (matrix.valid()) { layer->setLocator(new osgVolume::Locator(*matrix)); osg::Matrix tm = osg::Matrix::scale(volumeData.region[3]-volumeData.region[0], volumeData.region[4]-volumeData.region[1], volumeData.region[5]-volumeData.region[2]) * @@ -1554,6 +1560,7 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position tile->setLocator(new osgVolume::Locator(tm * (*matrix))); } + tile->setLayer(layer.get()); osgVolume::SwitchProperty* sp = new osgVolume::SwitchProperty;