Merge
commit
e2adba65de
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,274 +105,85 @@ public:
|
|||
|
||||
static LLSD defaults();
|
||||
|
||||
F32 getPlanetRadius() const
|
||||
{
|
||||
return mSettings[SETTING_PLANET_RADIUS].asReal();
|
||||
}
|
||||
F32 getPlanetRadius() const;
|
||||
F32 getSkyBottomRadius() const;
|
||||
F32 getSkyTopRadius() const;
|
||||
F32 getSunArcRadians() const;
|
||||
F32 getMieAnisotropy() const;
|
||||
LLSD getRayleighConfigs() const;
|
||||
LLSD getMieConfigs() const;
|
||||
|
||||
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();
|
||||
}
|
||||
LLSD getAbsorptionConfigs() const;
|
||||
LLUUID getBloomTextureId() const;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
LLColor3 getAmbientColor() const
|
||||
{
|
||||
return LLColor3(mSettings[SETTING_AMBIENT]);
|
||||
}
|
||||
LLColor3 getAmbientColor() const;
|
||||
void setAmbientColor(const LLColor3 &val);
|
||||
|
||||
void setAmbientColor(const LLColor3 &val)
|
||||
{
|
||||
setValue(SETTING_AMBIENT, val);
|
||||
mLightingDirty = true;
|
||||
}
|
||||
LLColor3 getCloudColor() const;
|
||||
void setCloudColor(const LLColor3 &val);
|
||||
|
||||
LLColor3 getCloudColor() const
|
||||
{
|
||||
return LLColor3(mSettings[SETTING_CLOUD_COLOR]);
|
||||
}
|
||||
LLUUID getCloudNoiseTextureId() const;
|
||||
void setCloudNoiseTextureId(const LLUUID &id);
|
||||
|
||||
void setCloudColor(const LLColor3 &val)
|
||||
{
|
||||
setValue(SETTING_CLOUD_COLOR, val);
|
||||
}
|
||||
LLColor3 getCloudPosDensity1() const;
|
||||
void setCloudPosDensity1(const LLColor3 &val);
|
||||
|
||||
LLUUID getCloudNoiseTextureId() const
|
||||
{
|
||||
return mSettings[SETTING_CLOUD_TEXTUREID].asUUID();
|
||||
}
|
||||
LLColor3 getCloudPosDensity2() const;
|
||||
void setCloudPosDensity2(const LLColor3 &val);
|
||||
|
||||
void setCloudNoiseTextureId(const LLUUID &id)
|
||||
{
|
||||
setValue(SETTING_CLOUD_TEXTUREID, id);
|
||||
}
|
||||
F32 getCloudScale() const;
|
||||
void setCloudScale(F32 val);
|
||||
|
||||
LLColor3 getCloudPosDensity1() const
|
||||
{
|
||||
return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]);
|
||||
}
|
||||
LLVector2 getCloudScrollRate() const;
|
||||
void setCloudScrollRate(const LLVector2 &val);
|
||||
|
||||
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;
|
||||
}
|
||||
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 getDomeOffset() const;
|
||||
F32 getDomeRadius() const;
|
||||
|
||||
F32 getDomeRadius() const
|
||||
{
|
||||
return DOME_RADIUS;
|
||||
//return mSettings[SETTING_DOME_RADIUS].asReal();
|
||||
}
|
||||
F32 getGamma() const;
|
||||
|
||||
F32 getGamma() const
|
||||
{
|
||||
return mSettings[SETTING_GAMMA].asReal();
|
||||
}
|
||||
void setGamma(F32 val);
|
||||
|
||||
void setGamma(F32 val)
|
||||
{
|
||||
mSettings[SETTING_GAMMA] = LLSD::Real(val);
|
||||
setDirtyFlag(true);
|
||||
mLightingDirty = true;
|
||||
}
|
||||
LLColor3 getGlow() const;
|
||||
void setGlow(const LLColor3 &val);
|
||||
|
||||
LLColor3 getGlow() const
|
||||
{
|
||||
return LLColor3(mSettings[SETTING_GLOW]);
|
||||
}
|
||||
F32 getMaxY() const;
|
||||
|
||||
void setGlow(const LLColor3 &val)
|
||||
{
|
||||
setValue(SETTING_GLOW, val);
|
||||
}
|
||||
void setMaxY(F32 val);
|
||||
|
||||
F32 getMaxY() const
|
||||
{
|
||||
return mSettings[SETTING_MAX_Y].asReal();
|
||||
}
|
||||
LLQuaternion getMoonRotation() const;
|
||||
void setMoonRotation(const LLQuaternion &val);
|
||||
|
||||
void setMaxY(F32 val)
|
||||
{
|
||||
setValue(SETTING_MAX_Y, val);
|
||||
mLightingDirty = true;
|
||||
}
|
||||
LLUUID getMoonTextureId() const;
|
||||
void setMoonTextureId(LLUUID id);
|
||||
|
||||
LLQuaternion getMoonRotation() const
|
||||
{
|
||||
return LLQuaternion(mSettings[SETTING_MOON_ROTATION]);
|
||||
}
|
||||
F32 getStarBrightness() const;
|
||||
void setStarBrightness(F32 val);
|
||||
|
||||
void setMoonRotation(const LLQuaternion &val)
|
||||
{
|
||||
setValue(SETTING_MOON_ROTATION, val);
|
||||
mPositionsDirty = true;
|
||||
}
|
||||
LLColor3 getSunlightColor() const;
|
||||
void setSunlightColor(const LLColor3 &val);
|
||||
|
||||
LLUUID getMoonTextureId() const
|
||||
{
|
||||
return mSettings[SETTING_MOON_TEXTUREID].asUUID();
|
||||
}
|
||||
LLQuaternion getSunRotation() const;
|
||||
void setSunRotation(const LLQuaternion &val) ;
|
||||
|
||||
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);
|
||||
}
|
||||
LLUUID getSunTextureId() const;
|
||||
void setSunTextureId(LLUUID id);
|
||||
|
||||
//=====================================================================
|
||||
// transient properties used in animations.
|
||||
LLUUID getNextSunTextureId() const
|
||||
{
|
||||
return mNextSunTextureId;
|
||||
}
|
||||
|
||||
LLUUID getNextMoonTextureId() const
|
||||
{
|
||||
return mNextMoonTextureId;
|
||||
}
|
||||
|
||||
LLUUID getNextCloudNoiseTextureId() const
|
||||
{
|
||||
return mNextCloudTextureId;
|
||||
}
|
||||
LLUUID getNextSunTextureId() const;
|
||||
LLUUID getNextMoonTextureId() const;
|
||||
LLUUID getNextCloudNoiseTextureId() const;
|
||||
|
||||
//=====================================================================
|
||||
virtual void loadTextures() { };
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
|
||||
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 waterPlane;
|
||||
uniform vec4 waterFogColor;
|
||||
uniform float waterFogDensity;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -704,16 +704,6 @@ void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool f
|
|||
}
|
||||
}
|
||||
|
||||
LLVector3 LLEnvironment::getLightDirection() const
|
||||
{
|
||||
LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
|
||||
if (!psky)
|
||||
{
|
||||
return LLVector3(0, 0, 1);
|
||||
}
|
||||
return psky->getLightDirection();
|
||||
}
|
||||
|
||||
LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const
|
||||
{
|
||||
LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f);
|
||||
|
|
@ -726,6 +716,36 @@ LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const
|
|||
return vec_ogl;
|
||||
}
|
||||
|
||||
LLVector3 LLEnvironment::getLightDirection() const
|
||||
{
|
||||
LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
|
||||
if (!psky)
|
||||
{
|
||||
return LLVector3(0, 0, 1);
|
||||
}
|
||||
return psky->getLightDirection();
|
||||
}
|
||||
|
||||
LLVector3 LLEnvironment::getSunDirection() const
|
||||
{
|
||||
LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
|
||||
if (!psky)
|
||||
{
|
||||
return LLVector3(0, 0, 1);
|
||||
}
|
||||
return psky->getSunDirection();
|
||||
}
|
||||
|
||||
LLVector3 LLEnvironment::getMoonDirection() const
|
||||
{
|
||||
LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
|
||||
if (!psky)
|
||||
{
|
||||
return LLVector3(0, 0, -1);
|
||||
}
|
||||
return psky->getMoonDirection();
|
||||
}
|
||||
|
||||
LLVector4 LLEnvironment::getLightDirectionCFR() const
|
||||
{
|
||||
LLVector3 light_direction = getLightDirection();
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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]));
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -657,7 +657,10 @@ public:
|
|||
|
||||
LLColor4 mSunDiffuse;
|
||||
LLVector4 mSunDir;
|
||||
LLVector4 mMoonDir;
|
||||
|
||||
LLVector4 mTransformedSunDir;
|
||||
LLVector4 mTransformedMoonDir;
|
||||
|
||||
bool mInitialized;
|
||||
bool mVertexShadersEnabled;
|
||||
|
|
|
|||
Loading…
Reference in New Issue