From 463a8930c8bddd8740478f6400561a48220ee584 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 6 Nov 2013 09:42:06 -0700 Subject: re-organize the code of processing the debug setting "ObjectProjectionAreaCutOff" --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llviewerregion.cpp | 8 ++------ indra/newview/llvocache.cpp | 22 ++++++++++++++++------ indra/newview/llvocache.h | 1 + 4 files changed, 20 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 09d74a7f5e..c87da95d41 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7125,7 +7125,7 @@ 0.75 - ObjectProjectionAreaCutOFF + ObjectProjectionAreaCutOff Comment Threshold in number of pixels of the projection area in screen of object bounding sphere. Objects smaller than this threshold are not rendered. diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index fe420fe551..56e0142dd6 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1166,8 +1166,6 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) void LLViewerRegion::createVisibleObjects(F32 max_time) { - static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); - if(mDead) { return; @@ -1179,10 +1177,8 @@ void LLViewerRegion::createVisibleObjects(F32 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; - + F32 projection_threshold = LLVOCacheEntry::getSquaredObjectScreenAreaThreshold(); + S32 throttle = sNewObjectCreationThrottle; BOOL has_new_obj = FALSE; LLTimer update_timer; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index be7ff00c05..d0061fc777 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -358,6 +358,19 @@ void LLVOCacheEntry::updateDebugSettings() sBackAngleTanSquared = squared_back_angle; } +//static +F32 LLVOCacheEntry::getSquaredObjectScreenAreaThreshold() +{ + static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOff"); + + //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; + + return projection_threshold; +} + bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 squared_dist_threshold) { LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup(); @@ -752,8 +765,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 back_sphere_rad S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) { static LLCachedControl use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion"); - static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); - static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); + static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); if(!LLViewerRegion::sVOCacheCullingEnabled) { @@ -778,10 +790,8 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame(); //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; - + F32 projection_threshold = LLVOCacheEntry::getSquaredObjectScreenAreaThreshold(); + if(!mCullHistory && LLViewerRegion::isViewerCameraStatic()) { U32 seed = llmax(mLODPeriod >> 1, (U32)4); diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index ae32fb0cee..09766b297e 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -125,6 +125,7 @@ public: U32 getUpdateFlags() const {return mUpdateFlags;} static void updateDebugSettings(); + static F32 getSquaredObjectScreenAreaThreshold(); private: void updateParentBoundingInfo(const LLVOCacheEntry* child); -- cgit v1.2.3