Added support for new osgVolume::MultiPassTechnique to Present3D. To use add property renderer="MultiPass":

<volume renderer="MultiPass">MyVolumeData</volume>
This commit is contained in:
Robert Osfield 2013-12-17 12:18:06 +00:00
parent 666aa81185
commit 591c5bae42
3 changed files with 43 additions and 3 deletions

View File

@ -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;
};

View File

@ -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)) {}

View File

@ -49,8 +49,10 @@
#include <osgFX/SpecularHighlights>
#include <osgVolume/Volume>
#include <osgVolume/VolumeScene>
#include <osgVolume/RayTracedTechnique>
#include <osgVolume/FixedFunctionTechnique>
#include <osgVolume/MultipassTechnique>
#include <sstream>
#include <algorithm>
@ -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<osgVolume::MultipassTechnique*>(tile->getVolumeTechnique())!=0)
{
if (dynamic_cast<osgVolume::VolumeScene*>(_root.get())==0)
{
osg::ref_ptr<osgVolume::VolumeScene> volumeScene = new osgVolume::VolumeScene;
volumeScene->addChild(_root.get());
_root = volumeScene.get();
}
}
osg::ref_ptr<osg::Node> model = volume.get();