summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-11-13 09:51:01 -0700
committerXiaohong Bao <bao@lindenlab.com>2013-11-13 09:51:01 -0700
commit58b153cf878370643bd61914538a80e6512c7e5c (patch)
treeaab0378460dd3221931c8eac9fb629eef22c4f74
parent58ee2a30ce5fb83186392693c7b014aa667e02cf (diff)
fix for SH-4608: Interesting: minimap shows objects loading/uinloading behind your camera when camera is rotated
-rwxr-xr-xindra/newview/llviewerregion.cpp7
-rwxr-xr-xindra/newview/llvocache.cpp29
-rwxr-xr-xindra/newview/llvocache.h6
3 files changed, 33 insertions, 9 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 06f9af8751..07a470e3bc 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -962,6 +962,7 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d
else //insert to vo cache tree.
{
entry->updateParentBoundingInfo();
+ entry->saveBoundingSphere();
addToVOCacheTree(entry);
}
@@ -1391,7 +1392,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
LLTimer update_timer;
LLVector4a camera_origin;
- camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
+ camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
+ LLVector4a local_origin;
+ local_origin.load3((LLViewerCamera::getInstance()->getOrigin() - getOriginAgent()).mV);
F32 back_threshold = LLVOCacheEntry::sRearFarRadius;
bool unstable = sNewObjectCreationThrottle < 0;
@@ -1417,7 +1420,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
continue; //skip child objects, they are removed with their parent.
}
- if(!(*iter)->isAnyVisible(camera_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated))
+ if(!(*iter)->isAnyVisible(camera_origin, local_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated))
{
killObject((*iter), delete_list);
}
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 789321e523..92a8f7b18e 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -70,7 +70,8 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &
mState(INACTIVE),
mSceneContrib(0.f),
mTouched(TRUE),
- mParentID(0)
+ mParentID(0),
+ mBSphereRadius(-1.0f)
{
mBuffer = new U8[dp.getBufferSize()];
mDP.assignBuffer(mBuffer, dp.getBufferSize());
@@ -90,7 +91,8 @@ LLVOCacheEntry::LLVOCacheEntry()
mState(INACTIVE),
mSceneContrib(0.f),
mTouched(TRUE),
- mParentID(0)
+ mParentID(0),
+ mBSphereRadius(-1.0f)
{
mDP.assignBuffer(mBuffer, 0);
}
@@ -103,7 +105,8 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
mState(INACTIVE),
mSceneContrib(0.f),
mTouched(FALSE),
- mParentID(0)
+ mParentID(0),
+ mBSphereRadius(-1.0f)
{
S32 size = -1;
BOOL success;
@@ -391,7 +394,7 @@ F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front)
return projection_threshold;
}
-bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 dist_threshold)
+bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold)
{
LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup();
if(!group)
@@ -413,8 +416,16 @@ bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 dist_thre
{
LLVector4a lookAt;
- lookAt.setSub(getPositionGroup(), camera_origin);
- dist_threshold += getBinRadius();
+ if(mBSphereRadius > 0.f)
+ {
+ lookAt.setSub(mBSphereCenter, local_camera_origin);
+ dist_threshold += mBSphereRadius;
+ }
+ else
+ {
+ lookAt.setSub(getPositionGroup(), camera_origin);
+ dist_threshold += getBinRadius();
+ }
vis = (lookAt.dot3(lookAt).getF32() < dist_threshold * dist_threshold);
}
@@ -458,6 +469,12 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool
setVisible();
}
+void LLVOCacheEntry::saveBoundingSphere()
+{
+ mBSphereCenter = getPositionGroup();
+ mBSphereRadius = getBinRadius();
+}
+
void LLVOCacheEntry::setBoundingInfo(const LLVector3& pos, const LLVector3& scale)
{
LLVector4a center, newMin, newMax;
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 500f102d2c..6e10ab86ee 100755
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -85,7 +85,7 @@ public:
bool hasState(U32 state) {return mState & state;}
U32 getState() const {return mState;}
- bool isAnyVisible(const LLVector4a& camera_origin, F32 dist_threshold);
+ bool isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold);
U32 getLocalID() const { return mLocalID; }
U32 getCRC() const { return mCRC; }
@@ -117,6 +117,7 @@ public:
void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message
void updateParentBoundingInfo();
+ void saveBoundingSphere();
void setTouched(BOOL touched = TRUE) {mTouched = touched;}
BOOL isTouched() const {return mTouched;}
@@ -153,6 +154,9 @@ protected:
BOOL mTouched; //if set, this entry is valid, otherwise it is invalid.
+ LLVector4a mBSphereCenter; //bounding sphere center
+ F32 mBSphereRadius; //bounding sphere radius
+
public:
static U32 sMinFrameRange;
static F32 sNearRadiusSquared;