diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-08-22 12:22:34 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-08-22 12:22:34 -0600 |
commit | 7b5618aeaeb4df31bd3f9436e067b26fb5be866b (patch) | |
tree | 83590056d4323de0a8e930ed0fc1f0b1b9d72f44 /indra/newview/llvocache.cpp | |
parent | ea37dd4acc8687ae28902b8a5f7d0841314c4849 (diff) |
fix for SH-4400: Interesting: Side effect 1 of unloading culled objects.
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-x | indra/newview/llvocache.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 3bd71e2648..2430fa556a 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -238,12 +238,6 @@ void LLVOCacheEntry::setState(U32 state) } } -//virtual -U32 LLVOCacheEntry::getMinFrameRange()const -{ - return mMinFrameRange; -} - void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) { llassert(entry != NULL); @@ -371,6 +365,28 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +bool LLVOCacheEntry::isRecentlyVisible() const +{ + bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); + + if(!vis) + { + vis = (sCurVisible - getVisible() < mMinFrameRange); + } + + if(!vis && !mParentID && mSceneContrib > 0.f) + { + //projection area: mSceneContrib + + //squared distance + const F32 SQUARED_CUT_OFF_DIST = 225.0; //15m + F32 rad = getBinRadius(); + vis = (rad * rad / mSceneContrib > SQUARED_CUT_OFF_DIST); + } + + return vis; +} + void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update) { if(!needs_update && getVisible() >= last_update) @@ -387,8 +403,11 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool lookAt.setSub(center, origin); F32 squared_dist = lookAt.dot3(lookAt).getF32(); - F32 rad = getBinRadius(); - mSceneContrib = rad * rad / squared_dist; + if(squared_dist > 0.f) + { + F32 rad = getBinRadius(); + mSceneContrib = rad * rad / squared_dist; + } setVisible(); } |