diff --git a/include/osg/CullSettings b/include/osg/CullSettings index 46d0f327b..8da99af6e 100644 --- a/include/osg/CullSettings +++ b/include/osg/CullSettings @@ -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; diff --git a/src/osg/ClusterCullingCallback.cpp b/src/osg/ClusterCullingCallback.cpp index c719d0aef..a0519b0cd 100644 --- a/src/osg/ClusterCullingCallback.cpp +++ b/src/osg/ClusterCullingCallback.cpp @@ -12,6 +12,7 @@ */ #include #include +#include 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(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<