Added CLUSTER_CULLING mask to CullSettings, and modified the ClusterCullingCallback

to use the mask to see if cluster culling is enabled or disabled.
This commit is contained in:
Robert Osfield
2004-07-11 21:46:23 +00:00
parent c7647b98b8
commit 363d13d7ce
2 changed files with 14 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ class SG_EXPORT CullSettings
CullSettings(const CullSettings& cs);
~CullSettings() {}
virtual ~CullSettings() {}
CullSettings& operator = (const CullSettings& settings)
{
@@ -117,12 +117,15 @@ class SG_EXPORT CullSettings
FAR_PLANE_CULLING,
SMALL_FEATURE_CULLING = 0x8,
SHADOW_OCCLUSION_CULLING = 0x10,
CLUSTER_CULLING = 0x20,
DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING,
SHADOW_OCCLUSION_CULLING|
CLUSTER_CULLING,
ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING|
SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING
SHADOW_OCCLUSION_CULLING|
CLUSTER_CULLING
};
typedef unsigned int CullingMode;

View File

@@ -12,6 +12,7 @@
*/
#include <osg/ClusterCullingCallback>
#include <osg/TriangleFunctor>
#include <osg/CullSettings>
using namespace osg;
@@ -145,11 +146,16 @@ void ClusterCullingCallback::set(const osg::Vec3& controlPoint, const osg::Vec3&
bool ClusterCullingCallback::cull(osg::NodeVisitor* nv, osg::Drawable* , osg::State*) const
{
// return false;
CullSettings* cs = dynamic_cast<CullSettings*>(nv);
if (cs && !(cs->getCullingMode() & CullSettings::CLUSTER_CULLING))
{
// cluster culling switched off cull settings.
return false;
}
if (_deviation<=-1.0f)
{
// osg::notify(osg::NOTICE)<<"ClusterCullingCallback::cull() _deviation="<<_deviation<<std::endl;
// cluster culling switch off by deviation.
return false;
}