Improved handling of VolumeSettings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14427 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
2f10db8f11
commit
d97081fe7f
@ -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
|
||||
{
|
||||
|
@ -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<int>(vs.getShadingModel())+_delta;
|
||||
if (newValue<0) newValue = VolumeSettings::MaximumIntensityProjection;
|
||||
else if (newValue>VolumeSettings::MaximumIntensityProjection) newValue = 0;
|
||||
vs.setShadingModel(static_cast<VolumeSettings::ShadingModel>(newValue));
|
||||
OSG_NOTICE<<"CycleSwitchVisitor::apply(VolumeSettings&) "<<newValue<<std::endl;
|
||||
|
||||
_switchModified = true;
|
||||
|
||||
PropertyVisitor::apply(vs);
|
||||
}
|
||||
|
||||
virtual void apply(SwitchProperty& sp)
|
||||
{
|
||||
if (sp.getNumProperties()>=2)
|
||||
if (sp.getNumProperties()>1)
|
||||
{
|
||||
if (_delta>0)
|
||||
{
|
||||
int newValue = sp.getActiveProperty()+_delta;
|
||||
if (newValue<static_cast<int>(sp.getNumProperties()))
|
||||
{
|
||||
sp.setActiveProperty(newValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
sp.setActiveProperty(0);
|
||||
}
|
||||
int newValue = static_cast<int>(sp.getActiveProperty())+_delta;
|
||||
if (newValue >= static_cast<int>(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&) "<<newValue<<std::endl;
|
||||
|
||||
_switchModified = true;
|
||||
}
|
||||
|
||||
PropertyVisitor::apply(sp);
|
||||
|
Loading…
Reference in New Issue
Block a user