Added SampleRatioWhenMoving property and support to new osgVolume::MultipassTechnique.

This commit is contained in:
Robert Osfield
2013-12-12 09:53:24 +00:00
parent a5c0127a6e
commit 939aa38a2a
8 changed files with 110 additions and 40 deletions

View File

@@ -207,6 +207,20 @@ SampleRatioProperty::SampleRatioProperty(const SampleRatioProperty& srp,const os
{
}
/////////////////////////////////////////////////////////////////////////////
//
// SampleRatioWhenMovingProperty
//
SampleRatioWhenMovingProperty::SampleRatioWhenMovingProperty(float value):
ScalarProperty("SampleRatioValue",value)
{
}
SampleRatioWhenMovingProperty::SampleRatioWhenMovingProperty(const SampleRatioWhenMovingProperty& isp,const osg::CopyOp& copyop):
ScalarProperty(isp, copyop)
{
}
/////////////////////////////////////////////////////////////////////////////
@@ -278,6 +292,7 @@ void CollectPropertiesVisitor::apply(LightingProperty& lp) { _lightingProperty =
void CollectPropertiesVisitor::apply(SampleDensityProperty& sdp) { _sampleDensityProperty = &sdp; }
void CollectPropertiesVisitor::apply(SampleDensityWhenMovingProperty& sdp) { _sampleDensityWhenMovingProperty = &sdp; }
void CollectPropertiesVisitor::apply(SampleRatioProperty& srp) { _sampleRatioProperty = &srp; }
void CollectPropertiesVisitor::apply(SampleRatioWhenMovingProperty& srp) { _sampleRatioWhenMovingProperty = &srp; }
void CollectPropertiesVisitor::apply(TransparencyProperty& tp) { _transparencyProperty = &tp; }
@@ -449,6 +464,13 @@ bool PropertyAdjustmentCallback::handle(const osgGA::GUIEventAdapter& ea,osgGA::
OSG_NOTICE<<"Setting sample ratio to "<<sampleRatio<<std::endl;
cpv._sampleRatioProperty->setValue(sampleRatio);
}
if (_updateSampleDensity && cpv._sampleRatioWhenMovingProperty.valid())
{
float sampleRatio = v2*4;
OSG_NOTICE<<"Setting sample ratio to "<<sampleRatio<<std::endl;
cpv._sampleRatioWhenMovingProperty->setValue(sampleRatio);
}
}