summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-10-24 20:50:08 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-10-24 20:50:08 -0600
commitbcba6ee3a5e8c34e4686e79dcd45f19a9caa2cfb (patch)
tree3c74ebef8f0e0d66b316d0046dc9863416c38904 /indra/newview
parent371198289b2e3f5894071483968d5e0fa7a4ceeb (diff)
parentbd8f98ff3d870e17893154ba0d9ecf7396899bec (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvieweroctree.cpp5
-rwxr-xr-xindra/newview/llviewerregion.cpp61
2 files changed, 47 insertions, 19 deletions
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index ef802f2651..3646133e91 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -36,7 +36,7 @@
//-----------------------------------------------------------------------------------
//static variables definitions
//-----------------------------------------------------------------------------------
-U32 LLViewerOctreeEntryData::sCurVisible = 0;
+U32 LLViewerOctreeEntryData::sCurVisible = 10; //reserve the low numbers for special use.
BOOL LLViewerOctreeDebug::sInDebug = FALSE;
static LLTrace::CountStatHandle<S32> sOcclusionQueries("occlusion_queries", "Number of occlusion queries executed"),
@@ -234,7 +234,8 @@ LLViewerOctreeEntry::LLViewerOctreeEntry()
: LLTrace::MemTrackable<LLViewerOctreeEntry, 16>("LLViewerOctreeEntry"),
mGroup(NULL),
mBinRadius(0.f),
- mBinIndex(-1)
+ mBinIndex(-1),
+ mVisible(0)
{
mPositionGroup.clear();
mExtents[0].clear();
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index d619a2af8b..dee52abea7 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1049,6 +1049,8 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry)
F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
{
+ static LLCachedControl<F32> projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF");
+
if(mDead)
{
return max_time;
@@ -1059,8 +1061,27 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
return max_time;
}
+ if(!sNewObjectCreationThrottle)
+ {
+ return max_time;
+ }
+ U32 new_obj_count = sNewObjectCreationThrottle;
+ if(sNewObjectCreationThrottle < 0)
+ {
+ new_obj_count = (U32)-1; //maximum
+ }
+ else
+ {
+ new_obj_count *= 1.5f; //load 50% more for selection
+ }
+
LLTimer update_timer;
+ //object projected area threshold
+ F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
+ F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f;
+ projection_threshold *= projection_threshold;
+
const F32 LARGE_SCENE_CONTRIBUTION = 100.f; //a large number to force to load the object.
const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin();
const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame();
@@ -1068,7 +1089,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
U32 last_update = mImpl->mLastCameraUpdate;
//process visible entries
- for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();)
+ for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); new_obj_count > 0 && iter != mImpl->mVisibleEntries.end();)
{
LLVOCacheEntry* vo_entry = *iter;
@@ -1078,6 +1099,10 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
if(vo_entry->getState() < LLVOCacheEntry::WAITING)
{
mImpl->mWaitingList.insert(vo_entry);
+ if(!(--new_obj_count))
+ {
+ break;
+ }
}
LLVOCacheEntry* child;
@@ -1090,6 +1115,11 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
{
child->setSceneContribution(LARGE_SCENE_CONTRIBUTION); //a large number to force to load the child.
mImpl->mWaitingList.insert(child);
+
+ if(!(--new_obj_count))
+ {
+ break;
+ }
}
else
{
@@ -1123,7 +1153,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
//process visible groups
std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
- for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
+ for(; new_obj_count > 0 && group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
{
LLPointer<LLViewerOctreeGroup> group = *group_iter;
if(group->getNumRefs() < 3 || //group to be deleted
@@ -1145,7 +1175,16 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
}
vo_entry->calcSceneContribution(camera_origin, needs_update, last_update);
- mImpl->mWaitingList.insert(vo_entry);
+
+ if(vo_entry->getSceneContribution() > projection_threshold)
+ {
+ mImpl->mWaitingList.insert(vo_entry);
+
+ if(!(--new_obj_count))
+ {
+ break;
+ }
+ }
}
}
}
@@ -1161,8 +1200,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
F32 LLViewerRegion::createVisibleObjects(F32 max_time)
{
- static LLCachedControl<F32> projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF");
-
if(mDead)
{
return max_time;
@@ -1171,12 +1208,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time)
{
mImpl->mVOCachePartition->setCullHistory(FALSE);
return max_time;
- }
-
- //object projected area threshold
- F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
- F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f;
- projection_threshold *= projection_threshold;
+ }
S32 throttle = sNewObjectCreationThrottle;
BOOL has_new_obj = FALSE;
@@ -1184,12 +1216,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time)
for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin();
iter != mImpl->mWaitingList.end(); ++iter)
{
- LLVOCacheEntry* vo_entry = *iter;
-
- if(vo_entry->getSceneContribution() < projection_threshold)
- {
- break;
- }
+ LLVOCacheEntry* vo_entry = *iter;
if(vo_entry->getState() < LLVOCacheEntry::WAITING)
{