From 122ee1057b5e809660f434149721fadbdf470bd3 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Fri, 18 Oct 2019 16:39:10 -0400 Subject: [PATCH] Cache controls --- indra/newview/llagentcamera.cpp | 18 ++++++++++++------ indra/newview/llavataractions.cpp | 6 ++++-- indra/newview/lltoolpie.cpp | 2 +- indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/llviewerobjectlist.cpp | 3 ++- indra/newview/llviewertexlayer.cpp | 2 +- indra/newview/llviewerwindow.cpp | 3 ++- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index ebc09c7025..8eb0514575 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1107,8 +1107,11 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) F32 y_from_center = ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; - frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); - frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); + static LLCachedControl<F32> yaw_from_mpos(gSavedSettings, "YawFromMousePosition"); + static LLCachedControl<F32> pitch_from_mpos(gSavedSettings, "PitchFromMousePosition"); + + frameCamera.yaw( - x_from_center * yaw_from_mpos * DEG_TO_RAD); + frameCamera.pitch( - y_from_center * pitch_from_mpos * DEG_TO_RAD); lookAtType = LOOKAT_TARGET_FREELOOK; } @@ -1734,7 +1737,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); + static LLCachedControl<F32> sCameraOffsetScale(gSavedSettings, "CameraOffsetScale"); + local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * sCameraOffsetScale; // are we sitting down? if (isAgentAvatarValid() && gAgentAvatarp->getParent()) @@ -1837,7 +1841,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; + static LLCachedControl<F32> dynamic_cam_strength(gSavedSettings, "DynamicCameraStrength"); + target_lag = vel * dynamic_cam_strength / 30.f; } mCameraLag = lerp(mCameraLag, target_lag, lag_interp); @@ -1975,10 +1980,11 @@ void LLAgentCamera::handleScrollWheel(S32 clicks) { F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); - F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + static LLCachedControl<F32> sCameraOffsetScale(gSavedSettings, "CameraOffsetScale"); + F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * sCameraOffsetScale); current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); - cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * sCameraOffsetScale); } else { diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index a36642b7a7..93c39a0b53 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -342,7 +342,8 @@ void LLAvatarActions::showProfile(const LLUUID& id) { if (id.notNull()) { - if (gSavedSettings.getBool("AlchemyUseWannabeFacebook")) + static LLCachedControl<bool> wannabe_facebook(gSavedSettings, "AlchemyUseWannabeFacebook"); + if (wannabe_facebook) { LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2)); } @@ -370,7 +371,8 @@ bool LLAvatarActions::profileVisible(const LLUUID& id) //static LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id) { - if (gSavedSettings.getBool("AlchemyUseWannabeFacebook")) + static LLCachedControl<bool> wannabe_facebook(gSavedSettings, "AlchemyUseWannabeFacebook"); + if (wannabe_facebook) { return LLFloaterReg::findTypedInstance<LLFloaterWebContent>(get_profile_floater_name(id), LLSD().with("id", id)); } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 32c43829f5..249bd40ec9 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -1129,7 +1129,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l // // Default prefs will suppress display unless the object is interactive // - bool show_all_object_tips = gSavedSettings.getBool("ShowAllObjectHoverTip"); + static LLCachedControl<bool> show_all_object_tips(gSavedSettings, "ShowAllObjectHoverTip"); LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode(); // only show tooltip if same inspector not already open diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 8e8e7d3ede..63e5eb1caa 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -223,7 +223,7 @@ void display_stats() LLMemory::logMemoryInfo(TRUE) ; gRecentMemoryTime.reset(); } - F32 asset_storage_log_freq = gSavedSettings.getF32("AssetStorageLogFrequency"); + static LLCachedControl<F32> asset_storage_log_freq(gSavedSettings, "AssetStorageLogFrequency"); if (asset_storage_log_freq > 0.f && gAssetStorageLogTime.getElapsedTimeF32() >= asset_storage_log_freq) { gAssetStorageLogTime.reset(); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 710f383c30..244b18e1a9 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -848,6 +848,7 @@ void LLViewerObjectList::update(LLAgent &agent) static LLCachedControl<bool> cc_velocity_interpolate(gSavedSettings, "VelocityInterpolate"); static LLCachedControl<bool> cc_ping_interpolate(gSavedSettings, "PingInterpolate"); static LLCachedControl<F32> cc_interpolation_time(gSavedSettings, "InterpolationTime"); + static LLCachedControl<F32> cc_ping_region_cross_interp(gSavedSettings, "RegionCrossingInterpolationTime"); static LLCachedControl<F32> cc_interpolation_phase_out(gSavedSettings, "InterpolationPhaseOut"); static LLCachedControl<bool> cc_animate_textures(gSavedSettings, "AnimateTextures"); @@ -857,7 +858,7 @@ void LLViewerObjectList::update(LLAgent &agent) F32 interp_time = cc_interpolation_time; F32 phase_out_time = cc_interpolation_phase_out; - F32 region_interp_time = llclamp(gSavedSettings.getF32("RegionCrossingInterpolationTime"), 0.5f, 5.f); + F32 region_interp_time = llclamp(cc_ping_region_cross_interp(), 0.5f, 5.f); if (interp_time < 0.0 || phase_out_time < 0.0 || phase_out_time > interp_time) diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index 2e6c0c7097..87400d03b8 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -335,7 +335,7 @@ BOOL LLViewerTexLayerSetBuffer::isReadyToUpdate() const // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small // since render unnecessarily doesn't cost much. - const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout"); + static LLCachedControl<U32> texture_timeout(gSavedSettings, "AvatarBakedLocalTextureUpdateTimeout"); if (texture_timeout != 0) { // If we hit our timeout and have textures available at even lower resolution, then update. diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4c0036f966..3f74b98f1f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2718,7 +2718,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook, // no view has keyboard focus, this is a printable character key (and no modifier key is // pressed except shift), then give focus to nearby chat (STORM-560) - if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && + static LLCachedControl<S32> letter_focus_chat_bar(gSavedSettings, "LetterKeysFocusChatBar"); + if (letter_focus_chat_bar && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { static LLCachedControl<U32> sChatInWindow(gSavedSettings, "NearbyChatInput", 0); -- GitLab