From 3aad5686169ba5ba3d6384fa5e7ef5b69fe67d25 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 21 Feb 2013 11:57:29 +0100 Subject: [PATCH] Expose handleSetShaderChanged() in llviewercontrol and wire up in quickprefs to avoid code duplication --- indra/newview/llviewercontrol.cpp | 5 ++++- indra/newview/llviewercontrol.h | 3 +++ indra/newview/quickprefs.cpp | 13 +------------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 78b37705a7..901cbacdb6 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -152,7 +152,10 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) } -static bool handleSetShaderChanged(const LLSD& newvalue) +// Expose handleSetShaderChanged() +//static bool handleSetShaderChanged(const LLSD& newvalue) +bool handleSetShaderChanged(const LLSD& newvalue) +// { // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache gBumpImageList.destroyGL(); diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index d7191f5c8d..646e44c250 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -47,6 +47,9 @@ void settings_setup_listeners(); // for the graphics settings void create_graphics_group(LLControlGroup& group); +// Expose handleSetShaderChanged() +bool handleSetShaderChanged(const LLSD& newvalue); + // saved at end of session extern LLControlGroup gSavedSettings; extern LLControlGroup gSavedPerAccountSettings; diff --git a/indra/newview/quickprefs.cpp b/indra/newview/quickprefs.cpp index d564c87aa7..819f2c88c7 100644 --- a/indra/newview/quickprefs.cpp +++ b/indra/newview/quickprefs.cpp @@ -73,22 +73,11 @@ FloaterQuickPrefs::QuickPrefsXMLEntry::QuickPrefsXMLEntry() {} // -// Ansariel: Copied from llviewercontrol.cpp, handleSetShaderChanged() -static void handleShaderChanged() -{ - // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache - gBumpImageList.destroyGL(); - gBumpImageList.restoreGL(); - - // else, leave terrain detail as is - LLViewerShaderMgr::instance()->setShaders(); -} - FloaterQuickPrefs::FloaterQuickPrefs(const LLSD& key) : LLTransientDockableFloater(NULL, true, key) { // For Phototools - mCommitCallbackRegistrar.add("Quickprefs.ShaderChanged", boost::bind(&handleShaderChanged)); + mCommitCallbackRegistrar.add("Quickprefs.ShaderChanged", boost::bind(&handleSetShaderChanged, LLSD())); } FloaterQuickPrefs::~FloaterQuickPrefs()