summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/llviewerregion.cpp17
-rwxr-xr-xindra/newview/llvocache.cpp26
-rwxr-xr-xindra/newview/llvocache.h4
3 files changed, 30 insertions, 17 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index afc00764b8..06f9af8751 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1131,6 +1131,8 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time)
//
//object projected area threshold
F32 projection_threshold = LLVOCacheEntry::getSquaredPixelThreshold(mImpl->mVOCachePartition->isFrontCull());
+ F32 dist_threshold = mImpl->mVOCachePartition->isFrontCull() ? gAgentCamera.mDrawDistance : LLVOCacheEntry::sRearFarRadius;
+
std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
{
@@ -1153,7 +1155,7 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time)
continue;
}
- vo_entry->calcSceneContribution(local_origin, needs_update, last_update);
+ vo_entry->calcSceneContribution(local_origin, needs_update, last_update, dist_threshold);
if(vo_entry->getSceneContribution() > projection_threshold)
{
mImpl->mWaitingList.insert(vo_entry);
@@ -1389,10 +1391,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
LLTimer update_timer;
LLVector4a camera_origin;
- camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
- F32 squared_back_threshold = LLVOCacheEntry::sRearFarRadius;
- squared_back_threshold *= squared_back_threshold;
-
+ camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
+ F32 back_threshold = LLVOCacheEntry::sRearFarRadius;
+
bool unstable = sNewObjectCreationThrottle < 0;
size_t max_update = unstable ? mImpl->mActiveSet.size() : 64;
if(!mInvisibilityCheckHistory && isViewerCameraStatic())
@@ -1411,8 +1412,12 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
{
iter = mImpl->mActiveSet.begin();
}
+ if((*iter)->getParentID() > 0)
+ {
+ continue; //skip child objects, they are removed with their parent.
+ }
- if(!(*iter)->isAnyVisible(camera_origin, squared_back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated))
+ if(!(*iter)->isAnyVisible(camera_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated))
{
killObject((*iter), delete_list);
}
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();
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 9d851288b4..500f102d2c 100755
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -85,14 +85,14 @@ public:
bool hasState(U32 state) {return mState & state;}
U32 getState() const {return mState;}
- bool isAnyVisible(const LLVector4a& camera_origin, F32 squared_dist_threshold);
+ bool isAnyVisible(const LLVector4a& camera_origin, F32 dist_threshold);
U32 getLocalID() const { return mLocalID; }
U32 getCRC() const { return mCRC; }
S32 getHitCount() const { return mHitCount; }
S32 getCRCChangeCount() const { return mCRCChangeCount; }
- void calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update);
+ void calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold);
void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;}
F32 getSceneContribution() const { return mSceneContrib;}