diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-10-30 23:17:40 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-10-30 23:17:40 -0600 |
commit | 960765e8c7d49a48e66f2e55e980c60645d9ca37 (patch) | |
tree | 3f83c3212c4732c1e7acbe634c5e2baf1e32f86c /indra/newview/llvocache.cpp | |
parent | 46c3bf7575a0366c20388d19815a5ee8e01cc0c6 (diff) |
more fix to reduce number of rendered triangles per frame.
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-x | indra/newview/llvocache.cpp | 32 |
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; |