summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-11-06 09:42:06 -0700
committerXiaohong Bao <bao@lindenlab.com>2013-11-06 09:42:06 -0700
commit463a8930c8bddd8740478f6400561a48220ee584 (patch)
tree61899b258e36ab0f6692d35645a22f21e7496759
parent0ce7008521b776451c0ce38299fa87c9e64c63cd (diff)
re-organize the code of processing the debug setting "ObjectProjectionAreaCutOff"
-rwxr-xr-xindra/newview/app_settings/settings.xml2
-rwxr-xr-xindra/newview/llviewerregion.cpp8
-rwxr-xr-xindra/newview/llvocache.cpp22
-rwxr-xr-xindra/newview/llvocache.h1
4 files changed, 20 insertions, 13 deletions
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 @@
<real>0.75</real>
</array>
</map>
- <key>ObjectProjectionAreaCutOFF</key>
+ <key>ObjectProjectionAreaCutOff</key>
<map>
<key>Comment</key>
<string>Threshold in number of pixels of the projection area in screen of object bounding sphere. Objects smaller than this threshold are not rendered.</string>
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<F32> 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<F32> 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<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
- static LLCachedControl<F32> back_sphere_radius(gSavedSettings,"BackShpereCullingRadius");
- static LLCachedControl<F32> projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF");
+ static LLCachedControl<F32> 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);