Added _maximumNumberOfActiveOccluders variable to CollectOccludersVisitor(), to

limit the maximum number of occluders used in the cull traversal, default is
now 10.

Added set/getCollectOccluderVisitor() method into SceneView to allow control
of the the settings of the CollectOccluderVisitor.
This commit is contained in:
Robert Osfield
2003-12-11 16:46:45 +00:00
parent 8f41f8a149
commit 5295d68fd3
4 changed files with 48 additions and 15 deletions

View File

@@ -46,10 +46,15 @@ class SG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::C
virtual void apply(osg::LOD& node);
virtual void apply(osg::OccluderNode& node);
/** Set the minimum shadow occluder volume that an active occluder must have.
* volume is units relative the clip space volume where 1.0 is the whole clip space.*/
void setMinimumShadowOccluderVolume(float vol) { _minimumShadowOccluderVolume = vol; }
float getMinimumShadowOccluderVolume() const { return _minimumShadowOccluderVolume; }
/** Set the maximum number of occluders to have active for culling purposes.*/
void setMaximumNumberOfActiveOccluders(unsigned int num) { _maximumNumberOfActiveOccluders = num; }
unsigned int getMaximumNumberOfActiveOccluders() const { return _maximumNumberOfActiveOccluders; }
void setCreateDrawablesOnOccludeNodes(bool flag) { _createDrawables=flag; }
bool getCreateDrawablesOnOccludeNodes() const { return _createDrawables; }
@@ -57,7 +62,9 @@ class SG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::C
ShadowVolumeOccluderSet& getCollectedOccluderSet() { return _occluderSet; }
const ShadowVolumeOccluderSet& getCollectedOccluderSet() const { return _occluderSet; }
/** remove occluded occluders for the collected occluders list.*/
/** remove occluded occluders for the collected occluders list,
* and then discard of all but MaximumNumberOfActiveOccluders of occluders,
* discarding the occluders with the lowests shadow occluder volume .*/
void removeOccludedOccluders();
@@ -84,6 +91,7 @@ class SG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::C
}
float _minimumShadowOccluderVolume;
unsigned _maximumNumberOfActiveOccluders;
bool _createDrawables;
ShadowVolumeOccluderSet _occluderSet;

View File

@@ -19,6 +19,7 @@
#include <osg/Light>
#include <osg/FrameStamp>
#include <osg/DisplaySettings>
#include <osg/CollectOccludersVisitor>
#include <osgUtil/CullVisitor>
@@ -234,6 +235,10 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
void setCullVisitorRight(osgUtil::CullVisitor* cv) { _cullVisitorRight = cv; }
osgUtil::CullVisitor* getCullVisitorRight() { return _cullVisitorRight.get(); }
const osgUtil::CullVisitor* getCullVisitorRight() const { return _cullVisitorRight.get(); }
void setCollectOccludersVisitor(osg::CollectOccludersVisitor* cov) { _collectOccludersVisistor = cov; }
osg::CollectOccludersVisitor* getCollectOccludersVisitor() { return _collectOccludersVisistor.get(); }
const osg::CollectOccludersVisitor* getCollectOccludersVisitor() const { return _collectOccludersVisistor.get(); }
void setRenderGraph(osgUtil::RenderGraph* rg) { _rendergraph = rg; }
@@ -465,8 +470,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
osg::ref_ptr<osgUtil::RenderGraph> _rendergraphRight;
osg::ref_ptr<osgUtil::RenderStage> _renderStageRight;
osg::ref_ptr<osg::CollectOccludersVisitor> _collectOccludersVisistor;
osg::ref_ptr<osg::FrameStamp> _frameStamp;
osg::Vec4 _backgroundColor;
CullVisitor::ComputeNearFarMode _computeNearFar;