Introduced SampleRatioValueProperty for more intuitive control of how many samples to take when volume rendering

This commit is contained in:
Robert Osfield
2013-12-10 10:43:48 +00:00
parent 499adba97f
commit bc95ea97fb
4 changed files with 73 additions and 12 deletions

View File

@@ -34,6 +34,7 @@ class IsoSurfaceProperty;
class MaximumIntensityProjectionProperty;
class LightingProperty;
class AlphaFuncProperty;
class SampleRatioProperty;
class SampleDensityProperty;
class SampleDensityWhenMovingProperty;
class TransparencyProperty;
@@ -55,6 +56,7 @@ class OSGVOLUME_EXPORT PropertyVisitor
virtual void apply(AlphaFuncProperty&) {}
virtual void apply(MaximumIntensityProjectionProperty&) {}
virtual void apply(LightingProperty&) {}
virtual void apply(SampleRatioProperty&) {}
virtual void apply(SampleDensityProperty&) {}
virtual void apply(SampleDensityWhenMovingProperty&) {}
virtual void apply(TransparencyProperty&) {}
@@ -327,6 +329,25 @@ class OSGVOLUME_EXPORT SampleDensityWhenMovingProperty : public ScalarProperty
virtual ~SampleDensityWhenMovingProperty() {}
};
/** Sample density to use when the volume is static relative to the eye point or when moving if no SampleDensityWhenMovingProperty is assigned.*/
class OSGVOLUME_EXPORT SampleRatioProperty : public ScalarProperty
{
public:
SampleRatioProperty(float value=1.0f);
SampleRatioProperty(const SampleRatioProperty& isp,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgVolume, SampleRatioProperty);
virtual void accept(PropertyVisitor& pv) { pv.apply(*this); }
protected:
virtual ~SampleRatioProperty() {}
};
class OSGVOLUME_EXPORT TransparencyProperty : public ScalarProperty
{
public:
@@ -360,6 +381,7 @@ class OSGVOLUME_EXPORT CollectPropertiesVisitor : public osgVolume::PropertyVisi
virtual void apply(LightingProperty& lp);
virtual void apply(SampleDensityProperty& sdp);
virtual void apply(SampleDensityWhenMovingProperty& sdp);
virtual void apply(SampleRatioProperty& sdp);
virtual void apply(TransparencyProperty& tp);
osg::ref_ptr<TransferFunctionProperty> _tfProperty;
@@ -369,6 +391,7 @@ class OSGVOLUME_EXPORT CollectPropertiesVisitor : public osgVolume::PropertyVisi
osg::ref_ptr<LightingProperty> _lightingProperty;
osg::ref_ptr<SampleDensityProperty> _sampleDensityProperty;
osg::ref_ptr<SampleDensityWhenMovingProperty> _sampleDensityWhenMovingProperty;
osg::ref_ptr<SampleRatioProperty> _sampleRatioProperty;
osg::ref_ptr<TransparencyProperty> _transparencyProperty;
};