summaryrefslogtreecommitdiff
path: root/indra/newview/llvocache.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-05-23 18:26:14 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-05-23 18:26:14 -0600
commit774544bc51ce365f7fd37e7d51210f290b546cf2 (patch)
treecf3cf3ab23ddd28402564ec3e32635e3c1e81fdc /indra/newview/llvocache.cpp
parent2cdd6c2749b6553f8081e25e426501acd4025888 (diff)
parent16616ae48d86da75b3809fa6be6c846a9d420603 (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-interesting
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rw-r--r--indra/newview/llvocache.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index b67a6bbacd..1a6ad90a78 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -373,10 +373,11 @@ void LLVOCacheEntry::setBoundingInfo(const LLVector3& pos, const LLVector3& scal
//-------------------------------------------------------------------
LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
{
+ mLODPeriod = 16;
mRegionp = regionp;
mPartitionType = LLViewerRegion::PARTITION_VO_CACHE;
- new LLviewerOctreeGroup(mOctree);
+ new LLOcclusionCullingGroup(mOctree, this);
}
void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry)
@@ -401,11 +402,31 @@ public:
mLocalShift = shift;
}
+ virtual bool earlyFail(LLviewerOctreeGroup* base_group)
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
+ if(group->needsUpdate())
+ {
+ return false; //needs to issue new occlusion culling check.
+ }
+
+ group->checkOcclusion();
+
+ if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
+ LLPipeline::sUseOcclusion && //ignore occlusion if disabled
+ group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
{
- //S32 res = AABBInRegionFrustumGroupBounds(group);
+ S32 res = AABBInRegionFrustumGroupBounds(group);
- S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group);
+ //S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group);
if (res != 0)
{
res = llmin(res, AABBRegionSphereIntersectGroupExtents(group, mLocalShift));
@@ -415,9 +436,9 @@ public:
virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group)
{
- //S32 res = AABBInRegionFrustumObjectBounds(group);
+ S32 res = AABBInRegionFrustumObjectBounds(group);
- S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group);
+ //S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group);
if (res != 0)
{
res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift));
@@ -427,7 +448,15 @@ public:
virtual void processGroup(LLviewerOctreeGroup* base_group)
{
- mRegionp->addVisibleGroup(base_group);
+ 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);
}
private: