diff options
author | Graham Linden <graham@lindenlab.com> | 2018-10-10 18:44:03 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-10-10 18:44:03 +0100 |
commit | 79d33f9d19a0c6e5ed34ffbd01a31cb2625e1ecc (patch) | |
tree | f0bbe587871419ecd36363c5c1d0def6e9166825 | |
parent | 4b174a31c8db1bf7f378f9b088c1335651a34ec5 (diff) |
Fix names of WATER_BLUR_MULTIPILER.
Give wave direction uniforms more meaningful names in shaders.
Add comments on glow size/focus conversions for clarity.
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 14 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.h | 8 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/waterV.glsl | 10 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl | 1 | ||||
-rw-r--r-- | indra/newview/lllegacyatmospherics.cpp | 4 | ||||
-rw-r--r-- | indra/newview/lllegacyatmospherics.h | 1 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml | 46 |
10 files changed, 49 insertions, 44 deletions
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 33f824028b..61eb3d6fc0 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -41,7 +41,7 @@ namespace } //========================================================================= -const std::string LLSettingsWater::SETTING_BLUR_MULTIPILER("blur_multiplier"); +const std::string LLSettingsWater::SETTING_BLUR_MULTIPLIER("blur_multiplier"); const std::string LLSettingsWater::SETTING_FOG_COLOR("water_fog_color"); const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density"); const std::string LLSettingsWater::SETTING_FOG_MOD("underwater_fog_mod"); @@ -55,7 +55,7 @@ const std::string LLSettingsWater::SETTING_SCALE_BELOW("scale_below"); const std::string LLSettingsWater::SETTING_WAVE1_DIR("wave1_direction"); const std::string LLSettingsWater::SETTING_WAVE2_DIR("wave2_direction"); -const std::string LLSettingsWater::SETTING_LEGACY_BLUR_MULTIPILER("blurMultiplier"); +const std::string LLSettingsWater::SETTING_LEGACY_BLUR_MULTIPLIER("blurMultiplier"); const std::string LLSettingsWater::SETTING_LEGACY_FOG_COLOR("waterFogColor"); const std::string LLSettingsWater::SETTING_LEGACY_FOG_DENSITY("waterFogDensity"); const std::string LLSettingsWater::SETTING_LEGACY_FOG_MOD("underWaterFogMod"); @@ -97,7 +97,7 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) F32 normal_scale_offset = (position * 0.5f) - 0.25f; // Magic constants copied form defaults.xml - dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); + dfltsetting[SETTING_BLUR_MULTIPLIER] = LLSD::Real(0.04000f); dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); @@ -121,9 +121,9 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); - if (legacy.has(SETTING_LEGACY_BLUR_MULTIPILER)) + if (legacy.has(SETTING_LEGACY_BLUR_MULTIPLIER)) { - newsettings[SETTING_BLUR_MULTIPILER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPILER].asReal()); + newsettings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPLIER].asReal()); } if (legacy.has(SETTING_LEGACY_FOG_COLOR)) { @@ -212,14 +212,14 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - validation.push_back(Validator(SETTING_BLUR_MULTIPILER, true, LLSD::TypeReal, + validation.push_back(Validator(SETTING_BLUR_MULTIPLIER, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-0.5f)(0.5f))))); validation.push_back(Validator(SETTING_FOG_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)(1.0f)), LLSD(LLSDArray(1.0f)(1.0f)(1.0f)(1.0f))))); validation.push_back(Validator(SETTING_FOG_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-10.0f)(10.0f))))); validation.push_back(Validator(SETTING_FOG_MOD, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); validation.push_back(Validator(SETTING_FRESNEL_OFFSET, true, LLSD::TypeReal, diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 06ee8e68bc..009a72eb24 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -33,7 +33,7 @@ class LLSettingsWater : public LLSettingsBase { public: - static const std::string SETTING_BLUR_MULTIPILER; + static const std::string SETTING_BLUR_MULTIPLIER; static const std::string SETTING_FOG_COLOR; static const std::string SETTING_FOG_DENSITY; static const std::string SETTING_FOG_MOD; @@ -71,12 +71,12 @@ public: //--------------------------------------------------------------------- F32 getBlurMultiplier() const { - return mSettings[SETTING_BLUR_MULTIPILER].asReal(); + return mSettings[SETTING_BLUR_MULTIPLIER].asReal(); } void setBlurMultiplier(F32 val) { - setValue(SETTING_BLUR_MULTIPILER, val); + setValue(SETTING_BLUR_MULTIPLIER, val); } LLColor3 getWaterFogColor() const @@ -223,7 +223,7 @@ public: static LLUUID GetDefaultOpaqueTextureAssetId(); protected: - static const std::string SETTING_LEGACY_BLUR_MULTIPILER; + static const std::string SETTING_LEGACY_BLUR_MULTIPLIER; static const std::string SETTING_LEGACY_FOG_COLOR; static const std::string SETTING_LEGACY_FOG_DENSITY; static const std::string SETTING_LEGACY_FOG_MOD; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index e483f723f0..8617b58d2e 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1276,8 +1276,8 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("refTex"); mReservedUniforms.push_back("eyeVec"); mReservedUniforms.push_back("time"); - mReservedUniforms.push_back("d1"); - mReservedUniforms.push_back("d2"); + mReservedUniforms.push_back("waveDir1"); + mReservedUniforms.push_back("waveDir2"); mReservedUniforms.push_back("lightDir"); mReservedUniforms.push_back("specular"); mReservedUniforms.push_back("lightExp"); diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index 9734acf005..8863869e44 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -31,8 +31,8 @@ ATTRIBUTE vec3 position; void calcAtmospherics(vec3 inPositionEye); -uniform vec2 d1; -uniform vec2 d2; +uniform vec2 waveDir1; +uniform vec2 waveDir2; uniform float time; uniform vec3 eyeVec; uniform float waterHeight; @@ -88,10 +88,10 @@ void main() calcAtmospherics(pos.xyz); //pass wave parameters to pixel shader - vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055; + vec2 bigWave = (v.xy) * vec2(0.04,0.04) + waveDir1 * time * 0.055; //get two normal map (detail map) texture coordinates - littleWave.xy = (v.xy) * vec2(0.45, 0.9) + d2 * time * 0.13; - littleWave.zw = (v.xy) * vec2(0.1, 0.2) + d1 * time * 0.1; + littleWave.xy = (v.xy) * vec2(0.45, 0.9) + waveDir2 * time * 0.13; + littleWave.zw = (v.xy) * vec2(0.1, 0.2) + waveDir1 * time * 0.1; view.w = bigWave.y; refCoord.w = bigWave.x; diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl index e918bdcb9d..20280ab1c5 100644 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -47,7 +47,6 @@ uniform float kd; uniform vec4 waterPlane; uniform vec3 eyeVec; uniform vec4 waterFogColor; -uniform float waterFogDensity; uniform float waterFogKS; uniform vec2 screenRes; diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index 0c4e5b48e8..371bd1b7c2 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -264,6 +264,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) F32 haze_horizon = vars.haze_horizon; F32 haze_density = vars.haze_density; F32 density_multiplier = vars.density_multiplier; + //F32 distance_multiplier = vars.distance_multiplier; F32 max_y = vars.max_y; LLVector4 sun_norm = vars.sun_norm; @@ -323,7 +324,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) temp2.mV[2] = Plen * density_multiplier; // Transparency (-> temp1) - temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]); + temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]);// * distance_multiplier); // Compute haze glow @@ -510,6 +511,7 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) vars.haze_density = psky->getHazeDensity(); vars.haze_horizon = psky->getHazeHorizon(); vars.density_multiplier = psky->getDensityMultiplier(); + vars.distance_multiplier = psky->getDistanceMultiplier(); vars.max_y = psky->getMaxY(); vars.sun_norm = LLEnvironment::instance().getClampedSunNorm(); vars.sunlight = psky->getSunlightColor(); diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h index 1979e93cdd..76b1a0f313 100644 --- a/indra/newview/lllegacyatmospherics.h +++ b/indra/newview/lllegacyatmospherics.h @@ -218,6 +218,7 @@ public: F32 haze_density; F32 haze_horizon; F32 density_multiplier; + F32 distance_multiplier; F32 max_y; LLVector4 sun_norm; LLColor3 sunlight; diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 1ae220a5ca..6d9f016aba 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -481,8 +481,10 @@ void LLPanelSettingsSkySunMoonTab::refresh() LLColor3 glow(mSkySettings->getGlow()); + // takes 40 - 0.2 range -> 0 - 1.99 UI range getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setValue(2.0 - (glow.mV[0] / SLIDER_SCALE_GLOW_R)); getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setValue(glow.mV[2] / SLIDER_SCALE_GLOW_B); + getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setValue(mSkySettings->getStarBrightness()); getChild<LLVirtualTrackball>(FIELD_SKY_SUN_ROTATION)->setRotation(mSkySettings->getSunRotation()); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setValue(mSkySettings->getSunTextureId()); @@ -509,6 +511,7 @@ void LLPanelSettingsSkySunMoonTab::onGlowChanged() { LLColor3 glow(getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->getValue().asReal(), 0.0f, getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->getValue().asReal()); + // takes 0 - 1.99 UI range -> 40 -> 0.2 range glow.mV[0] = (2.0f - glow.mV[0]) * SLIDER_SCALE_GLOW_R; glow.mV[2] *= SLIDER_SCALE_GLOW_B; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 17384a3a6b..8e55ae395a 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -791,7 +791,7 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater) LLSD legacy(LLSD::emptyMap()); LLSD settings = pwater->getSettings(); - legacy[SETTING_LEGACY_BLUR_MULTIPILER] = settings[SETTING_BLUR_MULTIPILER]; + legacy[SETTING_LEGACY_BLUR_MULTIPLIER] = settings[SETTING_BLUR_MULTIPLIER]; legacy[SETTING_LEGACY_FOG_COLOR] = ensure_array_4(settings[SETTING_FOG_COLOR], 1.0f); legacy[SETTING_LEGACY_FOG_DENSITY] = settings[SETTING_FOG_DENSITY]; legacy[SETTING_LEGACY_FOG_MOD] = settings[SETTING_FOG_MOD]; diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml index 1332ecd965..371ecd74bd 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -176,29 +176,6 @@ top_delta="15" width="250" can_edit_text="true"/> - <text - follows="left|top" - height="10" - layout="topleft" - left_delta="-5" - top_delta="22" - width="200"> - Moon Brightness: - </text> - <slider - decimal_digits="2" - follows="left|top" - height="16" - increment="0.01" - initial_value="0" - layout="topleft" - left_delta="5" - min_val="0.0" - max_val="1.0" - name="moon_brightness" - top_delta="15" - width="250" - can_edit_text="true"/> </layout_panel> <layout_panel border="false" @@ -287,6 +264,29 @@ top_delta="15" width="130" can_edit_text="true"/> + <text + follows="left|top" + height="10" + layout="topleft" + left_delta="-5" + top_delta="22" + width="200"> + Brightness: + </text> + <slider + decimal_digits="2" + follows="left|top" + height="16" + increment="0.01" + initial_value="0" + layout="topleft" + left_delta="5" + min_val="0.0" + max_val="1.0" + name="moon_brightness" + top_delta="15" + width="250" + can_edit_text="true"/> </layout_panel> </layout_stack> </layout_panel> |