summaryrefslogtreecommitdiff
path: root/indra/newview/llvocache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-xindra/newview/llvocache.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index b1c7423b49..70b65f14be 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -358,26 +358,34 @@ void LLVOCacheEntry::updateDebugSettings()
sBackAngleTanSquared = squared_back_angle;
}
-bool LLVOCacheEntry::isRecentlyVisible() const
+bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 squared_dist_threshold)
{
- bool vis = LLViewerOctreeEntryData::isRecentlyVisible();
-
- if(!vis && getGroup())
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup();
+ if(!group)
{
- //recently visible to any camera?
- vis = ((LLOcclusionCullingGroup*)getGroup())->isAnyRecentlyVisible();
+ return false;
}
- //combination of projected area and squared distance
- if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared)
+ //any visible
+ bool vis = group->isAnyRecentlyVisible();
+
+ //not ready to remove
+ if(!vis)
{
- F32 rad = getBinRadius();
- vis = (rad * rad / mSceneContrib < sBackDistanceSquared);
+ vis = (group->getAnyVisible() + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame());
}
- if(!vis)
+ //within the back sphere
+ if(!vis && !mParentID)
{
- vis = (getVisible() + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame());
+ LLVector4a lookAt;
+ lookAt.setSub(getPositionGroup(), camera_origin);
+ F32 squared_dist = lookAt.dot3(lookAt).getF32();
+ F32 rad = getBinRadius();
+ rad *= rad;
+
+ //rough estimation
+ vis = (squared_dist - rad < squared_dist_threshold);
}
return vis;