Added setting of the IsoSurfaceProperty in VolumeSettings

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14436 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-09-03 15:54:47 +00:00
parent 4f6dbf5623
commit 21fc2fae8d
4 changed files with 40 additions and 15 deletions

View File

@@ -2927,7 +2927,7 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position
{
// Isosurface
osgVolume::IsoSurfaceProperty* isp = new osgVolume::IsoSurfaceProperty(0.1);
osgVolume::IsoSurfaceProperty* isp = vs.valid() ? vs->getIsoSurfaceProperty() : new osgVolume::IsoSurfaceProperty(0.1);
setUpVolumeScalarProperty(tile.get(), isp, volumeData.alphaValue);
sp->addProperty(isp);

View File

@@ -21,7 +21,8 @@ VolumeSettings::VolumeSettings():
_sampleRatioProperty(new SampleRatioProperty(1.0f)),
_sampleRatioWhenMovingProperty(new SampleRatioWhenMovingProperty(1.0f)),
_cutoffProperty(new AlphaFuncProperty(0.0f)),
_transparencyProperty(new TransparencyProperty(1.0f))
_transparencyProperty(new TransparencyProperty(1.0f)),
_isoSurfaceProperty(new IsoSurfaceProperty(0.0f))
{
}
@@ -33,7 +34,8 @@ VolumeSettings::VolumeSettings(const VolumeSettings& vs,const osg::CopyOp& copyo
_sampleRatioProperty(osg::clone(vs._sampleRatioProperty.get(), copyop)),
_sampleRatioWhenMovingProperty(osg::clone(vs._sampleRatioWhenMovingProperty.get(), copyop)),
_cutoffProperty(osg::clone(vs._cutoffProperty.get(), copyop)),
_transparencyProperty(osg::clone(vs._transparencyProperty.get(), copyop))
_transparencyProperty(osg::clone(vs._transparencyProperty.get(), copyop)),
_isoSurfaceProperty(osg::clone(vs._isoSurfaceProperty.get(), copyop))
{
}
@@ -44,8 +46,21 @@ void VolumeSettings::accept(PropertyVisitor& pv)
void VolumeSettings::traverse(PropertyVisitor& pv)
{
_sampleRatioProperty->accept(pv);
_sampleRatioWhenMovingProperty->accept(pv);
_cutoffProperty->accept(pv);
_transparencyProperty->accept(pv);
if (_sampleRatioProperty.valid()) _sampleRatioProperty->accept(pv);
if (_sampleRatioWhenMovingProperty.valid()) _sampleRatioWhenMovingProperty->accept(pv);
if (_cutoffProperty.valid()) _cutoffProperty->accept(pv);
if (_transparencyProperty.valid()) _transparencyProperty->accept(pv);
if (_isoSurfaceProperty.valid() && _shadingModel==Isosurface) _isoSurfaceProperty->accept(pv);
}
void VolumeSettings::setCutoff(float co)
{
_cutoffProperty->setValue(co);
if (_isoSurfaceProperty.valid())
{
OSG_NOTICE<<"Setting IsoSurface value to "<<co<<std::endl;
_isoSurfaceProperty->setValue(co);
}
dirty();
}

View File

@@ -33,6 +33,7 @@ REGISTER_OBJECT_WRAPPER( osgVolume_VolumeSettings,
ADD_OBJECT_SERIALIZER_NO_SET( SampleRatioWhenMovingProperty, osgVolume::SampleRatioWhenMovingProperty, NULL );
ADD_OBJECT_SERIALIZER_NO_SET( CutoffProperty, osgVolume::AlphaFuncProperty, NULL );
ADD_OBJECT_SERIALIZER_NO_SET( TransparencyProperty, osgVolume::TransparencyProperty, NULL );
ADD_OBJECT_SERIALIZER_NO_SET( IsoSurfaceProperty, osgVolume::IsoSurfaceProperty, NULL );
}