Added support for SampleDensityProperty and TransparencyProperty

This commit is contained in:
Robert Osfield
2009-01-20 13:50:57 +00:00
parent 87cd4530f5
commit d46e0fcc79
12 changed files with 128 additions and 257 deletions

View File

@@ -773,6 +773,7 @@ class FollowMouseCallback : public osgGA::GUIEventHandler, public osg::StateSet:
case(osgGA::GUIEventAdapter::DRAG):
{
float v = (ea.getY()-ea.getYmin())/(ea.getYmax()-ea.getYmin());
float v2 = v*v;
if (_updateAlphaCutOff && cpv._isoProperty.valid())
{
@@ -785,6 +786,18 @@ class FollowMouseCallback : public osgGA::GUIEventHandler, public osg::StateSet:
osg::notify(osg::NOTICE)<<"Setting afProperty to "<<v<<std::endl;
cpv._afProperty->setValue(v);
}
if (_updateTransparency && cpv._transparencyProperty.valid())
{
osg::notify(osg::NOTICE)<<"Setting transparency to "<<v2<<std::endl;
cpv._transparencyProperty->setValue(v2);
}
if (_updateSampleDensity && cpv._sampleDensityProperty.valid())
{
osg::notify(osg::NOTICE)<<"Setting sample density to "<<v2<<std::endl;
cpv._sampleDensityProperty->setValue(v2);
}
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
@@ -1361,6 +1374,9 @@ int main( int argc, char **argv )
break;
}
layer->addProperty(new osgVolume::SampleDensityProperty(0.005));
layer->addProperty(new osgVolume::TransparencyProperty(1.0));
tile->setVolumeTechnique(new osgVolume::ShaderTechnique);
}