diff options
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-x | indra/newview/llvocache.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 3bacf5c319..789321e523 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -391,7 +391,7 @@ F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front) return projection_threshold; } -bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 squared_dist_threshold) +bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 dist_threshold) { LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup(); if(!group) @@ -412,19 +412,17 @@ bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 squared_d if(!vis && !mParentID) { 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); + dist_threshold += getBinRadius(); + + vis = (lookAt.dot3(lookAt).getF32() < dist_threshold * dist_threshold); } return vis; } -void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update) +void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold) { if(!needs_update && getVisible() >= last_update) { @@ -444,7 +442,17 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool else { F32 rad = getBinRadius(); - mSceneContrib = rad * rad / squared_dist; + dist_threshold += rad; + dist_threshold *= dist_threshold; + + if(squared_dist < dist_threshold) + { + mSceneContrib = rad * rad / squared_dist; + } + else + { + mSceneContrib = 0.f; //out of draw distance, not to load + } } setVisible(); |