diff --git a/examples/osgvolume/osgvolume.cpp b/examples/osgvolume/osgvolume.cpp index 7eb6013a6..498e548c6 100644 --- a/examples/osgvolume/osgvolume.cpp +++ b/examples/osgvolume/osgvolume.cpp @@ -547,6 +547,8 @@ int main( int argc, char **argv ) arguments.getApplicationUsage()->addCommandLineOption("--shift-min-to-zero","Shift the pixel data so min value is 0.0."); arguments.getApplicationUsage()->addCommandLineOption("--sequence-length ","Set the length of time that a sequence of images with run for."); arguments.getApplicationUsage()->addCommandLineOption("--sd ","Short hand for --sequence-length"); + arguments.getApplicationUsage()->addCommandLineOption("--sdwm ","Set the SampleDensityWhenMovingProperty to specified value"); + arguments.getApplicationUsage()->addCommandLineOption("--lod","Enable techniques to reduce the level of detail when moving."); // arguments.getApplicationUsage()->addCommandLineOption("--raw ","read a raw image data"); // construct the viewer. @@ -720,9 +722,14 @@ int main( int argc, char **argv ) while(arguments.read("--gpu-tf")) { gpuTransferFunction = true; } while(arguments.read("--cpu-tf")) { gpuTransferFunction = false; } + double sampleDensityWhenMoving = 0.0; + while(arguments.read("--sdwm", sampleDensityWhenMoving)) {} + + while(arguments.read("--lod")) { sampleDensityWhenMoving = 0.02; } + double sequenceLength = 10.0; while(arguments.read("--sequence-duration", sequenceLength) || - arguments.read("--sd", sequenceLength)) {} + arguments.read("--sd", sequenceLength)) {} typedef std::list< osg::ref_ptr > Images; Images images; @@ -1118,7 +1125,7 @@ int main( int argc, char **argv ) osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(alphaFunc); osgVolume::SampleDensityProperty* sd = new osgVolume::SampleDensityProperty(0.005); - osgVolume::SampleDensityWhenMovingProperty* sdwm = new osgVolume::SampleDensityWhenMovingProperty(0.02); + osgVolume::SampleDensityWhenMovingProperty* sdwm = sampleDensityWhenMoving!=0.0 ? new osgVolume::SampleDensityWhenMovingProperty(sampleDensityWhenMoving) : 0; osgVolume::TransparencyProperty* tp = new osgVolume::TransparencyProperty(1.0); osgVolume::TransferFunctionProperty* tfp = transferFunction.valid() ? new osgVolume::TransferFunctionProperty(transferFunction.get()) : 0; @@ -1127,8 +1134,8 @@ int main( int argc, char **argv ) osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty; cp->addProperty(ap); cp->addProperty(sd); - cp->addProperty(sdwm); cp->addProperty(tp); + if (sdwm) cp->addProperty(sdwm); if (tfp) cp->addProperty(tfp); sp->addProperty(cp); @@ -1141,6 +1148,7 @@ int main( int argc, char **argv ) cp->addProperty(sd); cp->addProperty(tp); cp->addProperty(new osgVolume::LightingProperty); + if (sdwm) cp->addProperty(sdwm); if (tfp) cp->addProperty(tfp); sp->addProperty(cp); @@ -1152,6 +1160,7 @@ int main( int argc, char **argv ) cp->addProperty(sd); cp->addProperty(tp); cp->addProperty(new osgVolume::IsoSurfaceProperty(alphaFunc)); + if (sdwm) cp->addProperty(sdwm); if (tfp) cp->addProperty(tfp); sp->addProperty(cp); @@ -1164,6 +1173,7 @@ int main( int argc, char **argv ) cp->addProperty(sd); cp->addProperty(tp); cp->addProperty(new osgVolume::MaximumIntensityProjectionProperty); + if (sdwm) cp->addProperty(sdwm); if (tfp) cp->addProperty(tfp); sp->addProperty(cp); diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index b94e7766a..5fd82b52a 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -268,7 +268,7 @@ public: alphaValue(1.0), cutoffValue(0.1), sampleDensityValue(0.005), - sampleDensityWhenMovingValue(0.02) + sampleDensityWhenMovingValue(0.0) { region[0] = region[1] = region[2] = 0.0f; region[3] = region[4] = region[5] = 1.0f;