Introduced the ability to switch between different visual properties in osgVolume

This commit is contained in:
Robert Osfield
2009-01-21 11:46:03 +00:00
parent f23f2c351f
commit 1c88753551
4 changed files with 324 additions and 39 deletions

View File

@@ -1274,7 +1274,8 @@ int main( int argc, char **argv )
tile->setLayer(layer.get());
tile->setEventCallback(new osgVolume::PropertyAdjustmentCallback());
#if 0
if (useShader)
{
switch(shadingModel)
@@ -1306,7 +1307,49 @@ int main( int argc, char **argv )
layer->addProperty(new osgVolume::AlphaFuncProperty(alphaFunc));
tile->setVolumeTechnique(new osgVolume::FixedFunctionTechnique);
}
#else
osgVolume::SwitchProperty* sp = new osgVolume::SwitchProperty;
sp->setActiveProperty(0);
{
// Standard
osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty;
cp->addProperty(new osgVolume::AlphaFuncProperty(alphaFunc));
sp->addProperty(cp);
}
{
// Light
osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty;
cp->addProperty(new osgVolume::AlphaFuncProperty(alphaFunc));
cp->addProperty(new osgVolume::LightingProperty);
sp->addProperty(cp);
}
{
// Isosurface
osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty;
cp->addProperty(new osgVolume::IsoSurfaceProperty(alphaFunc));
sp->addProperty(cp);
}
{
// MaximumIntensityProjection
osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty;
cp->addProperty(new osgVolume::AlphaFuncProperty(alphaFunc));
cp->addProperty(new osgVolume::MaximumIntensityProjectionProperty);
sp->addProperty(cp);
}
layer->addProperty(sp);
tile->setVolumeTechnique(new osgVolume::ShaderTechnique);
#endif
rootNode = volume.get();
}