diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 1f9a69386..a583d771a 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -564,7 +564,8 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) BOOL LLAgentWearables::areWearablesLoaded() const { - if(gSavedSettings.getBOOL("RenderUnloadedAvatar")) + static const LLCachedControl rener_unloaded_avatar("RenderUnloadedAvatar"); + if(rener_unloaded_avatar) return TRUE; return mWearablesLoaded; } diff --git a/indra/newview/llconsole.cpp b/indra/newview/llconsole.cpp index d45de57f9..ccd4c4eb2 100644 --- a/indra/newview/llconsole.cpp +++ b/indra/newview/llconsole.cpp @@ -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 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 console_background_opacity("ConsoleBackgroundOpacity"); + F32 console_opacity = llclamp(console_background_opacity.get(), 0.f, 1.f); + static const LLCachedControl console_background(gColors,"ConsoleBackground"); + LLColor4 color = console_background; color.mV[VALPHA] *= console_opacity; F32 line_height = mFont->getLineHeight(); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 4eba9292e..c0999b62c 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -107,11 +107,12 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { + static const LLCachedControl 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; } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 5225af4e7..b26896d07 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -128,7 +128,8 @@ U32 LLDrawPoolTerrain::getVertexDataMask() void LLDrawPoolTerrain::prerender() { mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); - sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); + static const LLCachedControl render_terrain_detail("RenderTerrainDetail"); + sDetailMode = render_terrain_detail; } void LLDrawPoolTerrain::beginRenderPass( S32 pass ) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 438e40524..8daa0f69d 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -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 render_water_mip_normal("RenderWaterMipNormal"); + if (render_water_mip_normal) { mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); } diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index 6a57d5f56..5cba79d9d 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -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 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 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; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 3e6f72afd..a6409c5b3 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -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 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 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 mesh_enabled("MeshEnabled"); + if(mesh_enabled && region) { return region->meshRezEnabled(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index e03ca1019..1631bdeeb 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -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 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 show_axes("ShowAxes"); + if (show_axes) { draw_axes(); } diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index a255d88f3..4379140e3 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -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 rener_unloaded_avatar("RenderUnloadedAvatar"); + if (!rener_unloaded_avatar) { llwarns << "Layerset without composite" << llendl; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 66c79505b..2b783881e 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2126,7 +2126,7 @@ bool LLViewerFetchedTexture::updateFetch() c = mComponents; } - const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); + static const LLCachedControl override_tex_discard_level("TextureDiscardLevel"); if (override_tex_discard_level != 0) { desired_discard = override_tex_discard_level; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index db9ae5cb6..c10af283c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -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 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 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 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 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 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 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 ascent_show_self_tag_color("AscentShowSelfTagColor"); + static const LLCachedControl 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 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 rener_unloaded_avatar("RenderUnloadedAvatar"); + if ( (!isSelf()) && (rener_unloaded_avatar) ) return TRUE; else return mFullyLoaded; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f4604589c..3daee4398 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -955,7 +955,8 @@ void LLPipeline::createGLBuffers() //F32 sp = acosf(sa)/(1.f-spec); - sa = powf(sa, gSavedSettings.getF32("RenderSpecularExponent")); + static const LLCachedControl 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;