From 3cf8a1ce6e81c30cf7231a5ab045bbc45c6757e2 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 20 Feb 2015 12:56:45 -0500 Subject: Clean up impostors and visual muting Rename the settings that control them to be more descriptive Remove the separate boolean setting (RenderUseImpostors) that governed both Establish default values based on gpu class for impostors and visual muting --- indra/newview/llfloaterpreference.cpp | 174 ++++++++++++++++++++++------------ 1 file changed, 116 insertions(+), 58 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 0ac18408db..a37bebc547 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -120,6 +120,18 @@ char const* const VISIBILITY_HIDDEN = "hidden"; //control value for middle mouse as talk2push button const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; +/// This must equal the maximum value set for the IndirectMaxComplexity slider in panel_preferences_graphics1.xml +static const U32 INDIRECT_MAX_ARC_OFF = 101; // all the way to the right == disabled +static const U32 MIN_INDIRECT_ARC_LIMIT = 1; // must match minimum of IndirectMaxComplexity in panel_preferences_graphics1.xml +static const U32 MAX_INDIRECT_ARC_LIMIT = INDIRECT_MAX_ARC_OFF-1; // one short of all the way to the right... + +/// These are the effective range of values for RenderAvatarMaxComplexity +static const F32 MIN_ARC_LIMIT = 20000.0f; +static const F32 MAX_ARC_LIMIT = 300000.0f; +static const F32 MIN_ARC_LOG = log(MIN_ARC_LIMIT); +static const F32 MAX_ARC_LOG = log(MAX_ARC_LIMIT); +static const F32 ARC_LIMIT_MAP_SCALE = (MAX_ARC_LOG - MIN_ARC_LOG) / (MAX_INDIRECT_ARC_LIMIT - MIN_INDIRECT_ARC_LIMIT); + class LLVoiceSetKeyDialog : public LLModalDialog { public: @@ -341,6 +353,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreference::updateMaximumNonImpostors,this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity,this)); mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); @@ -773,6 +787,9 @@ void LLFloaterPreference::updateShowFavoritesCheckbox(bool val) void LLFloaterPreference::setHardwareDefaults() { LLFeatureManager::getInstance()->applyRecommendedSettings(); + // reset indirects before refresh because we may have changed what they control + setIndirectControls(); + refreshEnabledGraphics(); gSavedSettings.setString("PresetGraphicActive", ""); LLPresetsManager::getInstance()->triggerChangeSignal(); @@ -785,7 +802,9 @@ void LLFloaterPreference::setHardwareDefaults() LLView* view = *iter; LLPanelPreference* panel = dynamic_cast(view); if (panel) + { panel->setHardwareDefaults(); + } } } @@ -930,6 +949,7 @@ void LLFloaterPreference::refreshEnabledGraphics() { instance->refresh(); } + setIndirectControls(); } void LLFloaterPreference::onClickClearCache() @@ -1220,12 +1240,6 @@ void LLFloaterPreference::refreshEnabledState() ctrl_shadow->setEnabled(enabled); shadow_text->setEnabled(enabled); - LLTextBox* maximum_arc_text = getChild("MaximumARCText"); - - enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors") && gSavedSettings.getBOOL("RenderUseImpostors"); - getChildView("MaximumARC")->setEnabled(enabled); - maximum_arc_text->setEnabled(enabled); - // Hardware settings F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); @@ -1291,6 +1305,48 @@ void LLFloaterPreference::refreshEnabledState() getChild("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); } +// static +void LLFloaterPreference::setIndirectControls() +{ + /* + * We have controls that have an indirect relationship between the control + * values and adjacent text and the underlying setting they influence. + * In each case, the control and its associated setting are named Indirect + * This method interrogates the controlled setting and establishes the + * appropriate value for the indirect control. It must be called whenever the + * underlying setting may have changed other than through the indirect control, + * such as when the 'Reset all to recommended settings' button is used... + */ + setIndirectMaxNonImpostors(); + setIndirectMaxArc(); +} + +// static +void LLFloaterPreference::setIndirectMaxNonImpostors() +{ + U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors"); + // for this one, we just need to make zero, which means off, the max value of the slider + U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors; + gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors); +} + +void LLFloaterPreference::setIndirectMaxArc() +{ + U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity"); + U32 indirect_max_arc; + if (0 == max_arc) + { + // the off position is all the way to the right, so set to control max + indirect_max_arc = INDIRECT_MAX_ARC_OFF; + } + else + { + // This is the inverse of the calculation in updateMaxComplexity + indirect_max_arc = (U32)((log(max_arc) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE) + MIN_INDIRECT_ARC_LIMIT; + } + gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc); +} + void LLFloaterPreference::disableUnavailableSettings() { LLComboBox* ctrl_reflections = getChild("Reflections"); @@ -1299,8 +1355,6 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLSliderCtrl* ctrl_maximum_arc = getChild("MaximumARC"); - LLTextBox* maximum_arc_text = getChild("MaximumARCText"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); LLComboBox* ctrl_shadows = getChild("ShadowDetail"); @@ -1449,13 +1503,6 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_avatar_cloth->setEnabled(FALSE); ctrl_avatar_cloth->setValue(FALSE); } - - // disabled impostors - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors")) - { - ctrl_maximum_arc->setEnabled(FALSE); - maximum_arc_text->setEnabled(FALSE); - } } void LLFloaterPreference::refresh() @@ -1476,9 +1523,9 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); - updateImpostorsText(getChild("MaxNumberAvatarDrawn", true), getChild("ImpostorsText", true)); - updateMaximumArcText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); - + setIndirectControls(); + setMaximumNonImpostorsText(gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),getChild("IndirectMaxNonImpostorsText", true)); + setMaxComplexityText(gSavedSettings.getU32("RenderAvatarMaxComplexity"),getChild("IndirectMaxComplexityText", true)); refreshEnabledState(); } @@ -1621,12 +1668,12 @@ void LLFloaterPreference::onClickLogPath() //Path changed if(proposed_name != dir_name) { - gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name); + gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name); mPriorInstantMessageLogPath = proposed_name; - // enable/disable 'Delete transcripts button - updateDeleteTranscriptsButton(); -} + // enable/disable 'Delete transcripts button + updateDeleteTranscriptsButton(); + } } bool LLFloaterPreference::moveTranscriptsAndLog() @@ -1760,59 +1807,71 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b } } -void LLFloaterPreference::updateImpostorsText(LLSliderCtrl* ctrl, LLTextBox* text_box) + +void LLFloaterPreference::updateMaximumNonImpostors() { - F32 value = (F32)ctrl->getValue().asReal(); + // Called when the IndirectMaxNonImpostors control changes + // Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors + LLSliderCtrl* ctrl = getChild("IndirectMaxNonImpostors",true); + U32 value = ctrl->getValue().asInteger(); - if (value < IMPOSTORS_OFF) + if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value) { - text_box->setText(llformat("%0.0f", value)); - if (!gSavedSettings.getBOOL("RenderUseImpostors")) - { - gSavedSettings.setBOOL("RenderUseImpostors", true); - } + value=0; } - else + gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value); + LLVOAvatar::updateImpostorRendering(value); // make it effective immediately + setMaximumNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); +} + +void LLFloaterPreference::setMaximumNonImpostorsText(U32 value, LLTextBox* text_box) +{ + if (0 == value) { text_box->setText(LLTrans::getString("no_limit")); - gSavedSettings.setBOOL("RenderUseImpostors", false); + } + else + { + text_box->setText(llformat("%d", value)); } } -void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreference::updateMaxComplexity() { - F32 min_result = 20000.0f; - F32 max_result = 300000.0f; + // Called when the IndirectMaxComplexity control changes + // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity + LLSliderCtrl* ctrl = getChild("IndirectMaxComplexity"); + U32 indirect_value = ctrl->getValue().asInteger(); + U32 max_arc; + + if (INDIRECT_MAX_ARC_OFF == indirect_value) + { + // The 'off' position is when the slider is all the way to the right, + // which is a value of INDIRECT_MAX_ARC_OFF, + // so it is necessary to set max_arc to 0 disable muted avatars. + max_arc = 0; + } + else + { + // if this is changed, the inverse calculation in setIndirectMaxArc + // must be changed to match + max_arc = (U32)exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT))); + } - F32 value = (F32)ctrl->getValue().asReal(); + gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc); + setMaxComplexityText(max_arc, getChild("IndirectMaxComplexityText")); +} - if (101.0f == value) +void LLFloaterPreference::setMaxComplexityText(U32 value, LLTextBox* text_box) +{ + if (0 == value) { - // It has been decided that having the slider all the way to the right will be the off position, which - // is a value of 101, so it is necessary to change value to 0 disable impostor generation. - value = 0.0f; text_box->setText(LLTrans::getString("no_limit")); } else { - - // 100 is the maximum value of this control set in panel_preferences_graphics1.xml - F32 minp = 1.0f; - F32 maxp = 100.0f; - - // The result should be between min_result and max_result - F32 minv = log(min_result); - F32 maxv = log(max_result); - - // calculate adjustment factor - F32 scale = (maxv - minv) / (maxp - minp); - - value = exp(minv + scale * (value - minp)); - - text_box->setText(llformat("%0.0f", value)); + text_box->setText(llformat("%d", value)); } - - gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)value); } void LLFloaterPreference::onChangeMaturity() @@ -2411,7 +2470,6 @@ void LLPanelPreferenceGraphics::saveSettings() void LLPanelPreferenceGraphics::setHardwareDefaults() { resetDirtyChilds(); - LLPanelPreference::setHardwareDefaults(); } LLFloaterPreferenceProxy::LLFloaterPreferenceProxy(const LLSD& key) -- cgit v1.2.3