diff options
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 4 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/skyF.glsl | 2 | ||||
| -rw-r--r-- | indra/newview/lldensityctrl.cpp | 225 | ||||
| -rw-r--r-- | indra/newview/lldensityctrl.h | 104 | ||||
| -rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 149 | ||||
| -rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llpaneleditsky.cpp | 265 | ||||
| -rw-r--r-- | indra/newview/llpaneleditsky.h | 38 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_density.xml | 274 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/widgets/density_ctrl.xml | 164 | 
11 files changed, 1164 insertions, 78 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 214b1a1965..e32eeb4779 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8664,7 +8664,7 @@      <key>Type</key>      <string>Boolean</string>      <key>Value</key> -    <integer>0</integer> +    <integer>1</integer>    </map>    <key>RenderLocalLights</key>    <map> @@ -10165,7 +10165,7 @@      <key>Type</key>      <string>Boolean</string>      <key>Value</key> -    <integer>0</integer> +    <integer>1</integer>    </map>    <key>RenderUseTriStrips</key>    <map> diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 47fa0efe06..01c873584f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -1,5 +1,5 @@  /**  - * @file advancedAtmoF.glsl + * @file class3/skyF.glsl   *   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * Second Life Viewer Source Code diff --git a/indra/newview/lldensityctrl.cpp b/indra/newview/lldensityctrl.cpp new file mode 100644 index 0000000000..298a309e7c --- /dev/null +++ b/indra/newview/lldensityctrl.cpp @@ -0,0 +1,225 @@ +/** +* @file lldensityctrl.cpp +* @brief Control for specifying density over a height range for sky settings. +* +* $LicenseInfo:firstyear=2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2011, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "lldensityctrl.h" + +#include "llslider.h" +#include "llsliderctrl.h" +#include "llsettingssky.h" + +static LLDefaultChildRegistry::Register<LLDensityCtrl> register_density_control("densityctrl"); + +const std::string LLDensityCtrl::DENSITY_RAYLEIGH("density_rayleigh"); +const std::string LLDensityCtrl::DENSITY_MIE("density_mie"); +const std::string LLDensityCtrl::DENSITY_ABSORPTION("density_absorption"); + +namespace +{    +    const std::string   FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL("level_exponential"); +    const std::string   FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE("exponential_scale"); +    const std::string   FIELD_SKY_DENSITY_PROFILE_LINEAR("level_linear"); +    const std::string   FIELD_SKY_DENSITY_PROFILE_CONSTANT("level_constant"); +    const std::string   FIELD_SKY_DENSITY_MAX_ALTITUDE("max_altitude"); +    const std::string   FIELD_SKY_DENSITY_ANISO_FACTOR("aniso_factor"); +    const std::string   FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL("aniso_factor_label"); +} + +const std::string& LLDensityCtrl::NameForDensityProfileType(DensityProfileType t) +{ +    switch (t) +    { +        case Rayleigh:   return DENSITY_RAYLEIGH; +        case Mie:        return DENSITY_MIE; +        case Absorption: return DENSITY_ABSORPTION; +        default: +            break; +    } + +    llassert(false); +    return DENSITY_RAYLEIGH; +} + +LLDensityCtrl::Params::Params() +: image_density_feedback("image_density_feedback") +, lbl_exponential("label_exponential") +, lbl_exponential_scale("label_exponential_scale") +, lbl_linear("label_linear") +, lbl_constant("label_constant") +, lbl_max_altitude("label_max_altitude") +, lbl_aniso_factor("label_aniso_factor") +, profile_type(LLDensityCtrl::Rayleigh) +{ +} + +LLDensityCtrl::LLDensityCtrl(const Params& params) +: mProfileType(params.profile_type) +, mImgDensityFeedback(params.image_density_feedback) +{ + +} + +LLSD LLDensityCtrl::getProfileConfig() +{ +    LLSD config; +    switch (mProfileType) +    { +        case Rayleigh:   return mSkySettings->getRayleighConfigs(); +        case Mie:        return mSkySettings->getMieConfigs(); +        case Absorption: return mSkySettings->getAbsorptionConfigs(); +        default: +            break; +    } +    llassert(false); +    return config; +} + +BOOL LLDensityCtrl::postBuild() +{ +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialScaleFactorChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLinearChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onConstantChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltitudeChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAnisoFactorChanged(); }); + +    if (mProfileType != Mie) +    { +        getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL)->setValue(false); +        getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setVisible(false); +    } + +    return TRUE; +} + +void LLDensityCtrl::setEnabled(BOOL enabled) +{ +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setEnabled(enabled); + +    if (mProfileType == Mie) +    { +        getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setEnabled(enabled); +    } +} + +void LLDensityCtrl::refresh() +{ +    if (!mSkySettings) +    { +        setAllChildrenEnabled(FALSE); +        setEnabled(FALSE); +        return; +    } + +    setEnabled(TRUE); +    setAllChildrenEnabled(TRUE); + +    LLSD config = getProfileConfig(); + +    getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM]); +    getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR]); +    getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM]); +    getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM]); +    getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH]); + +    if (mProfileType == Mie) +    {         +        getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setValue(config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR]); +    } +} + +void LLDensityCtrl::updateProfile() +{ +    F32 exponential_term  = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->getValueF32(); +    F32 exponential_scale = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->getValueF32(); +    F32 linear_term       = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->getValueF32(); +    F32 constant_term     = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->getValueF32(); +    F32 max_alt           = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->getValueF32(); +    F32 aniso_factor      = 0.0f; + +    if (mProfileType == Mie) +    { +        aniso_factor = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->getValueF32(); +    } + +    LLSD profile = LLSettingsSky::createSingleLayerDensityProfile(max_alt, exponential_term, exponential_scale, linear_term, constant_term, aniso_factor); + +    switch (mProfileType) +    { +        case Rayleigh: mSkySettings->setRayleighConfigs(profile); break; +        case Mie: mSkySettings->setMieConfigs(profile); break; +        case Absorption: mSkySettings->setAbsorptionConfigs(profile); break; +        default: +            break; +    } +} + +void LLDensityCtrl::onExponentialChanged() +{ +    updateProfile(); +    updatePreview(); +} + +void LLDensityCtrl::onExponentialScaleFactorChanged() +{ +    updateProfile(); +    updatePreview(); +} + +void LLDensityCtrl::onLinearChanged() +{ +    updateProfile(); +    updatePreview(); +} + +void LLDensityCtrl::onConstantChanged() +{ +    updateProfile(); +    updatePreview(); +} + +void LLDensityCtrl::onMaxAltitudeChanged() +{ +    updateProfile(); +    updatePreview(); +} + +void LLDensityCtrl::onAnisoFactorChanged() +{ +    updateProfile(); +} + +void LLDensityCtrl::updatePreview() +{ +    // AdvancedAtmospherics TODO +    // Generate image according to current density profile +} + diff --git a/indra/newview/lldensityctrl.h b/indra/newview/lldensityctrl.h new file mode 100644 index 0000000000..789022803c --- /dev/null +++ b/indra/newview/lldensityctrl.h @@ -0,0 +1,104 @@ +/** +* @file lldensityctrl.h +* @brief Control for specifying density over a height range for sky settings. +* +* $LicenseInfo:firstyear=2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2011, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA +* $/LicenseInfo$ +*/ + +#ifndef LLDENSITY_CTRL_H +#define LLDENSITY_CTRL_H + +#include "lluictrl.h" +#include "llsettingssky.h" +#include "lltextbox.h" +#include "llsliderctrl.h" + +class LLDensityCtrl : public LLUICtrl +{ +public: +    static const std::string DENSITY_RAYLEIGH; +    static const std::string DENSITY_MIE; +    static const std::string DENSITY_ABSORPTION; + +    // Type of density profile this tab is updating +    enum DensityProfileType +    { +        Rayleigh, +        Mie, +        Absorption +    }; + +    static const std::string& NameForDensityProfileType(DensityProfileType t); + +    struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> +    { +        Optional<LLTextBox::Params>         lbl_exponential, +            lbl_exponential_scale, +            lbl_linear, +            lbl_constant, +            lbl_max_altitude, +            lbl_aniso_factor; + +        Optional<LLSliderCtrl::Params> exponential_slider, +        exponential_scale_slider, +        linear_slider, +        constant_slider, +        aniso_factor_slider; + +        Optional<LLUIImage*> image_density_feedback; + +        DensityProfileType profile_type; +        Params(); +    }; + +    virtual BOOL	        postBuild() override; +    virtual void	        setEnabled(BOOL enabled) override; + +    void setProfileType(DensityProfileType t) { mProfileType = t; } + +    void refresh(); +    void updateProfile(); + +    LLSettingsSky::ptr_t    getSky() const                                          { return mSkySettings; } +    void                    setSky(const LLSettingsSky::ptr_t &sky)                 { mSkySettings = sky; refresh(); } + +protected: +    friend class LLUICtrlFactory; +    LLDensityCtrl(const Params&); + +    LLSD getProfileConfig(); +    void updatePreview(); + +private: +    void onExponentialChanged(); +    void onExponentialScaleFactorChanged(); +    void onLinearChanged(); +    void onConstantChanged(); +    void onMaxAltitudeChanged(); +    void onAnisoFactorChanged(); + +    DensityProfileType    mProfileType = Rayleigh; +    LLUIImage*            mImgDensityFeedback = nullptr; +    LLSettingsSky::ptr_t  mSkySettings; +}; + +#endif LLDENSITY_CTRL_H diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 26454d2bd1..8a2941e20a 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -93,10 +93,6 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass )  void LLDrawPoolWLSky::endRenderPass( S32 pass )  { -    sky_shader   = nullptr; -	cloud_shader = nullptr; -    sun_shader   = nullptr; -    moon_shader  = nullptr;  }  void LLDrawPoolWLSky::beginDeferredPass(S32 pass) @@ -117,10 +113,7 @@ void LLDrawPoolWLSky::beginDeferredPass(S32 pass)  void LLDrawPoolWLSky::endDeferredPass(S32 pass)  { -    sky_shader   = nullptr; -	cloud_shader = nullptr; -    sun_shader   = nullptr; -    moon_shader  = nullptr; +  }  void LLDrawPoolWLSky::renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const @@ -189,12 +182,12 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca  	    sky_shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m); -        // clouds are rendered along with sky in adv atmo +        /* clouds are rendered along with sky in adv atmo          if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex())          {              sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, gSky.mVOSkyp->getCloudNoiseTex());              sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP_NEXT, gSky.mVOSkyp->getCloudNoiseTexNext()); -        } +        }*/          sky_shader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); @@ -237,9 +230,10 @@ void LLDrawPoolWLSky::renderStars(void) const  	// clamping and allow the star_alpha param to brighten the stars.  	LLColor4 star_alpha(LLColor4::black); -    star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 512.f; -     -	// If star brightness is not set, exit +    // *LAPRAS +    star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / (2.f + ((rand() >> 16)/65535.0f)); // twinkle twinkle + +	// If start_brightness is not set, exit  	if( star_alpha.mV[3] < 0.001 )  	{  		LL_DEBUGS("SKY") << "star_brightness below threshold." << LL_ENDL; @@ -299,8 +293,9 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const  	LLGLSPipelineSkyBox gls_sky;  	LLGLEnable blend(GL_BLEND);  	gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - -    F32 star_alpha = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 512.0f; +		 +	// *LAPRAS +    F32 star_alpha = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / (2.f + ((rand() >> 16)/65535.0f)); // twinkle twinkle  	// If start_brightness is not set, exit  	if(star_alpha < 0.001f) @@ -337,11 +332,6 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const      gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);  	gDeferredStarProgram.uniform1f(sCustomAlpha, star_alpha); - -    sStarTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f; - -    gDeferredStarProgram.uniform1f(LLShaderMgr::WATER_TIME, sStarTime); -  	gSky.mVOWLSkyp->drawStars();      gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -385,8 +375,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()      F32 blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor();      bool can_use_vertex_shaders = gPipeline.canUseVertexShaders(); -    bool can_use_windlight_shaders = gPipeline.canUseWindLightShaders(); -  	if (gSky.mVOSkyp->getSun().getDraw() && face && face->getGeomCount())  	{ @@ -400,39 +388,45 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()          if (tex_a || tex_b)          {              // if and only if we have a texture defined, render the sun disc -            if (can_use_vertex_shaders && can_use_windlight_shaders) +            if (can_use_vertex_shaders) +		    { +			    sun_shader->bind(); +            } + +            if (tex_a && (!tex_b || (tex_a == tex_b)))              { -                sun_shader->bind(); - -                if (tex_a && (!tex_b || (tex_a == tex_b))) -                { -                    // Bind current and next sun textures -                    sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); -                    blend_factor = 0; -                } -                else if (tex_b && !tex_a) -                { -                    sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); -                    blend_factor = 0; -                } -                else if (tex_b != tex_a) -                { -                    sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); -                    sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); -                } - -                LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); +                // Bind current and next sun textures +                sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); +                blend_factor = 0; +            } +            else if (tex_b && !tex_a) +            { +                sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); +                blend_factor = 0; +            } +            else if (tex_b != tex_a) +            { +                sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); +                sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); +            } + +		    LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); +            if (can_use_vertex_shaders) +		    {                  sun_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);                  sun_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); +		    } -                LLFacePool::LLOverrideFaceColor color_override(this, color); -                face->renderIndexed(); +		    LLFacePool::LLOverrideFaceColor color_override(this, color); +		    face->renderIndexed(); -                gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -                gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); +            gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +            gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); -                sun_shader->unbind(); +            if (can_use_vertex_shaders) +		    { +			    sun_shader->unbind();              }          }  	} @@ -446,39 +440,46 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()  		LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor()); -        if (can_use_vertex_shaders && can_use_windlight_shaders) -        { -            moon_shader->bind(); +        if (can_use_vertex_shaders) +		{ +			moon_shader->bind(); +        } -            if (tex_a && (!tex_b || (tex_a == tex_b))) -            { -                // Bind current and next sun textures -                moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); -                blend_factor = 0; -            } -            else if (tex_b && !tex_a) -            { -                moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); -                blend_factor = 0; -            } -            else if (tex_b != tex_a) -            { -                moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); -                moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); -            } +        if (tex_a && (!tex_b || (tex_a == tex_b))) +        { +            // Bind current and next sun textures +            moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); +            blend_factor = 0; +        } +        else if (tex_b && !tex_a) +        { +            moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); +            blend_factor = 0; +        } +        else if (tex_b != tex_a) +        { +            moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); +            moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); +        } +        if (can_use_vertex_shaders) +		{              moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);                              moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); +        } -            LLFacePool::LLOverrideFaceColor color_override(this, color); -            face->renderIndexed(); +		LLFacePool::LLOverrideFaceColor color_override(this, color); +		 +		face->renderIndexed(); -            gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -            gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); +        gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +        gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); -            moon_shader->unbind(); -        } -    } +		if (can_use_vertex_shaders) +		{ +			moon_shader->unbind(); +		} +	}      gGL.popMatrix();  } diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 94da304a96..ed60dd4303 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -821,6 +821,11 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky)      {          panel->setSky(p_sky);      } +    panel = dynamic_cast<LLPanelSettingsSkyDensityTab*>(tab_container->getChildView("advanced_atmo_panel")); +    if (panel) +    { +        panel->setSky(p_sky); +    }  }  void LLFloaterEditExtDayCycle::setWaterTabsEnabled(BOOL enable) @@ -857,6 +862,12 @@ void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable)          panel->setEnabled(enable);          panel->setAllChildrenEnabled(enable);      } +    panel = dynamic_cast<LLPanelSettingsSkyDensityTab*>(tab_container->getChildView("advanced_atmo_panel")); +    if (panel) +    { +        panel->setEnabled(enable); +        panel->setAllChildrenEnabled(enable); +    }  }  void LLFloaterEditExtDayCycle::updateButtons() diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 39e37034e7..d38098c0a6 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -599,6 +599,12 @@ BOOL LLFloaterFixedEnvironmentSky::postBuild()      panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); });      mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); +    panel = new LLPanelSettingsSkyDensityTab; +    panel->buildFromFile("panel_settings_sky_density.xml"); +    panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings)); +    panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); +    mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); +      return TRUE;  } diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 59dc7c8a2d..451e15c73d 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -29,10 +29,15 @@  #include "llpaneleditsky.h"  #include "llslider.h" +#include "llsliderctrl.h"  #include "lltexturectrl.h"  #include "llcolorswatch.h"  #include "llvirtualtrackball.h" +#include "llsettingssky.h" +#include "llenvironment.h" +#include "llatmosphere.h" +#pragma optimize("", off)  namespace  {    @@ -70,6 +75,25 @@ namespace      const std::string   FIELD_SKY_MOON_IMAGE("moon_image");      const std::string   FIELD_SKY_MOON_SCALE("moon_scale"); +    const std::string   FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential"); +    const std::string   FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale"); +    const std::string   FIELD_SKY_DENSITY_RAYLEIGH_LINEAR("rayleigh_linear"); +    const std::string   FIELD_SKY_DENSITY_RAYLEIGH_CONSTANT("rayleigh_constant"); +    const std::string   FIELD_SKY_DENSITY_RAYLEIGH_MAX_ALTITUDE("rayleigh_max_altitude"); + +    const std::string   FIELD_SKY_DENSITY_MIE_EXPONENTIAL("mie_exponential"); +    const std::string   FIELD_SKY_DENSITY_MIE_EXPONENTIAL_SCALE("mie_exponential_scale"); +    const std::string   FIELD_SKY_DENSITY_MIE_LINEAR("mie_linear"); +    const std::string   FIELD_SKY_DENSITY_MIE_CONSTANT("mie_constant"); +    const std::string   FIELD_SKY_DENSITY_MIE_ANISO("mie_aniso_factor"); +    const std::string   FIELD_SKY_DENSITY_MIE_MAX_ALTITUDE("mie_max_altitude"); + +    const std::string   FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL("absorption_exponential"); +    const std::string   FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL_SCALE("absorption_exponential_scale"); +    const std::string   FIELD_SKY_DENSITY_ABSORPTION_LINEAR("absorption_linear"); +    const std::string   FIELD_SKY_DENSITY_ABSORPTION_CONSTANT("absorption_constant"); +    const std::string   FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE("absorption_max_altitude"); +      const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f);      const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f);      const F32 SLIDER_SCALE_GLOW_R(20.0f); @@ -81,6 +105,7 @@ namespace  static LLPanelInjector<LLPanelSettingsSkyAtmosTab> t_settings_atmos("panel_settings_atmos");  static LLPanelInjector<LLPanelSettingsSkyCloudTab> t_settings_cloud("panel_settings_cloud");  static LLPanelInjector<LLPanelSettingsSkySunMoonTab> t_settings_sunmoon("panel_settings_sunmoon"); +static LLPanelInjector<LLPanelSettingsSkyDensityTab> t_settings_density("panel_settings_density");  //==========================================================================  LLPanelSettingsSky::LLPanelSettingsSky() : @@ -489,3 +514,243 @@ void LLPanelSettingsSkySunMoonTab::onMoonScaleChanged()      mSkySettings->update();      setIsDirty();  } + +  +LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab() +{     +} + +BOOL LLPanelSettingsSkyDensityTab::postBuild() +{ +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighExponentialChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighExponentialScaleChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighLinearChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighConstantChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighMaxAltitudeChanged(); }); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMieExponentialChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMieExponentialScaleChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMieLinearChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMieConstantChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_ANISO)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMieAnisoFactorChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMieMaxAltitudeChanged(); }); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionExponentialChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionExponentialScaleChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionLinearChanged(); }); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionConstantChanged(); }); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionMaxAltitudeChanged(); }); + +    refresh(); +    return TRUE; +} + +void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled) +{ +    LLPanelSettingsSky::setEnabled(enabled); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_LINEAR)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_CONSTANT)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_MAX_ALTITUDE)->setEnabled(enabled); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL_SCALE)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_LINEAR)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_CONSTANT)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_ANISO)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_MAX_ALTITUDE)->setEnabled(enabled); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL_SCALE)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setEnabled(enabled); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setEnabled(enabled); +} + +void LLPanelSettingsSkyDensityTab::refresh() +{ +    if (!mSkySettings) +    { +        setAllChildrenEnabled(FALSE); +        setEnabled(FALSE); +        return; +    } + +    setEnabled(TRUE); +    setAllChildrenEnabled(TRUE); + +    // Get first (only) profile layer of each type for editing +    LLSD rayleigh_config    = mSkySettings->getRayleighConfig(); +    LLSD mie_config         = mSkySettings->getMieConfig(); +    LLSD absorption_config  = mSkySettings->getAbsorptionConfig(); + +    F32 rayleigh_exponential_term    = rayleigh_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); +    F32 rayleigh_exponential_scale   = rayleigh_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); +    F32 rayleigh_linear_term         = rayleigh_config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); +    F32 rayleigh_constant_term       = rayleigh_config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); +    F32 rayleigh_max_alt             = rayleigh_config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + +    F32 mie_exponential_term         = mie_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); +    F32 mie_exponential_scale        = mie_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); +    F32 mie_linear_term              = mie_config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); +    F32 mie_constant_term            = mie_config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); +    F32 mie_aniso_factor             = mie_config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR].asReal(); +    F32 mie_max_alt                  = mie_config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + +    F32 absorption_exponential_term  = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); +    F32 absorption_exponential_scale = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); +    F32 absorption_linear_term       = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); +    F32 absorption_constant_term     = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); +    F32 absorption_max_alt           = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->setValue(rayleigh_exponential_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->setValue(rayleigh_exponential_scale); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_LINEAR)->setValue(rayleigh_linear_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_CONSTANT)->setValue(rayleigh_constant_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_MAX_ALTITUDE)->setValue(rayleigh_max_alt); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL)->setValue(mie_exponential_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL_SCALE)->setValue(mie_exponential_scale); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_LINEAR)->setValue(mie_linear_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_CONSTANT)->setValue(mie_constant_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_ANISO)->setValue(mie_aniso_factor); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MIE_MAX_ALTITUDE)->setValue(mie_max_alt); + +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL)->setValue(absorption_exponential_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL_SCALE)->setValue(absorption_exponential_scale); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setValue(absorption_linear_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setValue(absorption_constant_term); +    getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setValue(absorption_max_alt); +} + +void LLPanelSettingsSkyDensityTab::updateProfile() +{ +    F32 rayleigh_exponential_term    = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->getValueF32(); +    F32 rayleigh_exponential_scale   = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->getValueF32(); +    F32 rayleigh_linear_term         = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_RAYLEIGH_LINEAR)->getValueF32(); +    F32 rayleigh_constant_term       = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_RAYLEIGH_CONSTANT)->getValueF32(); +    F32 rayleigh_max_alt             = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_RAYLEIGH_MAX_ALTITUDE)->getValueF32(); + +    F32 mie_exponential_term         = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL)->getValueF32(); +    F32 mie_exponential_scale        = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MIE_EXPONENTIAL_SCALE)->getValueF32(); +    F32 mie_linear_term              = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MIE_LINEAR)->getValueF32(); +    F32 mie_constant_term            = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MIE_CONSTANT)->getValueF32(); +    F32 mie_aniso_factor             = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MIE_ANISO)->getValueF32(); +    F32 mie_max_alt                  = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MIE_MAX_ALTITUDE)->getValueF32(); + +    F32 absorption_exponential_term  = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL)->getValueF32(); +    F32 absorption_exponential_scale = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ABSORPTION_EXPONENTIAL_SCALE)->getValueF32(); +    F32 absorption_linear_term       = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->getValueF32(); +    F32 absorption_constant_term     = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->getValueF32(); +    F32 absorption_max_alt           = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->getValueF32(); + +    LLSD rayleigh_config    = LLSettingsSky::createSingleLayerDensityProfile(rayleigh_max_alt, rayleigh_exponential_term, rayleigh_exponential_scale, rayleigh_linear_term, rayleigh_constant_term); +    LLSD mie_config         = LLSettingsSky::createSingleLayerDensityProfile(mie_max_alt, mie_exponential_term, mie_exponential_scale, mie_linear_term, mie_constant_term, mie_aniso_factor); +    LLSD absorption_layer   = LLSettingsSky::createSingleLayerDensityProfile(absorption_max_alt, absorption_exponential_term, absorption_exponential_scale, absorption_linear_term, absorption_constant_term); + +    static LLSD absorption_layer_ozone = LLSettingsSky::createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f); + +    LLSD absorption_config; +    absorption_config.append(absorption_layer); +    absorption_config.append(absorption_layer_ozone); + +    mSkySettings->setRayleighConfigs(rayleigh_config); +    mSkySettings->setMieConfigs(mie_config); +    mSkySettings->setAbsorptionConfigs(absorption_config); + +    mSkySettings->update(); +    setIsDirty(); + +/* +    if (gAtmosphere) +    { +        AtmosphericModelSettings atmospheric_settings; +        LLEnvironment::getAtmosphericModelSettings(atmospheric_settings, mSkySettings); +        gAtmosphere->configureAtmosphericModel(atmospheric_settings); +    } +*/ + +} + +void LLPanelSettingsSkyDensityTab::onRayleighExponentialChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onRayleighExponentialScaleChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onRayleighLinearChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onRayleighConstantChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onRayleighMaxAltitudeChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onMieExponentialChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onMieExponentialScaleChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onMieLinearChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onMieConstantChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onMieAnisoFactorChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onMieMaxAltitudeChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onAbsorptionExponentialChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onAbsorptionExponentialScaleChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onAbsorptionLinearChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onAbsorptionConstantChanged() +{ +    updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onAbsorptionMaxAltitudeChanged() +{ +    updateProfile(); +} diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index ae4f433955..b34271f610 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -29,7 +29,6 @@  #include "llpanel.h"  #include "llsettingssky.h" -  #include "llfloaterfixedenvironment.h"  //========================================================================= @@ -126,4 +125,41 @@ private:      void                    onMoonScaleChanged();      void                    onMoonImageChanged();  }; + +// single subtab of the density settings tab +class LLPanelSettingsSkyDensityTab : public LLPanelSettingsSky +{ +    LOG_CLASS(LLPanelSettingsSkyDensityTab); + +public: +    LLPanelSettingsSkyDensityTab(); + +    virtual BOOL postBuild() override; +    virtual void setEnabled(BOOL enabled) override; + +protected: +    virtual void refresh() override; + +    void onRayleighExponentialChanged(); +    void onRayleighExponentialScaleChanged(); +    void onRayleighLinearChanged(); +    void onRayleighConstantChanged(); +    void onRayleighMaxAltitudeChanged(); + +    void onMieExponentialChanged(); +    void onMieExponentialScaleChanged(); +    void onMieLinearChanged(); +    void onMieConstantChanged(); +    void onMieAnisoFactorChanged(); +    void onMieMaxAltitudeChanged(); + +    void onAbsorptionExponentialChanged(); +    void onAbsorptionExponentialScaleChanged(); +    void onAbsorptionLinearChanged(); +    void onAbsorptionConstantChanged(); +    void onAbsorptionMaxAltitudeChanged(); + +    // update the settings for our profile type +    void updateProfile(); +};  #endif // LLPANEL_EDIT_SKY_H diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml new file mode 100644 index 0000000000..50663e94f6 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml @@ -0,0 +1,274 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<panel +        border="true" +        follows="all" +        label="Density" +        layout="topleft" +        left="0" +        help_topic="sky_density" +        name="panel_settings_sky_density" +        top="0"> +    <layout_stack  +            follows="all" +            layout="topleft" +            left="5" +            top="5" +            right="-5" +            bottom="-5" +            orientation="vertical"> +        <layout_panel +                border="true" +                bevel_style="in" +                auto_resize="true" +                user_resize="true" +                visible="true" +                height="14"> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    left_delta="5" +                    min_val="0" +                    max_val="1" +                    name="rayleigh_exponential" +                    label="Rayleigh Exponential Term:" +                    top_pad="12" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="-1" +                    max_val="1" +                    name="rayleigh_exponential_scale" +                    label="Rayleigh Exponential Scale:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0" +                    max_val="1" +                    name="rayleigh_linear" +                    label="Rayleigh Linear Term:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0" +                    max_val="1" +                    name="rayleigh_constant" +                    label="Rayleigh Constant Term:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="1" +                    initial_value="0" +                    layout="topleft" +                    min_val="1000" +                    max_val="40000" +                    name="rayleigh_max_altitude" +                    label="Rayleigh Max Altitude:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +        </layout_panel> +        <layout_panel +                border="true" +                bevel_style="in" +                auto_resize="true" +                user_resize="true" +                visible="true" +                height="16"> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    left_delta="5" +                    min_val="0" +                    max_val="3.0" +                    name="mie_exponential" +                    label="Mie Exponential Term:" +                    top_pad="12" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="-1" +                    max_val="1" +                    name="mie_exponential_scale" +                    label="Mie Exponential Scale:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0" +                    max_val="3.0" +                    name="mie_linear" +                    label="Mie Linear Term:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0" +                    max_val="10" +                    name="mie_constant" +                    label="Mie Constant Term:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0.2" +                    max_val="1.8" +                    name="mie_aniso_factor" +                    label="Mie Aniso Factor:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="1" +                    initial_value="0" +                    layout="topleft" +                    min_val="1000" +                    max_val="30000" +                    name="mie_max_altitude" +                    label="Mie Max Altitude:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +        </layout_panel> +        <layout_panel +                border="true" +                bevel_style="in" +                auto_resize="true" +                user_resize="true" +                visible="true" +                height="14"> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    left_delta="5" +                    min_val="0" +                    max_val="1" +                    name="absorption_exponential" +                    label="Absorption Exponential Term:" +                    top_pad="8" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="-1" +                    max_val="1" +                    name="absorption_exponential_scale" +                    label="Absorption Exponential Scale:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0" +                    max_val="1" +                    name="absorption_linear" +                    label="Absorption Linear Term:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="0.01" +                    initial_value="0" +                    layout="topleft" +                    min_val="0" +                    max_val="1" +                    name="absorption_constant" +                    label="Absorption Constant Term:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +            <slider +                    decimal_digits="2" +                    follows="left|top" +                    height="14" +                    increment="1" +                    initial_value="0" +                    layout="topleft" +                    min_val="1000" +                    max_val="25000" +                    name="absorption_max_altitude" +                    label="Absorption Max Altitude:" +                    width="400" +                    label_width="160" +                    can_edit_text="true"/> +        </layout_panel> +    </layout_stack> +</panel>  diff --git a/indra/newview/skins/default/xui/en/widgets/density_ctrl.xml b/indra/newview/skins/default/xui/en/widgets/density_ctrl.xml new file mode 100644 index 0000000000..0f3f0159db --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/density_ctrl.xml @@ -0,0 +1,164 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<densityctrl + border="true" + follows="all" + label="Density" + name="density_ctrl" + layout="topleft" + left="0" + top="0" + width="320" + height="240"> +    <text +     follows="left|top" +     height="11" +     layout="topleft" +     left="15" +     top_pad="-5" +     width="120"> +Exponential Term +    </text> +    <slider +     decimal_digits="2" +     follows="left|top" +     height="16" +     increment="0.01" +     initial_value="0" +     layout="topleft" +     left="15" +     min_val="0" +     max_val="1" +     name="level_exponential" +     top_delta="15" +     width="200" +     can_edit_text="true"/> + +    <view +     left_pad="15" +     top="15" +     name="preview_image" +     height="140" +     width="140" +     follows="left|top" +    /> +    <text +     follows="left|top" +     height="11" +     layout="topleft" +     left="15" +     top_pad="-5" +     width="120"> +Exponential Scale Factor +    </text> +    <slider +     decimal_digits="2" +     follows="left|top" +     height="16" +     increment="0.01" +     initial_value="0" +     layout="topleft" +     left="15" +     min_val="0" +     max_val="1" +     name="exponential_scale" +     top_delta="15" +     width="200" +     can_edit_text="true"/> + +    <text +     follows="left|top" +     height="11" +     layout="topleft" +     left="15" +     top_pad="-5" +     width="120"> +Linear Term +    </text> +    <slider +     decimal_digits="2" +     follows="left|top" +     height="16" +     increment="0.01" +     initial_value="0" +     layout="topleft" +     left="15" +     min_val="0" +     max_val="1" +     name="level_linear" +     top_delta="15" +     width="200" +     can_edit_text="true"/> + +    <text +     follows="left|top" +     height="11" +     layout="topleft" +     left="15" +     top_pad="-5" +     width="120"> +Constant Term +    </text> +    <slider +     decimal_digits="2" +     follows="left|top" +     height="16" +     increment="0.01" +     initial_value="0" +     layout="topleft" +     left="15" +     min_val="0" +     max_val="1" +     name="level_constant" +     top_delta="15" +     width="200" +     can_edit_text="true"/> + +    <text +     follows="left|top" +     height="11" +     layout="topleft" +     left="15" +     top_pad="15" +     width="80"> +Max Altitude +    </text> +    <slider +     decimal_digits="0" +     follows="left|top" +     height="16" +     increment="1" +     initial_value="0" +     layout="topleft" +     left="15" +     min_val="1000" +     max_val="40000" +     name="max_altitude" +     top_delta="15" +     width="200" +     can_edit_text="true"/> + +    <text +     follows="left|top" +     height="11" +     layout="topleft" +     name="aniso_factor_label" +     left="15" +     top_pad="15" +     width="80"> +Anisotropy Factor +    </text> +    <slider +     decimal_digits="0" +     follows="left|top" +     height="16" +     increment="1" +     initial_value="0" +     layout="topleft" +     left="15" +     min_val="1000" +     max_val="40000" +     name="aniso_factor" +     top_delta="15" +     width="200" +     can_edit_text="true"/> +</densityctrl> | 
