diff --git a/include/osgPresentation/deprecated/SlideShowConstructor b/include/osgPresentation/deprecated/SlideShowConstructor index 5c117a185..df241c797 100644 --- a/include/osgPresentation/deprecated/SlideShowConstructor +++ b/include/osgPresentation/deprecated/SlideShowConstructor @@ -307,6 +307,7 @@ public: alphaValue("1.0"), cutoffValue("0.1"), sampleDensityValue("0.005"), + sampleRatioValue("1.0"), colorSpaceOperation(osg::NO_COLOR_SPACE_OPERATION), colorModulate(1.0f,1.0f,1.0f,1.0f), technique(RayTraced) @@ -325,6 +326,9 @@ public: std::string sampleDensityValue; std::string sampleDensityWhenMovingValue; + std::string sampleRatioValue; + std::string sampleRatioWhenMovingValue; + osg::ColorSpaceOperation colorSpaceOperation; osg::Vec4 colorModulate; Technique technique; diff --git a/src/osgPresentation/deprecated/PickEventHandler.cpp b/src/osgPresentation/deprecated/PickEventHandler.cpp index c7eade70b..2ae814740 100644 --- a/src/osgPresentation/deprecated/PickEventHandler.cpp +++ b/src/osgPresentation/deprecated/PickEventHandler.cpp @@ -87,7 +87,7 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA // std::cout << transformed_x << "/" << transformed_x << " -> " << cloned_ea->getX() << "/" <getY() << std::endl; - SlideEventHandler::instance()->forwardEventToDevices(cloned_ea); + SlideEventHandler::instance()->forwardEventToDevices(cloned_ea.get()); } else { diff --git a/src/osgPresentation/deprecated/SlideEventHandler.cpp b/src/osgPresentation/deprecated/SlideEventHandler.cpp index 6889654a7..a6c9770cc 100644 --- a/src/osgPresentation/deprecated/SlideEventHandler.cpp +++ b/src/osgPresentation/deprecated/SlideEventHandler.cpp @@ -1570,19 +1570,19 @@ void SlideEventHandler::dispatchEvent(const KeyPosition& keyPosition) osg::ref_ptr event = new osgGA::GUIEventAdapter(); event->setKey(keyPosition._key); event->setTime(_viewer->getEventQueue()->getTime()); - + // forward key-down event->setEventType(osgGA::GUIEventAdapter::KEYDOWN); - forwardEventToDevices(event); - + forwardEventToDevices(event.get()); + // forward key-up event->setEventType(osgGA::GUIEventAdapter::KEYUP); - forwardEventToDevices(event); - + forwardEventToDevices(event.get()); + // ignore local event-queue return; } - + osgGA::EventQueue* eq = _viewer->getEventQueue(); // reset the time of the last key press to ensure that the event is disgarded as a key repeat. diff --git a/src/osgPresentation/deprecated/SlideShowConstructor.cpp b/src/osgPresentation/deprecated/SlideShowConstructor.cpp index 82637c9eb..e4ea11718 100644 --- a/src/osgPresentation/deprecated/SlideShowConstructor.cpp +++ b/src/osgPresentation/deprecated/SlideShowConstructor.cpp @@ -2702,37 +2702,50 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position tile->setLayer(layer.get()); - osgVolume::SwitchProperty* sp = new osgVolume::SwitchProperty; + osg::ref_ptr sp = new osgVolume::SwitchProperty; sp->setActiveProperty(0); - osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(0.1f); - setUpVolumeScalarProperty(tile.get(), ap, volumeData.cutoffValue); + osg::ref_ptr ap = new osgVolume::AlphaFuncProperty(0.1f); + setUpVolumeScalarProperty(tile.get(), ap.get(), volumeData.cutoffValue); - osgVolume::TransparencyProperty* tp = new osgVolume::TransparencyProperty(1.0f); - setUpVolumeScalarProperty(tile.get(), tp, volumeData.alphaValue); + osg::ref_ptr tp = new osgVolume::TransparencyProperty(1.0f); + setUpVolumeScalarProperty(tile.get(), tp.get(), volumeData.alphaValue); - osgVolume::SampleDensityProperty* sd = new osgVolume::SampleDensityProperty(0.005); - setUpVolumeScalarProperty(tile.get(), sd, volumeData.sampleDensityValue); + osg::ref_ptr sd = new osgVolume::SampleDensityProperty(0.005); + setUpVolumeScalarProperty(tile.get(), sd.get(), volumeData.sampleDensityValue); - osgVolume::SampleDensityWhenMovingProperty* sdm = 0; + osg::ref_ptr sdm; if (!volumeData.sampleDensityWhenMovingValue.empty()) { sdm = new osgVolume::SampleDensityWhenMovingProperty(0.005); - setUpVolumeScalarProperty(tile.get(), sdm, volumeData.sampleDensityWhenMovingValue); + setUpVolumeScalarProperty(tile.get(), sdm.get(), volumeData.sampleDensityWhenMovingValue); } - osgVolume::TransferFunctionProperty* tfp = volumeData.transferFunction.valid() ? new osgVolume::TransferFunctionProperty(volumeData.transferFunction.get()) : 0; + + osg::ref_ptr sr = new osgVolume::SampleRatioProperty(1.0); + setUpVolumeScalarProperty(tile.get(), sr.get(), volumeData.sampleRatioValue); + + osg::ref_ptr srm; + if (!volumeData.sampleRatioWhenMovingValue.empty()) + { + srm = new osgVolume::SampleRatioWhenMovingProperty(0.5); + setUpVolumeScalarProperty(tile.get(), srm.get(), volumeData.sampleRatioWhenMovingValue); + } + + osg::ref_ptr tfp = volumeData.transferFunction.valid() ? new osgVolume::TransferFunctionProperty(volumeData.transferFunction.get()) : 0; { // Standard osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty; - cp->addProperty(ap); - cp->addProperty(sd); - cp->addProperty(tp); - if (sdm) cp->addProperty(sdm); - if (tfp) cp->addProperty(tfp); + cp->addProperty(ap.get()); + cp->addProperty(tp.get()); + if (sd.valid()) cp->addProperty(sd.get()); + if (sdm.valid()) cp->addProperty(sdm.get()); + if (sr.valid()) cp->addProperty(sr.get()); + if (srm.valid()) cp->addProperty(srm.get()); + if (tfp.valid()) cp->addProperty(tfp.get()); sp->addProperty(cp); } @@ -2740,12 +2753,14 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position { // Light osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty; - cp->addProperty(ap); - cp->addProperty(sd); - cp->addProperty(tp); + cp->addProperty(ap.get()); + cp->addProperty(tp.get()); cp->addProperty(new osgVolume::LightingProperty); - if (sdm) cp->addProperty(sdm); - if (tfp) cp->addProperty(tfp); + if (sd.valid()) cp->addProperty(sd.get()); + if (sdm.valid()) cp->addProperty(sdm.get()); + if (sr.valid()) cp->addProperty(sr.get()); + if (srm.valid()) cp->addProperty(srm.get()); + if (tfp.valid()) cp->addProperty(tfp.get()); sp->addProperty(cp); } @@ -2753,16 +2768,18 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position { // Isosurface osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty; - cp->addProperty(sd); - cp->addProperty(tp); + cp->addProperty(tp.get()); osgVolume::IsoSurfaceProperty* isp = new osgVolume::IsoSurfaceProperty(0.1); setUpVolumeScalarProperty(tile.get(), isp, volumeData.alphaValue); cp->addProperty(isp); - if (sdm) cp->addProperty(sdm); - if (tfp) cp->addProperty(tfp); + if (sd.valid()) cp->addProperty(sd.get()); + if (sdm.valid()) cp->addProperty(sdm.get()); + if (sr.valid()) cp->addProperty(sr.get()); + if (srm.valid()) cp->addProperty(srm.get()); + if (tfp.valid()) cp->addProperty(tfp.get()); sp->addProperty(cp); } @@ -2770,12 +2787,14 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position { // MaximumIntensityProjection osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty; - cp->addProperty(ap); - cp->addProperty(sd); - cp->addProperty(tp); + cp->addProperty(ap.get()); + cp->addProperty(tp.get()); cp->addProperty(new osgVolume::MaximumIntensityProjectionProperty); - if (sdm) cp->addProperty(sdm); - if (tfp) cp->addProperty(tfp); + if (sd.valid()) cp->addProperty(sd.get()); + if (sdm.valid()) cp->addProperty(sdm.get()); + if (sr.valid()) cp->addProperty(sr.get()); + if (srm.valid()) cp->addProperty(srm.get()); + if (tfp.valid()) cp->addProperty(tfp.get()); sp->addProperty(cp); } @@ -2788,7 +2807,7 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position case(VolumeData::MaximumIntensityProjection): sp->setActiveProperty(3); break; } - layer->addProperty(sp); + layer->addProperty(sp.get()); switch(volumeData.technique) { @@ -2816,12 +2835,12 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position } } - if (!volumeData.hull.empty()) +// if (!volumeData.hull.empty()) { osg::ref_ptr hull = osgDB::readNodeFile(volumeData.hull, _options.get()); if (hull.valid()) { - tile->addChild(hull); + tile->addChild(hull.get()); } }