summaryrefslogtreecommitdiff
path: root/indra/newview/llvocache.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-05-23 23:21:41 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-05-23 23:21:41 -0600
commitb5f98560c796d62e45ebd0e410254b79958c7f47 (patch)
tree46861e351934cf6bac4f48372a6a123dcd4bf120 /indra/newview/llvocache.cpp
parent774544bc51ce365f7fd37e7d51210f290b546cf2 (diff)
add a debug setting "UseObjectCacheOcclusion" to enable/disable object cache occlusion culling
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rw-r--r--indra/newview/llvocache.cpp50
1 files changed, 30 insertions, 20 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 1a6ad90a78..fdb14aa8d2 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -397,28 +397,33 @@ void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry)
class LLVOCacheOctreeCull : public LLViewerOctreeCull
{
public:
- LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift) : LLViewerOctreeCull(camera), mRegionp(regionp)
+ LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift, bool use_object_cache_occlusion)
+ : LLViewerOctreeCull(camera),
+ mRegionp(regionp)
{
mLocalShift = shift;
+ mUseObjectCacheOcclusion = (use_object_cache_occlusion && LLPipeline::sUseOcclusion);
}
virtual bool earlyFail(LLviewerOctreeGroup* base_group)
{
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
- if(group->needsUpdate())
+ if( mUseObjectCacheOcclusion &&
+ base_group->getOctreeNode()->getParent()) //never occlusion cull the root node
{
- return false; //needs to issue new occlusion culling check.
- }
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
+ if(group->needsUpdate())
+ {
+ return false; //needs to issue new occlusion culling check.
+ }
- group->checkOcclusion();
+ group->checkOcclusion();
- if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
- LLPipeline::sUseOcclusion && //ignore occlusion if disabled
- group->isOcclusionState(LLSpatialGroup::OCCLUDED))
- {
- return true;
+ if (group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ return true;
+ }
}
-
+
return false;
}
@@ -448,24 +453,29 @@ public:
virtual void processGroup(LLviewerOctreeGroup* base_group)
{
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
- if (group->needsUpdate() || group->mVisible[LLViewerCamera::sCurCameraID] < LLDrawable::getCurrentFrame() - 1)
+ if(mUseObjectCacheOcclusion && base_group->getOctreeNode()->getParent())
{
- ((LLOcclusionCullingGroup*)group)->doOcclusion(mCamera);
- group->setVisible();
- return; //wait for occlusion culling results
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
+ if (group->needsUpdate() || group->mVisible[LLViewerCamera::sCurCameraID] < LLDrawable::getCurrentFrame() - 1)
+ {
+ ((LLOcclusionCullingGroup*)group)->doOcclusion(mCamera);
+ group->setVisible();
+ return; //wait for occlusion culling results
+ }
}
-
- mRegionp->addVisibleGroup(group);
+ mRegionp->addVisibleGroup(base_group);
}
private:
LLViewerRegion* mRegionp;
LLVector3 mLocalShift; //shift vector from agent space to local region space.
+ bool mUseObjectCacheOcclusion;
};
S32 LLVOCachePartition::cull(LLCamera &camera)
{
+ static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
+
if(!LLViewerRegion::sVOCacheCullingEnabled)
{
return 0;
@@ -477,7 +487,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera)
LLVector3 region_agent = mRegionp->getOriginAgent();
camera.calcRegionFrustumPlanes(region_agent);
- LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent);
+ LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, use_object_cache_occlusion);
culler.traverse(mOctree);
return 0;