用于控制体积渲染器在相机移动时所采样的比率的属性类。
#include <osg/Node>
#include <osgVolume/RayCastingTexture3D>
#include <osgVolume/SampleRatioWhenMovingProperty>
osg::ref_ptr<osgVolume::RayCastingTexture3D> texture = new osgVolume::RayCastingTexture3D;
osg::ref_ptr<osgVolume::SampleRatioWhenMovingProperty> sampleRatio =
dynamic_cast<osgVolume::SampleRatioWhenMovingProperty*>(texture->getOrCreateProperty(osgVolume::SampleRatioWhenMoving));
sampleRatio->setMinimumRatio(0.1f);
sampleRatio->setMaximumRatio(0.5f);
sampleRatio->setThresholdMovementSpeed(10.0f);
SampleRatioWhenMovingProperty()
SampleRatioWhenMovingProperty(const SampleRatioWhenMovingProperty &rhs,const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
rhs
: 要拷贝的对象。copyop
: 拷贝操作标志,决定如何拷贝对象。virtual bool isSameKindAs(const osg::Object *obj)const
obj
: 待比较的对象。true
,否则返回 false
。virtual const char *className()const
virtual const char *libraryName()const
void setMinimumRatio(float ratio)
ratio
: 采样率的下界值范围为 [0,1]
。float getMinimumRatio()const
[0,1]
。void setMaximumRatio(float ratio)
ratio
: 采样率的上界值,范围为 [0,1]
。float getMaximumRatio()const
[0,1]
。void setThresholdMovementSpeed(float speed)
speed
: 相机移动速度的阈值。float getThresholdMovementSpeed()const