Added support for new SampleDensityWhenMovingProperty into .p3d format, with it default to 0.02.

One can override this value via the sampleDensityWhenMoving="value" property in the volume tag, i.e.

         <volume sampleDensityWhenMoving="0.01">CardiacCT</volume>

To switch the feature off set the value to 0, i.e.

         <volume sampleDensityWhenMoving="0">CardiacCT</volume>
This commit is contained in:
Robert Osfield
2011-03-17 17:33:02 +00:00
parent 89eadcfe82
commit 6b67320190
3 changed files with 6 additions and 1 deletions

View File

@@ -1004,6 +1004,7 @@ void ReaderWriterP3DXML::parseVolume(osgPresentation::SlideShowConstructor& cons
if (getProperty(cur, "cutoff", volumeData.cutoffValue)) {}
if (getProperty(cur, "region", 6, volumeData.region)) {}
if (getProperty(cur, "sampleDensity", volumeData.sampleDensityValue)) {}
if (getProperty(cur, "sampleDensityWhenMoving", volumeData.sampleDensityWhenMovingValue)) {}
// check for any transfer function required
std::string transferFunctionFile;

View File

@@ -1811,6 +1811,7 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position
osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(volumeData.cutoffValue);
osgVolume::TransparencyProperty* tp = new osgVolume::TransparencyProperty(volumeData.alphaValue);
osgVolume::SampleDensityProperty* sd = new osgVolume::SampleDensityProperty(volumeData.sampleDensityValue);
osgVolume::SampleDensityWhenMovingProperty* sdm = (volumeData.sampleDensityWhenMovingValue > 0.0f) ? (new osgVolume::SampleDensityWhenMovingProperty(volumeData.sampleDensityWhenMovingValue)) : 0;
osgVolume::TransferFunctionProperty* tfp = volumeData.transferFunction.valid() ? new osgVolume::TransferFunctionProperty(volumeData.transferFunction.get()) : 0;
{
@@ -1819,6 +1820,7 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position
cp->addProperty(ap);
cp->addProperty(sd);
cp->addProperty(tp);
if (sdm) cp->addProperty(sdm);
if (tfp) cp->addProperty(tfp);
sp->addProperty(cp);