Standardised the culling flags between CullingSet and CullStack, and

made ENABLE_ALL_CULLING enable all culling including the near and far plane.
DEFAULT_CULLING is now used for the default as uses the same original
values as ENABLE_ALL_CULLING once did - view frustum culling with near and
far culling. SceneView now uses DEFAULT_CULLING.
This commit is contained in:
Robert Osfield 2003-08-20 12:50:54 +00:00
parent bca7e4e73b
commit 1c3b2b2554
5 changed files with 26 additions and 13 deletions

View File

@ -38,11 +38,17 @@ class SG_EXPORT CullStack
enum CullingModeValues enum CullingModeValues
{ {
NO_CULLING = 0x0, NO_CULLING = 0x0,
VIEW_FRUSTUM_CULLING = 0x1, VIEW_FRUSTUM_SIDES_CULLING = 0x1,
NEAR_PLANE_CULLING = 0x2, NEAR_PLANE_CULLING = 0x2,
FAR_PLANE_CULLING = 0x4, FAR_PLANE_CULLING = 0x4,
VIEW_FRUSTUM_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
NEAR_PLANE_CULLING|
FAR_PLANE_CULLING,
SMALL_FEATURE_CULLING = 0x8, SMALL_FEATURE_CULLING = 0x8,
SHADOW_OCCLUSION_CULLING = 0x10, SHADOW_OCCLUSION_CULLING = 0x10,
DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING,
ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING| ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING|
SMALL_FEATURE_CULLING| SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING SHADOW_OCCLUSION_CULLING

View File

@ -50,10 +50,21 @@ class SG_EXPORT CullingSet : public Referenced
enum MaskValues enum MaskValues
{ {
VIEW_FRUSTUM_CULLING = 0x1, NO_CULLING = 0x0,
SMALL_FEATURE_CULLING = 0x2, VIEW_FRUSTUM_SIDES_CULLING = 0x1,
SHADOW_OCCLUSION_CULLING = 0x4, NEAR_PLANE_CULLING = 0x2,
ALL_CULLING = 0xffffffff FAR_PLANE_CULLING = 0x4,
VIEW_FRUSTUM_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
NEAR_PLANE_CULLING|
FAR_PLANE_CULLING,
SMALL_FEATURE_CULLING = 0x8,
SHADOW_OCCLUSION_CULLING = 0x10,
DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING|
SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING,
ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING|
SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING
}; };
void setCullingMask(Mask mask) { _mask = mask; } void setCullingMask(Mask mask) { _mask = mask; }

View File

@ -17,7 +17,7 @@ using namespace osg;
CullStack::CullStack() CullStack::CullStack()
{ {
_cullingMode = ENABLE_ALL_CULLING; _cullingMode = DEFAULT_CULLING;
_LODScale = 1.0f; _LODScale = 1.0f;
_smallFeatureCullingPixelSize = 2.0f; _smallFeatureCullingPixelSize = 2.0f;
_frustumVolume=-1.0f; _frustumVolume=-1.0f;
@ -151,11 +151,7 @@ void CullStack::pushProjectionMatrix(RefMatrix* matrix)
cullingSet->getFrustum().transformProvidingInverse(*matrix); cullingSet->getFrustum().transformProvidingInverse(*matrix);
// set the culling mask ( There should be a more elegant way!) Nikolaus H. // set the culling mask ( There should be a more elegant way!) Nikolaus H.
osg::CullingSet::Mask mask = 0; cullingSet->setCullingMask(_cullingMode);
if( _cullingMode&VIEW_FRUSTUM_CULLING) mask |= osg::CullingSet::VIEW_FRUSTUM_CULLING;
if( _cullingMode&SMALL_FEATURE_CULLING) mask |= osg::CullingSet::SMALL_FEATURE_CULLING;
if( _cullingMode&SHADOW_OCCLUSION_CULLING) mask |= osg::CullingSet::SHADOW_OCCLUSION_CULLING;
cullingSet->setCullingMask(mask);
// set the small feature culling. // set the small feature culling.
cullingSet->setSmallFeatureCullingPixelSize(_smallFeatureCullingPixelSize); cullingSet->setSmallFeatureCullingPixelSize(_smallFeatureCullingPixelSize);

View File

@ -16,7 +16,7 @@ using namespace osg;
CullingSet::CullingSet() CullingSet::CullingSet()
{ {
_mask = ALL_CULLING; _mask = ENABLE_ALL_CULLING;
_pixelSizeVector.set(0,0,0,1); _pixelSizeVector.set(0,0,0,1);
_smallFeatureCullingPixelSize=1.0f; _smallFeatureCullingPixelSize=1.0f;
} }

View File

@ -38,7 +38,7 @@ SceneView::SceneView(DisplaySettings* ds)
_computeNearFar = CullVisitor::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES; _computeNearFar = CullVisitor::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES;
_cullingMode = osg::CullStack::ENABLE_ALL_CULLING; _cullingMode = osg::CullStack::DEFAULT_CULLING;
_LODScale = 1.0f; _LODScale = 1.0f;
_smallFeatureCullingPixelSize = 3.0f; _smallFeatureCullingPixelSize = 3.0f;