diff options
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 33 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llvocache.cpp | 24 | ||||
-rwxr-xr-x | indra/newview/llvocache.h | 5 |
4 files changed, 68 insertions, 7 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b2e3c8b683..93cc605be0 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -721,6 +721,17 @@ <integer>0</integer> </map> + <key>BackDistanceFactor</key> + <map> + <key>Comment</key> + <string>Keep invisible objects in memory which are in the distance range (the factor * draw_distance) to the camera</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.125</real> + </map> <key>BackgroundYieldTime</key> <map> <key>Comment</key> @@ -732,6 +743,17 @@ <key>Value</key> <integer>40</integer> </map> + <key>BackProjectionAngleSquared</key> + <map> + <key>Comment</key> + <string>squared tan(object bbox projection angle). that of invisible objects greater than this threshold are kept in memory</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0311</real> + </map> <key>BottomPanelNew</key> <map> <key>Comment</key> @@ -6306,6 +6328,17 @@ <key>Value</key> <integer>64</integer> </map> + <key>NewObjectCreationThrottleDelayTime</key> + <map> + <key>Comment</key> + <string>time in seconds NewObjectCreationThrottle to take effect after the progress screen is lifted</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>2.0</real> + </map> <key>NextOwnerCopy</key> <map> <key>Comment</key> diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index da01c0406a..9c038d54d5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1233,6 +1233,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) void LLViewerRegion::calcNewObjectCreationThrottle() { static LLCachedControl<S32> new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + static LLCachedControl<F32> throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime"); static LLFrameTimer timer; // @@ -1243,16 +1244,20 @@ void LLViewerRegion::calcNewObjectCreationThrottle() //>0: valid throttling number // - if(gViewerWindow->getProgressView()->getVisible()) + if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f) { sNewObjectCreationThrottle = -2; //cancel the throttling timer.reset(); } - else if(sNewObjectCreationThrottle < 0) //just recoved from the login/teleport screen + else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen { - if(new_object_creation_throttle > 0 && timer.getElapsedTimeF32() > 2.0f) //wait for two seconds to reset the throttle + if(timer.getElapsedTimeF32() > throttle_delay_time) //wait for throttle_delay_time to reset the throttle { sNewObjectCreationThrottle = new_object_creation_throttle; //reset + if(sNewObjectCreationThrottle < -1) + { + sNewObjectCreationThrottle = -1; + } } } } @@ -1285,6 +1290,8 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); + LLVOCacheEntry::updateBackCullingFactors(); + for(; update_counter > 0; --update_counter, ++iter) { if(iter == mImpl->mActiveSet.end()) diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index dcd1ae391d..1cfda038a8 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -33,7 +33,10 @@ #include "lldrawable.h" #include "llviewerregion.h" #include "pipeline.h" +#include "llagentcamera.h" +F32 LLVOCacheEntry::sBackDistanceSquared = 0.f; +F32 LLVOCacheEntry::sBackAngleTanSquared = 0.f; BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE; LLTrace::MemStatHandle LLVOCachePartition::sMemStat("LLVOCachePartition"); @@ -353,6 +356,21 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +//static +void LLVOCacheEntry::updateBackCullingFactors() +{ + //distance to keep objects = back_dist_factor * draw_distance + static LLCachedControl<F32> back_dist_factor(gSavedSettings,"BackDistanceFactor"); + + //squared tan(projection angle of the bbox), default is 10 (degree) + static LLCachedControl<F32> squared_back_angle(gSavedSettings,"BackProjectionAngleSquared"); + + sBackDistanceSquared = back_dist_factor * gAgentCamera.mDrawDistance; + sBackDistanceSquared *= sBackDistanceSquared; + + sBackAngleTanSquared = squared_back_angle; +} + bool LLVOCacheEntry::isRecentlyVisible() const { bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); @@ -363,12 +381,10 @@ bool LLVOCacheEntry::isRecentlyVisible() const } //combination of projected area and squared distance - if(!vis && !mParentID && mSceneContrib > 0.0311f) //projection angle > 10 (degree) + if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared) { - //squared distance - const F32 SQUARED_CUT_OFF_DIST = 256.0; //16m F32 rad = getBinRadius(); - vis = (rad * rad / mSceneContrib < SQUARED_CUT_OFF_DIST); + vis = (rad * rad / mSceneContrib < sBackDistanceSquared); } return vis; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index a385610a10..52b25b7f91 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -123,6 +123,8 @@ public: void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} + static void updateBackCullingFactors(); + private: static U32 getInvisibleObjectsLiveTime(); @@ -151,6 +153,9 @@ protected: std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set. BOOL mTouched; //if set, this entry is valid, otherwise it is invalid. + + static F32 sBackDistanceSquared; + static F32 sBackAngleTanSquared; }; class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable<LLVOCachePartition> |