diff --git a/src/osgPresentation/deprecated/SlideShowConstructor.cpp b/src/osgPresentation/deprecated/SlideShowConstructor.cpp index d2c8e58f1..ff17ebbd1 100644 --- a/src/osgPresentation/deprecated/SlideShowConstructor.cpp +++ b/src/osgPresentation/deprecated/SlideShowConstructor.cpp @@ -2938,12 +2938,19 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position sp->addProperty(new osgVolume::MaximumIntensityProjectionProperty); } - switch(volumeData.shadingModel) + if (volumeData.volumeSettings.valid()) { - case(osgVolume::VolumeSettings::Standard): sp->setActiveProperty(0); break; - case(osgVolume::VolumeSettings::Light): sp->setActiveProperty(1); break; - case(osgVolume::VolumeSettings::Isosurface): sp->setActiveProperty(2); break; - case(osgVolume::VolumeSettings::MaximumIntensityProjection): sp->setActiveProperty(3); break; + sp->setActiveProperty(volumeData.volumeSettings->getShadingModel()); + } + else + { + switch(volumeData.shadingModel) + { + case(osgVolume::VolumeSettings::Standard): sp->setActiveProperty(0); break; + case(osgVolume::VolumeSettings::Light): sp->setActiveProperty(1); break; + case(osgVolume::VolumeSettings::Isosurface): sp->setActiveProperty(2); break; + case(osgVolume::VolumeSettings::MaximumIntensityProjection): sp->setActiveProperty(3); break; + } } #else { diff --git a/src/osgVolume/Property.cpp b/src/osgVolume/Property.cpp index f4cbc0949..ba101bfbc 100644 --- a/src/osgVolume/Property.cpp +++ b/src/osgVolume/Property.cpp @@ -314,40 +314,34 @@ class CycleSwitchVisitor : public osgVolume::PropertyVisitor CycleSwitchVisitor(int delta): PropertyVisitor(false), _delta(delta), - _switchModified(true) {} + _switchModified(false) {} + + virtual void apply(VolumeSettings& vs) + { + int newValue = static_cast(vs.getShadingModel())+_delta; + if (newValue<0) newValue = VolumeSettings::MaximumIntensityProjection; + else if (newValue>VolumeSettings::MaximumIntensityProjection) newValue = 0; + vs.setShadingModel(static_cast(newValue)); + OSG_NOTICE<<"CycleSwitchVisitor::apply(VolumeSettings&) "<=2) + if (sp.getNumProperties()>1) { - if (_delta>0) - { - int newValue = sp.getActiveProperty()+_delta; - if (newValue(sp.getNumProperties())) - { - sp.setActiveProperty(newValue); - } - else - { - sp.setActiveProperty(0); - } + int newValue = static_cast(sp.getActiveProperty())+_delta; + if (newValue >= static_cast(sp.getNumProperties())) newValue = 0; + if (newValue < 0) newValue = sp.getNumProperties()-1; - _switchModified = true; - } - else // _delta<0 - { - int newValue = sp.getActiveProperty()+_delta; - if (newValue>=0) - { - sp.setActiveProperty(newValue); - } - else - { - sp.setActiveProperty(sp.getNumProperties()-1); - } + sp.setActiveProperty(newValue); - _switchModified = true; - } + OSG_NOTICE<<"CycleSwitchVisitor::apply(SwitchProperty&) "<