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:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user