From a21ef13880426a8d384002f4d49dd9d506672671 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Fri, 6 Jan 2023 17:58:23 +0200
Subject: [PATCH] SL-18907 Add Reflection Probe Ambiance slider to Personal
 Lighting Floater

---
 indra/newview/llfloaterenvironmentadjust.cpp  | 12 ++++++++++++
 indra/newview/llfloaterenvironmentadjust.h    |  2 ++
 .../xui/en/floater_adjust_environment.xml     | 19 +++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp
index 95d6a2d6529..4d113998672 100644
--- a/indra/newview/llfloaterenvironmentadjust.cpp
+++ b/indra/newview/llfloaterenvironmentadjust.cpp
@@ -62,6 +62,7 @@ namespace
     const std::string FIELD_SKY_MOON_ROTATION("moon_rotation");
     const std::string FIELD_SKY_MOON_AZIMUTH("moon_azimuth");
     const std::string FIELD_SKY_MOON_ELEVATION("moon_elevation");
+    const std::string FIELD_REFLECTION_PROBE_AMBIANCE("probe_ambiance");
     const std::string BTN_RESET("btn_reset");
 
     const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f);
@@ -117,6 +118,8 @@ BOOL LLFloaterEnvironmentAdjust::postBuild()
     getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setBlankImageAssetID(LLUUID(gSavedSettings.getString("DefaultBlankNormalTexture")));
     getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onWaterMapChanged(); });
 
+    getChild<LLUICtrl>(FIELD_REFLECTION_PROBE_AMBIANCE)->setCommitCallback([this](LLUICtrl*, const LLSD&) { onReflectionProbeAmbianceChanged(); });
+
     refresh();
     return TRUE;
 }
@@ -171,6 +174,8 @@ void LLFloaterEnvironmentAdjust::refresh()
     getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setValue(mLiveSky->getCloudNoiseTextureId());
     getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setValue(mLiveWater->getNormalMapID());
 
+    getChild<LLUICtrl>(FIELD_REFLECTION_PROBE_AMBIANCE)->setValue(mLiveSky->getReflectionProbeAmbiance());
+
     LLColor3 glow(mLiveSky->getGlow());
 
     // takes 40 - 0.2 range -> 0 - 1.99 UI range
@@ -468,6 +473,13 @@ void LLFloaterEnvironmentAdjust::onSunColorChanged()
     mLiveSky->update();
 }
 
+void LLFloaterEnvironmentAdjust::onReflectionProbeAmbianceChanged()
+{
+    if (!mLiveSky) return;
+    F32 ambiance = getChild<LLUICtrl>(FIELD_REFLECTION_PROBE_AMBIANCE)->getValue().asReal();
+    mLiveSky->setReflectionProbeAmbiance(ambiance);
+    mLiveSky->update();
+}
 
 void LLFloaterEnvironmentAdjust::onEnvironmentUpdated(LLEnvironment::EnvSelection_t env, S32 version)
 {
diff --git a/indra/newview/llfloaterenvironmentadjust.h b/indra/newview/llfloaterenvironmentadjust.h
index 05ff011be5d..43c0ba0495b 100644
--- a/indra/newview/llfloaterenvironmentadjust.h
+++ b/indra/newview/llfloaterenvironmentadjust.h
@@ -82,6 +82,8 @@ class LLFloaterEnvironmentAdjust : public LLFloater
     void                        onCloudMapChanged();
     void                        onWaterMapChanged();
 
+    void                        onReflectionProbeAmbianceChanged();
+
     void                        onButtonReset();
 
     void                        onEnvironmentUpdated(LLEnvironment::EnvSelection_t env, S32 version);
diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml
index f4a686bae14..39fe573c98f 100644
--- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml
+++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml
@@ -252,6 +252,25 @@
                             top_pad="5"
                             width="185"
                             can_edit_text="true"/>
+                  <text follows="left|top"
+                          height="10"
+                          layout="topleft"
+                          left_delta="-5"
+                          top_pad="15"
+                          width="180">Reflection Probe Ambiance:</text>
+                  <slider decimal_digits="3"
+                          follows="left|top"
+                          height="16"
+                          increment="0.01"
+                          initial_value="0"
+                          layout="topleft"
+                          left_delta="5"
+                          min_val="0"
+                          max_val="1"
+                          name="probe_ambiance"
+                          top_pad="5"
+                          width="185"
+                          can_edit_text="true"/>
                 </layout_panel>
                 <layout_panel border="false"
                               bevel_style="in"
-- 
GitLab