Added support for osgVolue::SampleRatioProperty. Fixed build errors when compiling with ref_ptr<> automatic type conversion.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -87,7 +87,7 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
||||
|
||||
// std::cout << transformed_x << "/" << transformed_x << " -> " << cloned_ea->getX() << "/" <<cloned_ea->getY() << std::endl;
|
||||
|
||||
SlideEventHandler::instance()->forwardEventToDevices(cloned_ea);
|
||||
SlideEventHandler::instance()->forwardEventToDevices(cloned_ea.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1570,19 +1570,19 @@ void SlideEventHandler::dispatchEvent(const KeyPosition& keyPosition)
|
||||
osg::ref_ptr<osgGA::GUIEventAdapter> 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.
|
||||
|
||||
@@ -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<osgVolume::SwitchProperty> sp = new osgVolume::SwitchProperty;
|
||||
sp->setActiveProperty(0);
|
||||
|
||||
|
||||
|
||||
osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(0.1f);
|
||||
setUpVolumeScalarProperty(tile.get(), ap, volumeData.cutoffValue);
|
||||
osg::ref_ptr<osgVolume::AlphaFuncProperty> 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<osgVolume::TransparencyProperty> 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<osgVolume::SampleDensityProperty> sd = new osgVolume::SampleDensityProperty(0.005);
|
||||
setUpVolumeScalarProperty(tile.get(), sd.get(), volumeData.sampleDensityValue);
|
||||
|
||||
osgVolume::SampleDensityWhenMovingProperty* sdm = 0;
|
||||
osg::ref_ptr<osgVolume::SampleDensityWhenMovingProperty> 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<osgVolume::SampleRatioProperty> sr = new osgVolume::SampleRatioProperty(1.0);
|
||||
setUpVolumeScalarProperty(tile.get(), sr.get(), volumeData.sampleRatioValue);
|
||||
|
||||
osg::ref_ptr<osgVolume::SampleRatioWhenMovingProperty> srm;
|
||||
if (!volumeData.sampleRatioWhenMovingValue.empty())
|
||||
{
|
||||
srm = new osgVolume::SampleRatioWhenMovingProperty(0.5);
|
||||
setUpVolumeScalarProperty(tile.get(), srm.get(), volumeData.sampleRatioWhenMovingValue);
|
||||
}
|
||||
|
||||
osg::ref_ptr<osgVolume::TransferFunctionProperty> 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<osg::Node> hull = osgDB::readNodeFile(volumeData.hull, _options.get());
|
||||
if (hull.valid())
|
||||
{
|
||||
tile->addChild(hull);
|
||||
tile->addChild(hull.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user