Converted some frequent setting lookups to LLCachedControl

This commit is contained in:
Shyotl
2012-01-30 03:49:52 -06:00
parent 9973dfd1c7
commit e327e7a15e
12 changed files with 58 additions and 32 deletions

View File

@@ -564,7 +564,8 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index)
BOOL LLAgentWearables::areWearablesLoaded() const
{
if(gSavedSettings.getBOOL("RenderUnloadedAvatar"))
static const LLCachedControl<bool> rener_unloaded_avatar("RenderUnloadedAvatar");
if(rener_unloaded_avatar)
return TRUE;
return mWearablesLoaded;
}

View File

@@ -160,7 +160,7 @@ void LLConsole::draw()
F32 skip_time = cur_time - mLinePersistTime;
F32 fade_time = cur_time - mFadeTime;
U32 max_lines = gSavedSettings.getS32("ConsoleMaxLines");
static const LLCachedControl<S32> max_lines("ConsoleMaxLines");
U32 num_lines=0;
paragraph_t::reverse_iterator paragraph_it;
@@ -170,7 +170,7 @@ void LLConsole::draw()
while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend())
{
num_lines += (*paragraph_it)->mLines.size();
if(num_lines > max_lines
if(num_lines > (U32)max_lines.get()
|| ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it)->mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f))
{ //All lines above here are done. Lose them.
for (U32 i=0;i<paragraph_num;i++)
@@ -198,8 +198,10 @@ void LLConsole::draw()
LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
F32 console_opacity = llclamp(gSavedSettings.getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
LLColor4 color = gColors.getColor("ConsoleBackground");
static const LLCachedControl<F32> console_background_opacity("ConsoleBackgroundOpacity");
F32 console_opacity = llclamp(console_background_opacity.get(), 0.f, 1.f);
static const LLCachedControl<LLColor4> console_background(gColors,"ConsoleBackground");
LLColor4 color = console_background;
color.mV[VALPHA] *= console_opacity;
F32 line_height = mFont->getLineHeight();

View File

@@ -107,11 +107,12 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass)
S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
{
static const LLCachedControl<bool> render_depth_of_field("RenderDepthOfField");
if (LLPipeline::sImpostorRender)
{ //skip depth buffer filling pass when rendering impostors
return 1;
}
else if (gSavedSettings.getBOOL("RenderDepthOfField"))
else if (render_depth_of_field)
{
return 2;
}

View File

@@ -128,7 +128,8 @@ U32 LLDrawPoolTerrain::getVertexDataMask()
void LLDrawPoolTerrain::prerender()
{
mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
static const LLCachedControl<S32> render_terrain_detail("RenderTerrainDetail");
sDetailMode = render_terrain_detail;
}
void LLDrawPoolTerrain::beginRenderPass( S32 pass )

View File

@@ -573,7 +573,8 @@ void LLDrawPoolWater::shade()
mWaterNormp->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ;
if (gSavedSettings.getBOOL("RenderWaterMipNormal"))
static const LLCachedControl<bool> render_water_mip_normal("RenderWaterMipNormal");
if (render_water_mip_normal)
{
mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
}

View File

@@ -125,7 +125,8 @@ void LLMemoryView::draw()
const S32 UPDATE_INTERVAL = 60;
const S32 MARGIN_AMT = 10;
static S32 curUpdate = UPDATE_INTERVAL;
static LLColor4 s_console_color = gColors.getColor("ConsoleBackground");
static const LLCachedControl<LLColor4> console_background(gColors,"ConsoleBackground");
static LLColor4 s_console_color = console_background;
// setup update interval
if (curUpdate >= UPDATE_INTERVAL)
@@ -141,7 +142,8 @@ void LLMemoryView::draw()
setRect(LLRect().setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height));
// setup window color
F32 console_opacity = llclamp(gSavedSettings.getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
static const LLCachedControl<F32> console_background_opacity("ConsoleBackgroundOpacity");
F32 console_opacity = llclamp(console_background_opacity.get(), 0.f, 1.f);
LLColor4 color = s_console_color;
color.mV[VALPHA] *= console_opacity;

View File

@@ -2240,7 +2240,8 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para
void LLMeshRepository::notifyLoadedMeshes()
{ //called from main thread
LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests");
static const LLCachedControl<U32> max_concurrent_requests("MeshMaxConcurrentRequests");
LLMeshRepoThread::sMaxConcurrentRequests = max_concurrent_requests;
#if MESH_IMPORT
//clean up completed upload threads
@@ -3580,7 +3581,8 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
bool LLMeshRepository::meshUploadEnabled()
{
LLViewerRegion *region = gAgent.getRegion();
if(gSavedSettings.getBOOL("MeshEnabled") &&
static const LLCachedControl<bool> mesh_enabled("MeshEnabled");
if(mesh_enabled &&
region)
{
return region->meshUploadEnabled();
@@ -3591,7 +3593,8 @@ bool LLMeshRepository::meshUploadEnabled()
bool LLMeshRepository::meshRezEnabled()
{
LLViewerRegion *region = gAgent.getRegion();
if(gSavedSettings.getBOOL("MeshEnabled") &&
static const LLCachedControl<bool> mesh_enabled("MeshEnabled");
if(mesh_enabled &&
region)
{
return region->meshRezEnabled();

View File

@@ -1063,7 +1063,8 @@ void render_hud_attachments()
hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1));
LLViewerCamera::updateFrustumPlanes(hud_cam, TRUE);
bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && gSavedSettings.getBOOL("RenderHUDParticles");
static const LLCachedControl<bool> render_hud_particles("RenderHUDParticles");
bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && render_hud_particles;
//only render hud objects
gPipeline.pushRenderTypeMask();
@@ -1407,7 +1408,8 @@ void render_ui_3d()
}
// Coordinate axes
if (gSavedSettings.getBOOL("ShowAxes"))
static const LLCachedControl<bool> show_axes("ShowAxes");
if (show_axes)
{
draw_axes();
}

View File

@@ -568,7 +568,8 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
// This warning will always trigger if you've hacked the avatar to show as incomplete.
// Ignore the warning if that's the case.
if (!gSavedSettings.getBOOL("RenderUnloadedAvatar"))
static const LLCachedControl<bool> rener_unloaded_avatar("RenderUnloadedAvatar");
if (!rener_unloaded_avatar)
{
llwarns << "Layerset without composite" << llendl;
}

View File

@@ -2126,7 +2126,7 @@ bool LLViewerFetchedTexture::updateFetch()
c = mComponents;
}
const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
static const LLCachedControl<U32> override_tex_discard_level("TextureDiscardLevel");
if (override_tex_discard_level != 0)
{
desired_discard = override_tex_discard_level;

View File

@@ -3551,12 +3551,12 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
new_name = TRUE;
}
LLColor4 avatar_name_color = gColors.getColor( "AvatarNameColor" );
static const LLCachedControl<LLColor4> avatar_name_color(gColors, "AvatarNameColor" );
//As pointed out by Zwagoth, we really shouldn't be doing this per-frame. Skip if we already have the data. -HgB
if (mClientTag == "")
{
mClientColor = gColors.getColor( "AvatarNameColor" );
mClientColor = avatar_name_color;
if(isFullyLoaded())
{
//Zwagoth's new client identification - HgB
@@ -3591,7 +3591,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
// friends in a special color. -- charbl
if (LLAvatarTracker::instance().getBuddyInfo(this->getID()) != NULL)
{
if (gSavedSettings.getBOOL("AscentShowFriendsTag"))
static const LLCachedControl<bool> ascent_show_friends_tag("AscentShowFriendsTag");
if (ascent_show_friends_tag)
{
mClientTag = "Friend";
}
@@ -3611,33 +3612,41 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
//Lindens are always more Linden than your friend, make that take precedence
if(LLMuteList::getInstance()->isLinden(getFullname()))
{
mClientColor = gSavedSettings.getColor4("AscentLindenColor");
static const LLCachedControl<LLColor4> ascent_linden_color(gColors, "AscentLindenColor" );
mClientColor = ascent_linden_color;
}
//check if they are an estate owner at their current position
else if(estate_owner.notNull() && this->getID() == estate_owner)
{
mClientColor = gSavedSettings.getColor4("AscentEstateOwnerColor");
static const LLCachedControl<LLColor4> ascent_estate_owner_color(gColors, "AscentEstateOwnerColor" );
mClientColor = ascent_estate_owner_color;
}
//without these dots, SL would suck.
else if (LLAvatarTracker::instance().getBuddyInfo(this->getID()) != NULL)
{
mClientColor = gSavedSettings.getColor4("AscentFriendColor");
static const LLCachedControl<LLColor4> ascent_friend_color(gColors, "AscentFriendColor" );
mClientColor = ascent_friend_color;
}
//big fat jerkface who is probably a jerk, display them as such.
else if(LLMuteList::getInstance()->isMuted(this->getID()))
{
mClientColor = gSavedSettings.getColor4("AscentMutedColor");
static const LLCachedControl<LLColor4> ascent_muted_color(gColors, "AscentMutedColor" );
mClientColor = ascent_muted_color;
}
}
client = mClientTag;
if ((isSelf() && gSavedSettings.getBOOL("AscentShowSelfTagColor"))
|| (!isSelf() && gSavedSettings.getBOOL("AscentShowOthersTagColor")))
avatar_name_color = mClientColor;
static const LLCachedControl<bool> ascent_show_self_tag_color("AscentShowSelfTagColor");
static const LLCachedControl<bool> ascent_show_others_tag_color("AscentShowOthersTagColor");
LLColor4 name_color = avatar_name_color;
if ((isSelf() && ascent_show_self_tag_color)
|| (!isSelf() && ascent_show_others_tag_color))
name_color = mClientColor;
avatar_name_color.setAlpha(alpha);
mNameText->setColor(avatar_name_color);
name_color.setAlpha(alpha);
mNameText->setColor(name_color);
LLQuaternion root_rot = mRoot.getWorldRotation();
//mNameText->setUsePixelSize(TRUE);
@@ -3719,7 +3728,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
}
//idle text
std::string idle_string;
if(!isSelf() && mIdleTimer.getElapsedTimeF32() > 120.f && gSavedSettings.getBOOL("AscentShowIdleTime"))
static LLCachedControl<bool> ascent_show_idle_time("AscentShowIdleTime");
if(!isSelf() && mIdleTimer.getElapsedTimeF32() > 120.f && ascent_show_idle_time)
{
idle_string = getIdleTime();
}
@@ -7912,7 +7922,8 @@ BOOL LLVOAvatar::isFullyLoaded() const
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a
// Changes to LLAppearanceMgr::updateAppearanceFromCOF() expect this function to actually return mFullyLoaded for gAgentAvatarp
if ( (!isSelf()) && (gSavedSettings.getBOOL("RenderUnloadedAvatar")) )
static const LLCachedControl<bool> rener_unloaded_avatar("RenderUnloadedAvatar");
if ( (!isSelf()) && (rener_unloaded_avatar) )
return TRUE;
else
return mFullyLoaded;

View File

@@ -955,7 +955,8 @@ void LLPipeline::createGLBuffers()
//F32 sp = acosf(sa)/(1.f-spec);
sa = powf(sa, gSavedSettings.getF32("RenderSpecularExponent"));
static const LLCachedControl<F32> render_specular_exponent("RenderSpecularExponent");
sa = powf(sa, render_specular_exponent);
F32 a = acosf(sa*0.25f+0.75f);
F32 m = llmax(0.5f-spec*0.5f, 0.001f);
F32 t2 = tanf(a)/m;