diff options
Diffstat (limited to 'indra/newview/llworld.cpp')
-rwxr-xr-x | indra/newview/llworld.cpp | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 1940bdcccc..d67e4ca71d 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -665,25 +665,61 @@ static LLTrace::SampleStatHandle<> sNumActiveCachedObjects("numactivecachedobjec void LLWorld::updateRegions(F32 max_update_time) { + LLTimer update_timer; + mNumOfActiveCachedObjects = 0; + if(LLViewerCamera::getInstance()->isChanged()) { LLViewerRegion::sLastCameraUpdated = LLViewerOctreeEntryData::getCurrentFrame() + 1; } LLViewerRegion::calcNewObjectCreationThrottle(); + if(LLViewerRegion::isNewObjectCreationThrottleDisabled()) + { + max_update_time = llmax(max_update_time, 1.0f); //seconds, loosen the time throttle. + } - // Perform idle time updates for the regions (and associated surfaces) + F32 max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f); + //update the self avatar region + LLViewerRegion* self_regionp = gAgent.getRegion(); + if(self_regionp) + { + self_regionp->idleUpdate(max_time); + } + + //sort regions by its mLastUpdate + //smaller mLastUpdate first to make sure every region has chance to get updated. + LLViewerRegion::region_priority_list_t region_list; for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) { - (*iter)->idleUpdate(max_update_time); + LLViewerRegion* regionp = *iter; + if(regionp != self_regionp) + { + region_list.insert(regionp); + } + mNumOfActiveCachedObjects += regionp->getNumOfActiveCachedObjects(); } - mNumOfActiveCachedObjects = 0; - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + // Perform idle time updates for the regions (and associated surfaces) + for (LLViewerRegion::region_priority_list_t::iterator iter = region_list.begin(); + iter != region_list.end(); ++iter) { - mNumOfActiveCachedObjects += (*iter)->getNumOfActiveCachedObjects(); + if(max_time > 0.f) + { + max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f); + } + + if(max_time > 0.f) + { + (*iter)->idleUpdate(max_time); + } + else + { + //perform some necessary but very light updates. + (*iter)->lightIdleUpdate(); + } } + sample(sNumActiveCachedObjects, mNumOfActiveCachedObjects); } |