diff options
author | Rider Linden <rider@lindenlab.com> | 2018-06-12 12:56:53 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-06-12 12:56:53 -0700 |
commit | e2adba65debbd1550a9eaead2a00e1426e8855a8 (patch) | |
tree | 063da30d637ca835919453ebdc5badd31326b9c5 | |
parent | 2add1e7abdf536b32bfbfa4b353189782df8cb19 (diff) | |
parent | 67ab0084f87c40bf31d7fadded55cc9ea6299ca2 (diff) |
Merge
35 files changed, 623 insertions, 380 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f28d90cb62..24e808c92a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -207,7 +207,9 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F if (slerps.find(key_name) != slerps.end()) { - LLQuaternion q = slerp(mix, LLQuaternion(value), LLQuaternion(other_value)); + LLQuaternion a(value); + LLQuaternion b(other_value); + LLQuaternion q = slerp(mix, a, b); newvalue = q.getValue(); } else diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 87233e18c3..009d7b06f2 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -105,8 +105,8 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(300); // 5 mins -const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours +const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(120); // 2 mins +const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 87581e813b..db574f2eec 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -388,6 +388,9 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + mPositionsDirty = true; + mLightingDirty = true; + setBlendFactor(blendf); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -603,7 +606,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; + dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); @@ -779,6 +782,9 @@ void LLSettingsSky::updateSettings() // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); + // NOTE: these functions are designed to do nothing unless a dirty bit has been set + // so if you add new settings that are referenced by these update functions, + // you'll need to insure that your setter updates the dirty bits as well calculateHeavenlyBodyPositions(); calculateLightSettings(); } @@ -797,10 +803,11 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { + /* can't do this as it gets defeated during animation of env panel settings if (!mPositionsDirty) { return; - } + }*/ mPositionsDirty = false; mLightingDirty = true; // changes light direction @@ -1022,12 +1029,13 @@ LLColor4 LLSettingsSky::getTotalAmbient() const void LLSettingsSky::calculateLightSettings() const { + /* can't do this as it gets defeated during animation of env panel settings if (!mLightingDirty) { return; } - calculateHeavenlyBodyPositions(); + calculateHeavenlyBodyPositions();*/ mLightingDirty = false; @@ -1082,3 +1090,271 @@ LLUUID LLSettingsSky::GetDefaultMoonTextureId() { return DEFAULT_MOON_ID; } + +LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() +{ + return DEFAULT_CLOUD_ID; +} + +F32 LLSettingsSky::getPlanetRadius() const +{ + return mSettings[SETTING_PLANET_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSkyBottomRadius() const +{ + return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSkyTopRadius() const +{ + return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSunArcRadians() const +{ + return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); +} + +F32 LLSettingsSky::getMieAnisotropy() const +{ + return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); +} + +LLSD LLSettingsSky::getRayleighConfigs() const +{ + return mSettings[SETTING_RAYLEIGH_CONFIG]; +} + +LLSD LLSettingsSky::getMieConfigs() const +{ + return mSettings[SETTING_MIE_CONFIG]; +} + +LLSD LLSettingsSky::getAbsorptionConfigs() const +{ + return mSettings[SETTING_ABSORPTION_CONFIG]; +} + +LLUUID LLSettingsSky::getBloomTextureId() const +{ + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); +} + +//--------------------------------------------------------------------- +LLColor3 LLSettingsSky::getAmbientColor() const +{ + return LLColor3(mSettings[SETTING_AMBIENT]); +} + +void LLSettingsSky::setAmbientColor(const LLColor3 &val) +{ + setValue(SETTING_AMBIENT, val); + mLightingDirty = true; +} + +LLColor3 LLSettingsSky::getCloudColor() const +{ + return LLColor3(mSettings[SETTING_CLOUD_COLOR]); +} + +void LLSettingsSky::setCloudColor(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_COLOR, val); +} + +LLUUID LLSettingsSky::getCloudNoiseTextureId() const +{ + return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setCloudNoiseTextureId(const LLUUID &id) +{ + setValue(SETTING_CLOUD_TEXTUREID, id); +} + +LLColor3 LLSettingsSky::getCloudPosDensity1() const +{ + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); +} + +void LLSettingsSky::setCloudPosDensity1(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_POS_DENSITY1, val); +} + +LLColor3 LLSettingsSky::getCloudPosDensity2() const +{ + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); +} + +void LLSettingsSky::setCloudPosDensity2(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_POS_DENSITY2, val); +} + +F32 LLSettingsSky::getCloudScale() const +{ + return mSettings[SETTING_CLOUD_SCALE].asReal(); +} + +void LLSettingsSky::setCloudScale(F32 val) +{ + setValue(SETTING_CLOUD_SCALE, val); +} + +LLVector2 LLSettingsSky::getCloudScrollRate() const +{ + return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]); +} + +void LLSettingsSky::setCloudScrollRate(const LLVector2 &val) +{ + setValue(SETTING_CLOUD_SCROLL_RATE, val); +} + +void LLSettingsSky::setCloudScrollRateX(F32 val) +{ + mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val; + setDirtyFlag(true); +} + +void LLSettingsSky::setCloudScrollRateY(F32 val) +{ + mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val; + setDirtyFlag(true); +} + +F32 LLSettingsSky::getCloudShadow() const +{ + return mSettings[SETTING_CLOUD_SHADOW].asReal(); +} + +void LLSettingsSky::setCloudShadow(F32 val) +{ + setValue(SETTING_CLOUD_SHADOW, val); + mLightingDirty = true; +} + +F32 LLSettingsSky::getDomeOffset() const +{ + //return mSettings[SETTING_DOME_OFFSET].asReal(); + return DOME_OFFSET; +} + +F32 LLSettingsSky::getDomeRadius() const +{ + //return mSettings[SETTING_DOME_RADIUS].asReal(); + return DOME_RADIUS; +} + +F32 LLSettingsSky::getGamma() const +{ + return mSettings[SETTING_GAMMA].asReal(); +} + +void LLSettingsSky::setGamma(F32 val) +{ + mSettings[SETTING_GAMMA] = LLSD::Real(val); + setDirtyFlag(true); + mLightingDirty = true; +} + +LLColor3 LLSettingsSky::getGlow() const +{ + return LLColor3(mSettings[SETTING_GLOW]); +} + +void LLSettingsSky::setGlow(const LLColor3 &val) +{ + setValue(SETTING_GLOW, val); + mLightingDirty = true; +} + +F32 LLSettingsSky::getMaxY() const +{ + return mSettings[SETTING_MAX_Y].asReal(); +} + +void LLSettingsSky::setMaxY(F32 val) +{ + setValue(SETTING_MAX_Y, val); +} + +LLQuaternion LLSettingsSky::getMoonRotation() const +{ + return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); +} + +void LLSettingsSky::setMoonRotation(const LLQuaternion &val) +{ + setValue(SETTING_MOON_ROTATION, val); + mPositionsDirty = true; +} + +LLUUID LLSettingsSky::getMoonTextureId() const +{ + return mSettings[SETTING_MOON_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setMoonTextureId(LLUUID id) +{ + setValue(SETTING_MOON_TEXTUREID, id); +} + +F32 LLSettingsSky::getStarBrightness() const +{ + return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); +} + +void LLSettingsSky::setStarBrightness(F32 val) +{ + setValue(SETTING_STAR_BRIGHTNESS, val); +} + +LLColor3 LLSettingsSky::getSunlightColor() const +{ + return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); +} + +void LLSettingsSky::setSunlightColor(const LLColor3 &val) +{ + setValue(SETTING_SUNLIGHT_COLOR, val); + mLightingDirty = true; +} + +LLQuaternion LLSettingsSky::getSunRotation() const +{ + return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); +} + +void LLSettingsSky::setSunRotation(const LLQuaternion &val) +{ + setValue(SETTING_SUN_ROTATION, val); + mPositionsDirty = true; +} + +LLUUID LLSettingsSky::getSunTextureId() const +{ + return mSettings[SETTING_SUN_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setSunTextureId(LLUUID id) +{ + setValue(SETTING_SUN_TEXTUREID, id); +} + +LLUUID LLSettingsSky::getNextSunTextureId() const +{ + return mNextSunTextureId; +} + +LLUUID LLSettingsSky::getNextMoonTextureId() const +{ + return mNextMoonTextureId; +} + +LLUUID LLSettingsSky::getNextCloudNoiseTextureId() const +{ + return mNextCloudTextureId; +} diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index a206106945..a557080744 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -105,274 +105,85 @@ public: static LLSD defaults(); - F32 getPlanetRadius() const - { - return mSettings[SETTING_PLANET_RADIUS].asReal(); - } - - F32 getSkyBottomRadius() const - { - return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); - } - - F32 getSkyTopRadius() const - { - return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); - } - - F32 getSunArcRadians() const - { - return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); - } - - F32 getMieAnisotropy() const - { - return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); - } - - LLSD getRayleighConfigs() const - { - return mSettings[SETTING_RAYLEIGH_CONFIG]; - } - - LLSD getMieConfigs() const - { - return mSettings[SETTING_MIE_CONFIG]; - } - - LLSD getAbsorptionConfigs() const - { - return mSettings[SETTING_ABSORPTION_CONFIG]; - } - - LLUUID getBloomTextureId() const - { - return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); - } + F32 getPlanetRadius() const; + F32 getSkyBottomRadius() const; + F32 getSkyTopRadius() const; + F32 getSunArcRadians() const; + F32 getMieAnisotropy() const; + LLSD getRayleighConfigs() const; + LLSD getMieConfigs() const; + + LLSD getAbsorptionConfigs() const; + LLUUID getBloomTextureId() const; //--------------------------------------------------------------------- - LLColor3 getAmbientColor() const - { - return LLColor3(mSettings[SETTING_AMBIENT]); - } - - void setAmbientColor(const LLColor3 &val) - { - setValue(SETTING_AMBIENT, val); - mLightingDirty = true; - } - - LLColor3 getCloudColor() const - { - return LLColor3(mSettings[SETTING_CLOUD_COLOR]); - } - - void setCloudColor(const LLColor3 &val) - { - setValue(SETTING_CLOUD_COLOR, val); - } - - LLUUID getCloudNoiseTextureId() const - { - return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); - } - - void setCloudNoiseTextureId(const LLUUID &id) - { - setValue(SETTING_CLOUD_TEXTUREID, id); - } - - LLColor3 getCloudPosDensity1() const - { - return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); - } - - void setCloudPosDensity1(const LLColor3 &val) - { - setValue(SETTING_CLOUD_POS_DENSITY1, val); - } - - LLColor3 getCloudPosDensity2() const - { - return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); - } - - void setCloudPosDensity2(const LLColor3 &val) - { - setValue(SETTING_CLOUD_POS_DENSITY2, val); - } - - F32 getCloudScale() const - { - return mSettings[SETTING_CLOUD_SCALE].asReal(); - } - - void setCloudScale(F32 val) - { - setValue(SETTING_CLOUD_SCALE, val); - } - - LLVector2 getCloudScrollRate() const - { - return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]); - } - - void setCloudScrollRate(const LLVector2 &val) - { - setValue(SETTING_CLOUD_SCROLL_RATE, val); - } - - void setCloudScrollRateX(F32 val) - { - mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val; - setDirtyFlag(true); - } - - void setCloudScrollRateY(F32 val) - { - mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val; - setDirtyFlag(true); - } - - F32 getCloudShadow() const - { - return mSettings[SETTING_CLOUD_SHADOW].asReal(); - } - - void setCloudShadow(F32 val) - { - setValue(SETTING_CLOUD_SHADOW, val); - mLightingDirty = true; - } + LLColor3 getAmbientColor() const; + void setAmbientColor(const LLColor3 &val); + + LLColor3 getCloudColor() const; + void setCloudColor(const LLColor3 &val); + + LLUUID getCloudNoiseTextureId() const; + void setCloudNoiseTextureId(const LLUUID &id); + + LLColor3 getCloudPosDensity1() const; + void setCloudPosDensity1(const LLColor3 &val); + + LLColor3 getCloudPosDensity2() const; + void setCloudPosDensity2(const LLColor3 &val); + F32 getCloudScale() const; + void setCloudScale(F32 val); + + LLVector2 getCloudScrollRate() const; + void setCloudScrollRate(const LLVector2 &val); + + void setCloudScrollRateX(F32 val); + void setCloudScrollRateY(F32 val); + + F32 getCloudShadow() const; + void setCloudShadow(F32 val); - F32 getDomeOffset() const - { - return DOME_OFFSET; - //return mSettings[SETTING_DOME_OFFSET].asReal(); - } - - F32 getDomeRadius() const - { - return DOME_RADIUS; - //return mSettings[SETTING_DOME_RADIUS].asReal(); - } - - F32 getGamma() const - { - return mSettings[SETTING_GAMMA].asReal(); - } - - void setGamma(F32 val) - { - mSettings[SETTING_GAMMA] = LLSD::Real(val); - setDirtyFlag(true); - mLightingDirty = true; - } - - LLColor3 getGlow() const - { - return LLColor3(mSettings[SETTING_GLOW]); - } - - void setGlow(const LLColor3 &val) - { - setValue(SETTING_GLOW, val); - } - - F32 getMaxY() const - { - return mSettings[SETTING_MAX_Y].asReal(); - } - - void setMaxY(F32 val) - { - setValue(SETTING_MAX_Y, val); - mLightingDirty = true; - } - - LLQuaternion getMoonRotation() const - { - return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); - } - - void setMoonRotation(const LLQuaternion &val) - { - setValue(SETTING_MOON_ROTATION, val); - mPositionsDirty = true; - } - - LLUUID getMoonTextureId() const - { - return mSettings[SETTING_MOON_TEXTUREID].asUUID(); - } - - void setMoonTextureId(LLUUID id) - { - setValue(SETTING_MOON_TEXTUREID, id); - } - - F32 getStarBrightness() const - { - return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); - } - - void setStarBrightness(F32 val) - { - setValue(SETTING_STAR_BRIGHTNESS, val); - } - - LLColor3 getSunlightColor() const - { - return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); - } - - void setSunlightColor(const LLColor3 &val) - { - setValue(SETTING_SUNLIGHT_COLOR, val); - mLightingDirty = true; - } - - LLQuaternion getSunRotation() const - { - return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); - } - - void setSunRotation(const LLQuaternion &val) - { - setValue(SETTING_SUN_ROTATION, val); - mPositionsDirty = true; - } - - LLUUID getSunTextureId() const - { - return mSettings[SETTING_SUN_TEXTUREID].asUUID(); - } - - void setSunTextureId(LLUUID id) - { - setValue(SETTING_SUN_TEXTUREID, id); - } + F32 getDomeOffset() const; + F32 getDomeRadius() const; - //===================================================================== - // transient properties used in animations. - LLUUID getNextSunTextureId() const - { - return mNextSunTextureId; - } + F32 getGamma() const; + + void setGamma(F32 val); - LLUUID getNextMoonTextureId() const - { - return mNextMoonTextureId; - } + LLColor3 getGlow() const; + void setGlow(const LLColor3 &val); - LLUUID getNextCloudNoiseTextureId() const - { - return mNextCloudTextureId; - } + F32 getMaxY() const; + + void setMaxY(F32 val); + + LLQuaternion getMoonRotation() const; + void setMoonRotation(const LLQuaternion &val); + + LLUUID getMoonTextureId() const; + void setMoonTextureId(LLUUID id); + + F32 getStarBrightness() const; + void setStarBrightness(F32 val); + + LLColor3 getSunlightColor() const; + void setSunlightColor(const LLColor3 &val); + + LLQuaternion getSunRotation() const; + void setSunRotation(const LLQuaternion &val) ; + + LLUUID getSunTextureId() const; + void setSunTextureId(LLUUID id); //===================================================================== - virtual void loadTextures() { }; + // transient properties used in animations. + LLUUID getNextSunTextureId() const; + LLUUID getNextMoonTextureId() const; + LLUUID getNextCloudNoiseTextureId() const; + + //===================================================================== + virtual void loadTextures() { }; //===================================================================== virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; @@ -387,7 +198,6 @@ public: LLColor3 getLightTransmittance() const; LLColor3 gammaCorrect(const LLColor3& in) const; - LLColor3 getBlueDensity() const; LLColor3 getBlueHorizon() const; F32 getHazeDensity() const; @@ -421,6 +231,7 @@ public: static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultSunTextureId(); static LLUUID GetDefaultMoonTextureId(); + static LLUUID GetDefaultCloudNoiseTextureId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ebdfbd89b2..037786ec49 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1149,6 +1149,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("bumpMap"); mReservedUniforms.push_back("environmentMap"); mReservedUniforms.push_back("cloud_noise_texture"); + mReservedUniforms.push_back("cloud_noise_texture_next"); mReservedUniforms.push_back("fullbright"); mReservedUniforms.push_back("lightnorm"); mReservedUniforms.push_back("sunlight_color"); @@ -1211,6 +1212,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("spot_shadow_bias"); mReservedUniforms.push_back("spot_shadow_offset"); mReservedUniforms.push_back("sun_dir"); + mReservedUniforms.push_back("moon_dir"); mReservedUniforms.push_back("shadow_res"); mReservedUniforms.push_back("proj_shadow_res"); mReservedUniforms.push_back("depth_cutoff"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 3fac21883f..53d59dbbf8 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -79,6 +79,7 @@ public: BUMP_MAP, ENVIRONMENT_MAP, CLOUD_NOISE_MAP, + CLOUD_NOISE_MAP_NEXT, FULLBRIGHT, LIGHTNORM, SUNLIGHT_COLOR, @@ -133,6 +134,7 @@ public: DEFERRED_SPOT_SHADOW_BIAS, DEFERRED_SPOT_SHADOW_OFFSET, DEFERRED_SUN_DIR, + DEFERRED_MOON_DIR, DEFERRED_SHADOW_RES, DEFERRED_PROJ_SHADOW_RES, DEFERRED_DEPTH_CUTOFF, diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 2234ceeb53..8dda96984e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -43,6 +43,7 @@ uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; +uniform vec3 moon_dir; #if HAS_SHADOW uniform sampler2DShadow shadowMap0; @@ -287,7 +288,10 @@ void main() vec2 abnormal = encode_normal(norm.xyz); norm.xyz = decode_normal(abnormal.xy); - float da = dot(norm.xyz, sun_dir.xyz); + float da_sun = dot(norm.xyz, sun_dir.xyz); + float da_moon = dot(norm.xyz, moon_dir.xyz); + + float da = max(da_sun, da_moon); float final_da = da; final_da = min(final_da, shadow); diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index 7b971fcc66..1a4cdff23d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -39,6 +39,8 @@ VARYING vec4 vary_CloudColorAmbient; VARYING float vary_CloudDensity; uniform sampler2D cloud_noise_texture; +uniform sampler2D cloud_noise_texture_next; +uniform float blend_factor; uniform vec4 cloud_pos_density1; uniform vec4 cloud_pos_density2; uniform vec4 gamma; @@ -57,6 +59,14 @@ vec3 scaleSoftClip(vec3 light) { return light; } +vec4 cloudNoise(vec2 uv) +{ + vec4 a = texture2D(cloud_noise_texture, uv); + vec4 b = texture2D(cloud_noise_texture_next, uv); + vec4 cloud_noise_sample = mix(a, b, blend_factor); + return cloud_noise_sample; +} + void main() { // Set variables @@ -77,7 +87,7 @@ void main() // Compute alpha1, the main cloud opacity - float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; + float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); // And smooth @@ -87,7 +97,7 @@ void main() // Compute alpha2, for self shadowing effect // (1 - alpha2) will later be used as percentage of incoming sunlight - float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); + float alpha2 = (cloudNoise(uv2).x - 0.5); alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); // And smooth diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index a90e433622..4dc15dbc89 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -98,6 +98,7 @@ uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; +uniform vec3 moon_dir; VARYING vec2 vary_fragcoord; VARYING vec3 vary_position; @@ -388,7 +389,9 @@ void main() vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - float da =dot(norm.xyz, sun_dir.xyz); + float da_sun =dot(norm.xyz, sun_dir.xyz); + float da_moon =dot(norm.xyz, moon_dir.xyz); + float da = max(da_sun, da_moon); float final_da = da; final_da = min(final_da, shadow); @@ -418,7 +421,10 @@ void main() // the old infinite-sky shiny reflection // - float sa = dot(refnormpersp, sun_dir.xyz); + float sa_sun = dot(refnormpersp, sun_dir.xyz); + float sa_moon = dot(refnormpersp, moon_dir.xyz); + float sa = max(sa_sun, sa_moon); + vec3 dumbshiny = sunlit*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r); // add the two types of shiny together diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 4511237e4d..8e4696cfaa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -37,7 +37,6 @@ out vec4 frag_data[3]; VARYING vec4 vary_HazeColor; -uniform sampler2D cloud_noise_texture; uniform vec4 gamma; /// Soft clips the light with a gamma correction diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index fbfd43a4da..a4543c325e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -56,6 +56,7 @@ uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; +uniform vec3 moon_dir; VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; @@ -106,7 +107,9 @@ void main() float envIntensity = norm.z; norm.xyz = decode_normal(norm.xy); // unpack norm - float da = dot(norm.xyz, sun_dir.xyz); + float da_sun = dot(norm.xyz, sun_dir.xyz); + float da_moon = dot(norm.xyz, moon_dir.xyz); + float da = max(da_sun, da_moon); float final_da = max(0.0,da); final_da = min(final_da, 1.0f); @@ -148,7 +151,10 @@ void main() // the old infinite-sky shiny reflection // - float sa = dot(refnormpersp, sun_dir.xyz); + float sa_sun = dot(refnormpersp, sun_dir.xyz); + float sa_moon = dot(refnormpersp, moon_dir.xyz); + float sa = max(sa_sun, sa_moon); + vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); // add the two types of shiny together diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index a7c28a1ac3..68ce2843d0 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -25,7 +25,6 @@ -uniform vec4 lightnorm; uniform vec4 waterPlane; uniform vec4 waterFogColor; uniform float waterFogDensity; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 9f56bff4c2..5046ede00d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -49,7 +49,6 @@ uniform vec4 morphFactor; uniform vec3 camPosLocal; //uniform vec4 camPosWorld; uniform vec4 gamma; -uniform vec4 lightnorm; uniform vec4 sunlight_color; uniform vec4 ambient; uniform vec4 blue_horizon; @@ -68,6 +67,7 @@ uniform vec4 shadow_clip; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; +uniform vec3 moon_dir; VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; @@ -117,7 +117,9 @@ void main() float envIntensity = norm.z; norm.xyz = decode_normal(norm.xy); // unpack norm - float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); + float da_sun = max(dot(norm.xyz, sun_dir.xyz), 0.0); + float da_moon = max(dot(norm.xyz, moon_dir.xyz), 0.0); + float da = max(da_sun, da_moon); float light_gamma = 1.0/1.3; da = pow(da, light_gamma); @@ -168,7 +170,9 @@ void main() // the old infinite-sky shiny reflection // - float sa = dot(refnormpersp, sun_dir.xyz); + float sa_sun = dot(refnormpersp, sun_dir.xyz); + float sa_moon = dot(refnormpersp, moon_dir.xyz); + float sa = max(sa_sun, sa_moon); vec3 dumbshiny = sunlit*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r); // add the two types of shiny together diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index aa5e99a2f7..11ccdf638c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -59,6 +59,7 @@ uniform mat4 inv_proj; uniform vec2 screen_res; uniform vec2 proj_shadow_res; uniform vec3 sun_dir; +uniform vec3 moon_dir; uniform vec2 shadow_res; uniform float shadow_bias; @@ -139,10 +140,14 @@ void main() }*/ float shadow = 0.0; - float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); + float da_sun = dot(norm, sun_dir.xyz); + float da_moon = dot(norm, moon_dir.xyz); + float da = max(da_sun, da_moon); + + float dp_directional_light = max(0.0, da); vec3 shadow_pos = pos.xyz; - vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); + vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 58f3f2f91e..4fccb1d33c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -59,6 +59,7 @@ uniform mat4 inv_proj; uniform vec2 screen_res; uniform vec2 proj_shadow_res; uniform vec3 sun_dir; +uniform vec3 moon_dir; uniform vec2 shadow_res; @@ -200,10 +201,13 @@ void main() }*/ float shadow = 0.0; - float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); + float da_sun = dot(norm, sun_dir.xyz); + float da_moon = dot(norm, moon_dir.xyz); + float da = max(da_sun, da_moon); + float dp_directional_light = max(0.0, da); vec3 shadow_pos = pos.xyz; - vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); + vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 96c70651b1..e0c7e18a6f 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -42,6 +42,8 @@ VARYING vec2 vary_texcoord2; VARYING vec2 vary_texcoord3; uniform sampler2D cloud_noise_texture; +uniform sampler2D cloud_noise_texture_next; +uniform float blend_factor; uniform vec4 cloud_pos_density1; uniform vec4 cloud_pos_density2; uniform vec4 gamma; @@ -55,6 +57,14 @@ vec3 scaleSoftClip(vec3 light) { return light; } +vec4 cloudNoise(vec2 uv) +{ + vec4 a = texture2D(cloud_noise_texture, uv); + vec4 b = texture2D(cloud_noise_texture_next, uv); + vec4 samp = mix(a, b, blend_factor); + return samp; +} + void main() { // Set variables @@ -75,7 +85,7 @@ void main() // Compute alpha1, the main cloud opacity - float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; + float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); // And smooth @@ -85,7 +95,7 @@ void main() // Compute alpha2, for self shadowing effect // (1 - alpha2) will later be used as percentage of incoming sunlight - float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); + float alpha2 = (cloudNoise(uv2).x - 0.5); alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); // And smooth diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index 2a0ca35278..25fd0584f8 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -35,7 +35,6 @@ out vec4 frag_color; VARYING vec4 vary_HazeColor; -uniform sampler2D cloud_noise_texture; uniform vec4 gamma; /// Soft clips the light with a gamma correction diff --git a/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl index 96c70651b1..44b41cc0b8 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl @@ -42,10 +42,21 @@ VARYING vec2 vary_texcoord2; VARYING vec2 vary_texcoord3; uniform sampler2D cloud_noise_texture; +uniform sampler2D cloud_noise_texture_next; +uniform float blend_factor; uniform vec4 cloud_pos_density1; uniform vec4 cloud_pos_density2; uniform vec4 gamma; +vec4 cloudNoise(vec2 uv) +{ + vec4 a = texture2D(cloud_noise_texture, uv); + vec4 b = texture2D(cloud_noise_texture_next, uv); + vec4 samp = mix(a, b, blend_factor); + return samp; +} + + /// Soft clips the light with a gamma correction vec3 scaleSoftClip(vec3 light) { //soft clip effect: @@ -75,7 +86,7 @@ void main() // Compute alpha1, the main cloud opacity - float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; + float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); // And smooth @@ -85,7 +96,7 @@ void main() // Compute alpha2, for self shadowing effect // (1 - alpha2) will later be used as percentage of incoming sunlight - float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); + float alpha2 = (cloudNoise(uv2).x - 0.5); alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); // And smooth diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 5185a9f8f4..0fb990611e 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -34,18 +34,18 @@ in vec3 view_dir; uniform vec3 cameraPosLocal; uniform vec3 sun_dir; +uniform vec3 moon_dir; uniform float sun_size; -uniform sampler2D cloud_noise_texture; uniform sampler2D transmittance_texture; uniform sampler3D scattering_texture; uniform sampler3D single_mie_scattering_texture; uniform sampler2D irradiance_texture; vec3 GetSolarLuminance(); -vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance); -vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 sun_dir, out vec3 transmittance); -vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 sun_dir, out vec3 sky_irradiance); +vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance); +vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir, out vec3 transmittance); +vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 dir, out vec3 sky_irradiance); void main() { @@ -56,8 +56,9 @@ void main() vec3 camPos = cameraPosLocal + vec3(0, 0, 6360.0f); vec3 transmittance; vec3 sky_illum; - vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); - vec3 radiance2 = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum); + + vec3 radiance_sun = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); + vec3 radiance2_sun = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum); radiance *= transmittance; diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl index fed3edf7de..bdb54a1d63 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl @@ -33,6 +33,7 @@ in vec3 view_dir; uniform vec3 cameraPosLocal; uniform vec3 sun_dir; +uniform vec3 moon_dir; uniform float sun_size; uniform sampler2D transmittance_texture; diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 3e74b06a7f..4b77e18c15 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -46,10 +46,6 @@ static LLStaticHashedString sCamPosLocal("camPosLocal"); -LLPointer<LLViewerTexture> LLDrawPoolWLSky::sCloudNoiseTexture = NULL; - -LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL; - static LLGLSLShader* cloud_shader = NULL; static LLGLSLShader* sky_shader = NULL; static LLGLSLShader* moon_shader = NULL; @@ -57,40 +53,10 @@ static LLGLSLShader* moon_shader = NULL; LLDrawPoolWLSky::LLDrawPoolWLSky(void) : LLDrawPool(POOL_WL_SKY) { - const std::string cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "clouds2.tga")); - LL_INFOS() << "loading WindLight cloud noise from " << cloudNoiseFilename << LL_ENDL; - - LLPointer<LLImageFormatted> cloudNoiseFile(LLImageFormatted::createFromExtension(cloudNoiseFilename)); - - if(cloudNoiseFile.isNull()) { - LL_ERRS() << "Error: Failed to load cloud noise image " << cloudNoiseFilename << LL_ENDL; - } - - if(cloudNoiseFile->load(cloudNoiseFilename)) - { - sCloudNoiseRawImage = new LLImageRaw(); - - if(cloudNoiseFile->decode(sCloudNoiseRawImage, 0.0f)) - { - //debug use - LL_DEBUGS() << "cloud noise raw image width: " << sCloudNoiseRawImage->getWidth() << " : height: " << sCloudNoiseRawImage->getHeight() << " : components: " << - (S32)sCloudNoiseRawImage->getComponents() << " : data size: " << sCloudNoiseRawImage->getDataSize() << LL_ENDL ; - llassert_always(sCloudNoiseRawImage->getData()) ; - - sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE); - } - else - { - sCloudNoiseRawImage = NULL ; - } - } } LLDrawPoolWLSky::~LLDrawPoolWLSky() { - //LL_INFOS() << "destructing wlsky draw pool." << LL_ENDL; - sCloudNoiseTexture = NULL; - sCloudNoiseRawImage = NULL; } LLViewerTexture *LLDrawPoolWLSky::getDebugTexture() @@ -185,16 +151,19 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca sky_shader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLVector4 light_dir = LLEnvironment::instance().getClampedLightNorm(); + LLVector4 sun_dir = LLEnvironment::instance().getClampedSunNorm(); + LLVector4 moon_dir = LLEnvironment::instance().getClampedMoonNorm(); F32 sunSize = (float)cosf(psky->getSunArcRadians()); sky_shader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize); - sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, light_dir.mV); + sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, sun_dir.mV); + sky_shader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, moon_dir.mV); // clouds are rendered along with sky in adv atmo - if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull()) + if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) { - sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, sCloudNoiseTexture); + sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, gSky.mVOSkyp->getCloudNoiseTex()); + sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP_NEXT, gSky.mVOSkyp->getCloudNoiseTexNext()); } renderFsSky(camPosLocal, camHeightLocal, sky_shader); @@ -280,22 +249,23 @@ void LLDrawPoolWLSky::renderStars(void) const void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal) const { -#if REMOVE_BEFORE_FLIGHT - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull()) + if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) { LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ALPHA); - gGL.getTexUnit(0)->bind(sCloudNoiseTexture); + gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getCloudNoiseTex()); + gGL.getTexUnit(1)->bind(gSky.mVOSkyp->getCloudNoiseTexNext()); cloud_shader->bind(); + F32 blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor(); + cloud_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); /// Render the skydome renderDome(camPosLocal, camHeightLocal, cloud_shader); cloud_shader->unbind(); } -#endif } void LLDrawPoolWLSky::renderHeavenlyBodies() @@ -477,15 +447,9 @@ void LLDrawPoolWLSky::resetDrawOrders() //static void LLDrawPoolWLSky::cleanupGL() { - sCloudNoiseTexture = NULL; } //static void LLDrawPoolWLSky::restoreGL() { - if(sCloudNoiseRawImage.notNull()) - { - sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE); - } } - diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index 2beb2867db..db08d9b99a 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -81,10 +81,6 @@ private: void renderStars(void) const; void renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal) const; void renderHeavenlyBodies(); - -private: - static LLPointer<LLViewerTexture> sCloudNoiseTexture; - static LLPointer<LLImageRaw> sCloudNoiseRawImage; }; #endif // LL_DRAWPOOLWLSKY_H diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 632f16c7fa..938cf857ee 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -704,6 +704,18 @@ void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool f } } +LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const +{ + LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f); + return vec_cfr; +} + +LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const +{ + LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f); + return vec_ogl; +} + LLVector3 LLEnvironment::getLightDirection() const { LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); @@ -714,16 +726,24 @@ LLVector3 LLEnvironment::getLightDirection() const return psky->getLightDirection(); } -LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const +LLVector3 LLEnvironment::getSunDirection() const { - LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f); - return vec_cfr; + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + if (!psky) + { + return LLVector3(0, 0, 1); + } + return psky->getSunDirection(); } -LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const +LLVector3 LLEnvironment::getMoonDirection() const { - LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f); - return vec_ogl; + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + if (!psky) + { + return LLVector3(0, 0, -1); + } + return psky->getMoonDirection(); } LLVector4 LLEnvironment::getLightDirectionCFR() const @@ -733,6 +753,20 @@ LLVector4 LLEnvironment::getLightDirectionCFR() const return light_direction_cfr; } +LLVector4 LLEnvironment::getSunDirectionCFR() const +{ + LLVector3 light_direction = getSunDirection(); + LLVector4 light_direction_cfr = toCFR(light_direction); + return light_direction_cfr; +} + +LLVector4 LLEnvironment::getMoonDirectionCFR() const +{ + LLVector3 light_direction = getMoonDirection(); + LLVector4 light_direction_cfr = toCFR(light_direction); + return light_direction_cfr; +} + LLVector4 LLEnvironment::getClampedLightNorm() const { LLVector3 light_direction = getLightDirection(); @@ -743,6 +777,26 @@ LLVector4 LLEnvironment::getClampedLightNorm() const return toLightNorm(light_direction); } +LLVector4 LLEnvironment::getClampedSunNorm() const +{ + LLVector3 light_direction = getSunDirection(); + if (light_direction.mV[2] < -0.1f) + { + light_direction.mV[2] = -0.1f; + } + return toLightNorm(light_direction); +} + +LLVector4 LLEnvironment::getClampedMoonNorm() const +{ + LLVector3 light_direction = getMoonDirection(); + if (light_direction.mV[2] < -0.1f) + { + light_direction.mV[2] = -0.1f; + } + return toLightNorm(light_direction); +} + LLVector4 LLEnvironment::getRotatedLightNorm() const { LLVector3 light_direction = getLightDirection(); diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 9da6de60ae..0fdedb91f7 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -193,14 +193,20 @@ public: // Returns either sun or moon direction (depending on which is up and stronger) // Light direction in +x right, +z up, +y at internal coord sys - LLVector3 getLightDirection() const; + LLVector3 getLightDirection() const; // returns sun or moon depending on which is up + LLVector3 getSunDirection() const; + LLVector3 getMoonDirection() const; // Returns light direction converted to CFR coord system - LLVector4 getLightDirectionCFR() const; + LLVector4 getLightDirectionCFR() const; // returns sun or moon depending on which is up + LLVector4 getSunDirectionCFR() const; + LLVector4 getMoonDirectionCFR() const; // Returns light direction converted to OGL coord system // and clamped above -0.1f in Y to avoid render artifacts in sky shaders - LLVector4 getClampedLightNorm() const; + LLVector4 getClampedLightNorm() const; // returns sun or moon depending on which is up + LLVector4 getClampedSunNorm() const; + LLVector4 getClampedMoonNorm() const; // Returns light direction converted to OGL coord system // and rotated by last cam yaw needed by water rendering shaders diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 131ce31187..7815f4244a 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -409,7 +409,9 @@ void LLFloaterEditExtDayCycle::onTrackSelectionCallback(const LLSD& user_data) void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) { std::string action = user_data.asString(); + F32 frame = mTimeSlider->getCurSliderValue(); + if (action == ACTION_PLAY) { startPlay(); @@ -423,13 +425,13 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) F32 new_frame = 0; if (action == ACTION_FORWARD) { - new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame); + new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame + (mTimeSlider->getIncrement() / 2)); } else if (action == ACTION_BACK) { new_frame = mEditDay->getLowerBoundFrame(mCurrentTrack, frame - (mTimeSlider->getIncrement() / 2)); } - selectFrame(new_frame); + selectFrame(new_frame, 0.0f); stopPlay(); } } @@ -537,12 +539,12 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask) LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL; mTimeSlider->setCurSliderValue(sliderpos); - selectFrame(sliderpos); + selectFrame(sliderpos, FRAME_SLOP_FACTOR); } void LLFloaterEditExtDayCycle::onTimeSliderMoved() { - selectFrame(mTimeSlider->getCurSliderValue()); + selectFrame(mTimeSlider->getCurSliderValue(), FRAME_SLOP_FACTOR); } void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force ) @@ -567,16 +569,16 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force ) updateSlider(); } -void LLFloaterEditExtDayCycle::selectFrame(F32 frame) +void LLFloaterEditExtDayCycle::selectFrame(F32 frame, F32 slop_factor) { mFramesSlider->resetCurSlider(); - keymap_t::iterator iter = mSliderKeyMap.begin(); keymap_t::iterator end_iter = mSliderKeyMap.end(); while (iter != end_iter) { - if (fabs(iter->second.mFrame - frame) <= FRAME_SLOP_FACTOR) + F32 keyframe = iter->second.mFrame; + if (fabs(keyframe - frame) <= slop_factor) { mFramesSlider->setCurSlider(iter->first); frame = iter->second.mFrame; @@ -588,6 +590,7 @@ void LLFloaterEditExtDayCycle::selectFrame(F32 frame) mTimeSlider->setCurSliderValue(frame); // block or update tabs according to new selection updateTabs(); + LLEnvironment::instance().updateEnvironment(); } void LLFloaterEditExtDayCycle::clearTabs() @@ -686,11 +689,16 @@ void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) void LLFloaterEditExtDayCycle::updateButtons() { - LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); - LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); - bool can_add = static_cast<bool>(settings); - mAddFrameButton->setEnabled(can_add); - mDeleteFrameButton->setEnabled(!can_add); + // This logic appears to work in reverse, the add frame button + // is only enabled when you're on an existing frame and disabled + // in all the interim positions where you'd want to add a frame... + //LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); + //LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); + //bool can_add = static_cast<bool>(settings); + //mAddFrameButton->setEnabled(can_add); + //mDeleteFrameButton->setEnabled(!can_add); + mAddFrameButton->setEnabled(true); + mDeleteFrameButton->setEnabled(true); } void LLFloaterEditExtDayCycle::updateSlider() @@ -718,7 +726,7 @@ void LLFloaterEditExtDayCycle::updateSlider() mLastFrameSlider.clear(); } - selectFrame(frame_position); + selectFrame(frame_position, FRAME_SLOP_FACTOR); } void LLFloaterEditExtDayCycle::updateTimeAndLabel() @@ -1108,7 +1116,7 @@ void LLFloaterEditExtDayCycle::stopPlay() gIdleCallbacks.deleteFunction(onIdlePlay, this); mPlayTimer.stop(); F32 frame = mTimeSlider->getCurSliderValue(); - selectFrame(frame); + selectFrame(frame, FRAME_SLOP_FACTOR); getChild<LLView>("play_layout", true)->setVisible(TRUE); getChild<LLView>("pause_layout", true)->setVisible(FALSE); diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 0c2cf3922e..c4f0811d17 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -79,6 +79,8 @@ public: private: + F32 getCurrentFrame() const; + // flyout response/click void onButtonApply(LLUICtrl *ctrl, const LLSD &data); void onBtnCancel(); @@ -98,7 +100,7 @@ private: void onFrameSliderMouseUp(S32 x, S32 y, MASK mask); void selectTrack(U32 track_index, bool force = false); - void selectFrame(F32 frame); + void selectFrame(F32 frame, F32 slop_factor); void clearTabs(); void updateTabs(); void updateWaterTabs(const LLSettingsWaterPtr_t &p_water); diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index 59cfab61fd..36460475a8 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -267,7 +267,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) F32 density_multiplier = psky->getDensityMultiplier(); F32 max_y = psky->getMaxY(); - LLVector3 lightnorm = LLVector3(LLEnvironment::instance().getClampedLightNorm()); + LLVector3 sun_norm = LLVector3(LLEnvironment::instance().getClampedSunNorm()); // project the direction ray onto the sky dome. F32 phi = acos(Pn[1]); @@ -316,7 +316,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) LLColor3 haze_weight = componentDiv(smear(haze_density), temp1); // Compute sunlight from P & lightnorm (for long rays like sky) - temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); + temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + sun_norm[1] ); temp2.mV[1] = 1.f / temp2.mV[1]; componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); @@ -329,7 +329,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) // Compute haze glow - temp2.mV[0] = Pn * lightnorm; + temp2.mV[0] = Pn * sun_norm; temp2.mV[0] = 1.f - temp2.mV[0]; // temp2.x is 0 at the sun and increases away from sun @@ -360,7 +360,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) componentMultBy(vars.hazeColor, LLColor3::white - temp1); sunlight = psky->getSunlightColor(); - temp2.mV[1] = llmax(0.f, lightnorm[1] * 2.f); + temp2.mV[1] = llmax(0.f, sun_norm[1] * 2.f); temp2.mV[1] = 1.f / temp2.mV[1]; componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index e5c6116c4f..dc724ce9c7 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -374,19 +374,23 @@ void LLPanelSettingsSkySunMoonTab::onStarBrightnessChanged() void LLPanelSettingsSkySunMoonTab::onSunRotationChanged() { mSkySettings->setSunRotation(getChild<LLJoystickQuaternion>(FIELD_SKY_SUN_ROTATION)->getRotation()); + mSkySettings->update(); } void LLPanelSettingsSkySunMoonTab::onSunImageChanged() { mSkySettings->setSunTextureId(getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->getValue().asUUID()); + mSkySettings->update(); } void LLPanelSettingsSkySunMoonTab::onMoonRotationChanged() { mSkySettings->setMoonRotation(getChild<LLJoystickQuaternion>(FIELD_SKY_MOON_ROTATION)->getRotation()); + mSkySettings->update(); } void LLPanelSettingsSkySunMoonTab::onMoonImageChanged() { mSkySettings->setMoonTextureId(getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->getValue().asUUID()); + mSkySettings->update(); } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index fba62e1ce9..2ffb1c1bce 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -525,13 +525,14 @@ void LLSettingsVOSky::updateSettings() gSky.setSunAndMoonDirectionsCFR(sun_direction_cfr, moon_direction_cfr); gSky.setSunTextures(getSunTextureId(), getNextSunTextureId()); gSky.setMoonTextures(getMoonTextureId(), getNextMoonTextureId()); + gSky.setCloudNoiseTextures(getCloudNoiseTextureId(), getNextCloudNoiseTextureId()); } void LLSettingsVOSky::applySpecial(void *ptarget) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; - LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm(); + LLVector4 light_direction = LLEnvironment::instance().getClampedSunNorm(); if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) { @@ -540,7 +541,6 @@ void LLSettingsVOSky::applySpecial(void *ptarget) } else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) { - LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm(); shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index 6b7db9bb01..5d85778da5 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -143,6 +143,13 @@ void LLSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_textu } } +void LLSky::setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next) +{ + if(mVOSkyp.notNull()) { + mVOSkyp->setCloudNoiseTextures(cloud_noise_texture, cloud_noise_texture_next); + } +} + void LLSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction) { if(mVOSkyp.notNull()) { diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index b618b9bfe6..cc5db2c7ec 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -58,6 +58,7 @@ public: void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next); void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next); + void setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next); LLColor4 getSkyFogColor() const; diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 359415b185..e8ca286074 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -816,6 +816,27 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex } } +void LLVOSky::setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next) +{ + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + + LLUUID cloud_noise_tex = cloud_noise_texture.isNull() ? psky->GetDefaultCloudNoiseTextureId() : cloud_noise_texture; + LLUUID cloud_noise_tex_next = cloud_noise_texture_next.isNull() ? (cloud_noise_texture.isNull() ? psky->GetDefaultCloudNoiseTextureId() : cloud_noise_texture) : cloud_noise_texture_next; + + mCloudNoiseTexturep[0] = LLViewerTextureManager::getFetchedTexture(cloud_noise_tex, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mCloudNoiseTexturep[1] = LLViewerTextureManager::getFetchedTexture(cloud_noise_tex_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + + if (mCloudNoiseTexturep[0]) + { + mCloudNoiseTexturep[0]->setAddressMode(LLTexUnit::TAM_WRAP); + } + + if (mCloudNoiseTexturep[1]) + { + mCloudNoiseTexturep[1]->setAddressMode(LLTexUnit::TAM_WRAP); + } +} + static LLTrace::BlockTimerStatHandle FTM_GEO_SKY("Sky Geometry"); BOOL LLVOSky::updateGeometry(LLDrawable *drawable) diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index d6d294de6a..d7f7700dd0 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -272,9 +272,16 @@ public: LLViewerTexture* getSunTex() const { return mSunTexturep[0]; } LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; } LLViewerTexture* getBloomTex() const { return mBloomTexturep; } + LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; } + + LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; } + LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; } + LLViewerTexture* getBloomTexNext() const { return mBloomTexturep; } + LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; } void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next); void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next); + void setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next); void forceSkyUpdate(void) { mForceUpdate = TRUE; } @@ -292,6 +299,7 @@ protected: LLPointer<LLViewerFetchedTexture> mSunTexturep[2]; LLPointer<LLViewerFetchedTexture> mMoonTexturep[2]; + LLPointer<LLViewerFetchedTexture> mCloudNoiseTexturep[2]; LLPointer<LLViewerFetchedTexture> mBloomTexturep; static S32 sResolution; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 27db6778eb..7be05a1bcb 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6258,8 +6258,11 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) // Light 0 = Sun or Moon (All objects) { - LLVector4 light_dir = environment.getLightDirectionCFR(); - mSunDir.setVec(light_dir); + LLVector4 sun_dir = environment.getSunDirectionCFR(); + LLVector4 moon_dir = environment.getMoonDirectionCFR(); + + mSunDir.setVec(sun_dir); + mMoonDir.setVec(moon_dir); if (environment.getIsSunUp()) { @@ -6282,7 +6285,14 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) mHWLightColors[0] = light_diffuse; LLLightState* light = gGL.getLight(0); - light->setPosition(mSunDir); + if (environment.getIsSunUp()) + { + light->setPosition(mSunDir); + } + else + { + light->setPosition(mMoonDir); + } light->setDiffuse(light_diffuse); light->setAmbient(LLColor4::black); light->setSpecular(LLColor4::black); @@ -8377,6 +8387,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_BIAS, RenderSpotShadowBias); shader.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV); + shader.uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, mTransformedMoonDir.mV); shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, mShadow[0].getWidth(), mShadow[0].getHeight()); shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, mShadow[4].getWidth(), mShadow[4].getHeight()); shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); @@ -8465,10 +8476,13 @@ void LLPipeline::renderDeferredLighting() vert[2].set(3,1,0); { - setupHWLights(NULL); //to set mSunDir; + setupHWLights(NULL); //to set mSun/MoonDir; glh::vec4f tc(mSunDir.mV); mat.mult_matrix_vec(tc); mTransformedSunDir.set(tc.v); + + glh::vec4f tc_moon(mMoonDir.mV); + mTransformedMoonDir.set(tc_moon.v); } gGL.pushMatrix(); @@ -9078,10 +9092,13 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) vert[2].set(3,1,0); { - setupHWLights(NULL); //to set mSunDir; + setupHWLights(NULL); //to set mSun/MoonDir; glh::vec4f tc(mSunDir.mV); mat.mult_matrix_vec(tc); mTransformedSunDir.set(tc.v); + + glh::vec4f tc_moon(mMoonDir.mV); + mTransformedMoonDir.set(tc_moon.v); } gGL.pushMatrix(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 43aa7d891e..d17bab775d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -657,7 +657,10 @@ public: LLColor4 mSunDiffuse; LLVector4 mSunDir; + LLVector4 mMoonDir; + LLVector4 mTransformedSunDir; + LLVector4 mTransformedMoonDir; bool mInitialized; bool mVertexShadersEnabled; |