diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-07-02 17:48:19 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-07-02 17:48:19 -0600 |
commit | e88c469de6b0e800ad9a2c11467d948ad891bdd9 (patch) | |
tree | ce00fd1fd203c0a1cc6fb82691b236838fad2635 /indra/newview/llvocache.cpp | |
parent | 2410b48c605e98c5380dd23bbd138e4516ae311d (diff) |
fix for SH-4264: interesting: Content near edges of screen does not load
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-x | indra/newview/llvocache.cpp | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 60d78890b5..69c32db13e 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -253,6 +253,12 @@ void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) } mChildrenList.push_back(entry); + + //update parent bbox + if(getEntry() != NULL && isState(INACTIVE)) + { + updateParentBoundingInfo(entry); + } } LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP(U32 crc) @@ -367,9 +373,69 @@ void LLVOCacheEntry::setBoundingInfo(const LLVector3& pos, const LLVector3& scal setPositionGroup(center); setSpatialExtents(newMin, newMax); - setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f)); + + if(getNumOfChildren() > 0) //has children + { + updateParentBoundingInfo(); + } + else + { + setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f)); + } +} + +//make the parent bounding box to include all children +void LLVOCacheEntry::updateParentBoundingInfo() +{ + if(mChildrenList.empty()) + { + return; + } + + for(S32 i = 0; i < mChildrenList.size(); i++) + { + updateParentBoundingInfo(mChildrenList[i]); + } } +//make the parent bounding box to include this child +void LLVOCacheEntry::updateParentBoundingInfo(const LLVOCacheEntry* child) +{ + const LLVector4a* child_exts = child->getSpatialExtents(); + LLVector4a newMin, newMax; + newMin = child_exts[0]; + newMax = child_exts[1]; + + //move to regional space. + { + const LLVector4a& parent_pos = getPositionGroup(); + newMin.add(parent_pos); + newMax.add(parent_pos); + } + + //update parent's bbox(min, max) + const LLVector4a* parent_exts = getSpatialExtents(); + update_min_max(newMin, newMax, parent_exts[0]); + update_min_max(newMin, newMax, parent_exts[1]); + for(S32 i = 0; i < 4; i++) + { + llclamp(newMin[i], 0.f, 256.f); + llclamp(newMax[i], 0.f, 256.f); + } + setSpatialExtents(newMin, newMax); + + //update parent's bbox center + LLVector4a center; + center.setAdd(newMin, newMax); + center.mul(0.5f); + setPositionGroup(center); + + //update parent's bbox size vector + LLVector4a size; + size.setSub(newMax, newMin); + size.mul(0.5f); + setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f)); +} //------------------------------------------------------------------- //LLVOCachePartition //------------------------------------------------------------------- |