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

@@ -35,6 +35,7 @@ class MaximumIntensityProjectionProperty;
class LightingProperty;
class AlphaFuncProperty;
class SampleRatioProperty;
class SampleRatioWhenMovingProperty;
class SampleDensityProperty;
class SampleDensityWhenMovingProperty;
class TransparencyProperty;
@@ -57,6 +58,7 @@ class OSGVOLUME_EXPORT PropertyVisitor
virtual void apply(MaximumIntensityProjectionProperty&) {}
virtual void apply(LightingProperty&) {}
virtual void apply(SampleRatioProperty&) {}
virtual void apply(SampleRatioWhenMovingProperty&) {}
virtual void apply(SampleDensityProperty&) {}
virtual void apply(SampleDensityWhenMovingProperty&) {}
virtual void apply(TransparencyProperty&) {}
@@ -329,7 +331,7 @@ 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.*/
/** Sample ratioto use when the volume is static relative to the eye point or when moving if no SampleRatioWhenMovingProperty is assigned.*/
class OSGVOLUME_EXPORT SampleRatioProperty : public ScalarProperty
{
public:
@@ -347,6 +349,24 @@ class OSGVOLUME_EXPORT SampleRatioProperty : public ScalarProperty
virtual ~SampleRatioProperty() {}
};
/** Sample density to use when the volume is moving relative to the eye point.*/
class OSGVOLUME_EXPORT SampleRatioWhenMovingProperty : public ScalarProperty
{
public:
SampleRatioWhenMovingProperty(float value=1.0f);
SampleRatioWhenMovingProperty(const SampleRatioWhenMovingProperty& isp,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgVolume, SampleRatioWhenMovingProperty);
virtual void accept(PropertyVisitor& pv) { pv.apply(*this); }
protected:
virtual ~SampleRatioWhenMovingProperty() {}
};
class OSGVOLUME_EXPORT TransparencyProperty : public ScalarProperty
{
@@ -382,6 +402,7 @@ class OSGVOLUME_EXPORT CollectPropertiesVisitor : public osgVolume::PropertyVisi
virtual void apply(SampleDensityProperty& sdp);
virtual void apply(SampleDensityWhenMovingProperty& sdp);
virtual void apply(SampleRatioProperty& sdp);
virtual void apply(SampleRatioWhenMovingProperty& sdp);
virtual void apply(TransparencyProperty& tp);
osg::ref_ptr<TransferFunctionProperty> _tfProperty;
@@ -392,6 +413,7 @@ class OSGVOLUME_EXPORT CollectPropertiesVisitor : public osgVolume::PropertyVisi
osg::ref_ptr<SampleDensityProperty> _sampleDensityProperty;
osg::ref_ptr<SampleDensityWhenMovingProperty> _sampleDensityWhenMovingProperty;
osg::ref_ptr<SampleRatioProperty> _sampleRatioProperty;
osg::ref_ptr<SampleRatioWhenMovingProperty> _sampleRatioWhenMovingProperty;
osg::ref_ptr<TransparencyProperty> _transparencyProperty;
};

View File

@@ -47,11 +47,6 @@ class OSGVOLUME_EXPORT RayTracedTechnique : public VolumeTechnique
osg::ref_ptr<osg::MatrixTransform> _transform;
typedef std::map<osgUtil::CullVisitor::Identifier*, osg::Matrix> ModelViewMatrixMap;
OpenThreads::Mutex _mutex;
ModelViewMatrixMap _modelViewMatrixMap;
osg::ref_ptr<osg::StateSet> _whenMovingStateSet;
};

View File

@@ -43,6 +43,8 @@ class OSGVOLUME_EXPORT VolumeTechnique : public osg::Object
virtual void update(osgUtil::UpdateVisitor* nv);
virtual bool isMoving(osgUtil::CullVisitor* nv);
virtual void cull(osgUtil::CullVisitor* nv);
/** Clean scene graph from any terrain technique specific nodes.*/
@@ -61,6 +63,9 @@ class OSGVOLUME_EXPORT VolumeTechnique : public osg::Object
VolumeTile* _volumeTile;
typedef std::map<osgUtil::CullVisitor::Identifier*, osg::Matrix> ModelViewMatrixMap;
OpenThreads::Mutex _mutex;
ModelViewMatrixMap _modelViewMatrixMap;
};
}