diff --git a/include/osgPresentation/deprecated/SlideShowConstructor b/include/osgPresentation/deprecated/SlideShowConstructor index d5d59555b..ae10b1e5c 100644 --- a/include/osgPresentation/deprecated/SlideShowConstructor +++ b/include/osgPresentation/deprecated/SlideShowConstructor @@ -291,6 +291,13 @@ public: MaximumIntensityProjection }; + enum Technique + { + FixedFunction, + RayTraced, + MultiPass + }; + VolumeData(): shadingModel(Standard), useTabbedDragger(false), @@ -300,7 +307,8 @@ public: cutoffValue("0.1"), sampleDensityValue("0.005"), colorSpaceOperation(osg::NO_COLOR_SPACE_OPERATION), - colorModulate(1.0f,1.0f,1.0f,1.0f) + colorModulate(1.0f,1.0f,1.0f,1.0f), + technique(RayTraced) { } @@ -318,6 +326,7 @@ public: osg::ColorSpaceOperation colorSpaceOperation; osg::Vec4 colorModulate; + Technique technique; }; diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index a9cfaa587..de9cc3f8b 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -1247,6 +1247,14 @@ void ReaderWriterP3DXML::parseVolume(osgPresentation::SlideShowConstructor& cons else if (technique=="light") volumeData.shadingModel = osgPresentation::SlideShowConstructor::VolumeData::Light; } + std::string renderer; + if (getProperty(cur, "renderer", renderer)) + { + if (renderer=="FixedFunction") volumeData.technique = osgPresentation::SlideShowConstructor::VolumeData::FixedFunction; + else if (renderer=="RayTraced") volumeData.technique = osgPresentation::SlideShowConstructor::VolumeData::RayTraced; + else if (renderer=="MultiPass") volumeData.technique = osgPresentation::SlideShowConstructor::VolumeData::MultiPass; + } + if (getProperty(cur, "alpha", volumeData.alphaValue)) {} if (getProperty(cur, "cutoff", volumeData.cutoffValue)) {} if (getProperty(cur, "region", volumeData.region)) {} diff --git a/src/osgPresentation/deprecated/SlideShowConstructor.cpp b/src/osgPresentation/deprecated/SlideShowConstructor.cpp index 2f5c08d31..9a9207aac 100644 --- a/src/osgPresentation/deprecated/SlideShowConstructor.cpp +++ b/src/osgPresentation/deprecated/SlideShowConstructor.cpp @@ -49,8 +49,10 @@ #include #include +#include #include #include +#include #include #include @@ -2660,11 +2662,32 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position } layer->addProperty(sp); - tile->setVolumeTechnique(new osgVolume::RayTracedTechnique); + + switch(volumeData.technique) + { + case(VolumeData::FixedFunction): + tile->setVolumeTechnique(new osgVolume::FixedFunctionTechnique); + break; + case(VolumeData::RayTraced): + tile->setVolumeTechnique(new osgVolume::RayTracedTechnique); + break; + case(VolumeData::MultiPass): + tile->setVolumeTechnique(new osgVolume::MultipassTechnique); + break; + } + tile->addEventCallback(new osgVolume::PropertyAdjustmentCallback()); } - + if (dynamic_cast(tile->getVolumeTechnique())!=0) + { + if (dynamic_cast(_root.get())==0) + { + osg::ref_ptr volumeScene = new osgVolume::VolumeScene; + volumeScene->addChild(_root.get()); + _root = volumeScene.get(); + } + } osg::ref_ptr model = volume.get();