diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-16 23:45:56 +0100 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-16 23:45:56 +0100 |
commit | 4d4a7dfb9f28007c2ceb53668d065bbe0fa332af (patch) | |
tree | 9c9929e754fa8f6d0ad6c8fdc15c0fa494dbd0b6 /indra/llinventory | |
parent | 3116416fcb8dfd54ef2807e9e75959429c946d79 (diff) | |
parent | 67a16cad8ab5c928f34b4299eae5499b59c3aa83 (diff) |
Merge and disable new sky render.
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 13 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 14 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 49 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 3 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 121 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 58 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 8 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.h | 9 |
8 files changed, 240 insertions, 35 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index b763a06ab4..6d2e1f5b78 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -32,6 +32,8 @@ #include "llsdserialize.h" +#pragma optimize("", off) + //========================================================================= namespace { @@ -58,14 +60,16 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), mDirty(true), - mAssetID() + mAssetID(), + mBlendedFactor(0.0) { } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), mDirty(true), - mAssetID() + mAssetID(), + mBlendedFactor(0.0) { } @@ -228,9 +232,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F break; + case LLSD::TypeUUID: + newSettings[key_name] = value.asUUID(); + break; + // case LLSD::TypeBoolean: // case LLSD::TypeString: -// case LLSD::TypeUUID: // case LLSD::TypeURI: // case LLSD::TypeBinary: // case LLSD::TypeDate: diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 62a88cde73..06c1e6231e 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -96,6 +96,7 @@ public: inline void replaceSettings(LLSD settings) { mSettings = settings; + mBlendedFactor = 0.0; setDirtyFlag(true); } @@ -146,6 +147,11 @@ public: setValue(name, value.getValue()); } + inline F64 getBlendFactor() const + { + return mBlendedFactor; + } + // Note this method is marked const but may modify the settings object. // (note the internal const cast). This is so that it may be called without // special consideration from getters. @@ -237,11 +243,19 @@ protected: LLSD cloneSettings() const; + inline void setBlendFactor(F64 blendfactor) + { + mBlendedFactor = blendfactor; + } + + void markDirty() { mDirty = true; } + private: bool mDirty; LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + F64 mBlendedFactor; }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 70826d1410..3f60430715 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -483,7 +483,7 @@ void LLSettingsDay::updateSettings() //========================================================================= LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) { - if ((trackno < 1) || (trackno >= TRACK_MAX)) + if ((trackno < 0) || (trackno >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; return KeyframeList_t(); @@ -508,6 +508,17 @@ void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 ke setDirtyFlag(true); } +const LLSettingsWaterPtr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) +{ + // todo: better way to identify keyframes? + CycleTrack_t::iterator iter = mDayTracks[TRACK_WATER].find(keyframe); + if (iter != mDayTracks[TRACK_WATER].end()) + { + return std::dynamic_pointer_cast<LLSettingsWater>(iter->second); + } + + return LLSettingsWaterPtr_t(NULL); +} void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track) { @@ -521,6 +532,42 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe setDirtyFlag(true); } +const LLSettingsSkyPtr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) +{ + if ((track < 1) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; + return LLSettingsSkyPtr_t(NULL); + } + + // todo: better way to identify keyframes? + CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe); + if (iter != mDayTracks[track].end()) + { + return std::dynamic_pointer_cast<LLSettingsSky>(iter->second); + } + + return LLSettingsSkyPtr_t(NULL); +} + +const LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; + return LLSettingsBase::ptr_t(NULL); + } + + // todo: better way to identify keyframes? + CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe); + if (iter != mDayTracks[track].end()) + { + return iter->second; + } + + return LLSettingsSkyPtr_t(NULL); +} + LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) { return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index da572572c4..93c275bfb8 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -88,7 +88,10 @@ public: KeyframeList_t getTrackKeyframes(S32 track); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); + const LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe); void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); + const LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track); + const LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track); //--------------------------------------------------------------------- void startDayCycle(); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 491381213f..8cf430292b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= namespace { @@ -106,6 +108,10 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); + const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); namespace @@ -352,12 +358,18 @@ bool validateMieLayers(LLSD &value) //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : - LLSettingsBase(data) + LLSettingsBase(data), + mNextSunTextureId(), + mNextMoonTextureId(), + mNextCloudTextureId() { } LLSettingsSky::LLSettingsSky(): - LLSettingsBase() + LLSettingsBase(), + mNextSunTextureId(), + mNextMoonTextureId(), + mNextCloudTextureId() { } @@ -367,6 +379,10 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + setBlendFactor(blendf); + mNextSunTextureId = other->getSunTextureId(); + mNextMoonTextureId = other->getMoonTextureId(); + mNextCloudTextureId = other->getCloudNoiseTextureId(); } @@ -396,6 +412,21 @@ LLSettingsSky::azimalt_t LLSettingsSky::getSunRotationAzAl() const return res; } +LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const +{ + static stringset_t skipSet; + + if (skipSet.empty()) + { + skipSet.insert(SETTING_RAYLEIGH_CONFIG); + skipSet.insert(SETTING_MIE_CONFIG); + skipSet.insert(SETTING_ABSORPTION_CONFIG); + skipSet.insert(SETTING_MIE_ANISOTROPY_FACTOR); + } + + return skipSet; +} + LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const { static stringset_t slepSet; @@ -596,17 +627,17 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; - dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; + dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow! + dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID; dfltsetting[SETTING_TYPE] = "sky"; // defaults are for earth... - dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; dfltsetting[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); @@ -871,6 +902,41 @@ F32 LLSettingsSky::getDistanceMultiplier() const return 0.8f; } +void LLSettingsSky::setBlueDensity(const LLColor3 &val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); + markDirty(); +} + +void LLSettingsSky::setBlueHorizon(const LLColor3 &val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue(); + markDirty(); +} + +void LLSettingsSky::setDensityMultiplier(F32 val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val; + markDirty(); +} + +void LLSettingsSky::setDistanceMultiplier(F32 val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val; + markDirty(); +} + +void LLSettingsSky::setHazeDensity(F32 val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val; + markDirty(); +} +void LLSettingsSky::setHazeHorizon(F32 val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val; + markDirty(); +} + // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const @@ -912,37 +978,37 @@ void LLSettingsSky::calculateLightSettings() // Initialize temp variables LLColor3 sunlight = getSunlightColor(); LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); LLColor3 light_transmittance = getLightTransmittance(); - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) - { - lighty = -lighty; - } + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } lighty = llmax(0.f, lighty); if(lighty > 0.f) - { + { lighty = 1.f / lighty; - } + } componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient + //brightness of surface both sunlight and ambient mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); @@ -954,6 +1020,7 @@ void LLSettingsSky::calculateLightSettings() mFadeColor.setAlpha(0); } + //========================================================================= namespace { diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 4fb8c101ee..7a02c944a3 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -80,6 +80,10 @@ public: static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; + static const LLUUID DEFAULT_SUN_ID; + static const LLUUID DEFAULT_MOON_ID; + static const LLUUID DEFAULT_CLOUD_ID; + static const std::string SETTING_LEGACY_HAZE; typedef std::shared_ptr<LLSettingsSky> ptr_t; @@ -95,7 +99,6 @@ public: virtual std::string getSettingType() const override { return std::string("sky"); } virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } - // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; @@ -172,6 +175,11 @@ public: 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]); @@ -283,6 +291,11 @@ public: return mSettings[SETTING_MAX_Y].asReal(); } + void setMaxY(F32 val) + { + setValue(SETTING_MAX_Y, val); + } + LLQuaternion getMoonRotation() const { return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); @@ -307,6 +320,11 @@ public: return mSettings[SETTING_MOON_TEXTUREID].asUUID(); } + void setMoonTextureId(LLUUID id) + { + setValue(SETTING_MOON_TEXTUREID, id); + } + F32 getStarBrightness() const { return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); @@ -351,6 +369,11 @@ public: return mSettings[SETTING_SUN_TEXTUREID].asUUID(); } + void setSunTextureId(LLUUID id) + { + setValue(SETTING_SUN_TEXTUREID, id); + } + // Internal/calculated settings LLVector3 getLightDirection() const { @@ -412,6 +435,27 @@ public: return mTotalAmbient; } +//===================================================================== + // transient properties used in animations. + LLUUID getNextSunTextureId() const + { + return mNextSunTextureId; + } + + LLUUID getNextMoonTextureId() const + { + return mNextMoonTextureId; + } + + LLUUID getNextCloudNoiseTextureId() const + { + return mNextCloudTextureId; + } + + //===================================================================== + virtual void loadTextures() { }; + + //===================================================================== virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); @@ -430,6 +474,13 @@ public: F32 getDensityMultiplier() const; F32 getDistanceMultiplier() const; + void setBlueDensity(const LLColor3 &val); + void setBlueHorizon(const LLColor3 &val); + void setDensityMultiplier(F32 val); + void setDistanceMultiplier(F32 val); + void setHazeDensity(F32 val); + void setHazeHorizon(F32 val); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -438,6 +489,7 @@ protected: LLSettingsSky(); virtual stringset_t getSlerpKeys() const override; + virtual stringset_t getSkipInterpolateKeys() const override; virtual void updateSettings() override; @@ -468,6 +520,10 @@ private: LLColor4 mTotalAmbient; + LLUUID mNextSunTextureId; + LLUUID mNextMoonTextureId; + LLUUID mNextCloudTextureId; + typedef std::map<std::string, S32> mapNameToUniformId_t; static mapNameToUniformId_t sNameToUniformMapping; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index a72cbc4136..c6798945a3 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -72,12 +72,14 @@ const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL); //========================================================================= LLSettingsWater::LLSettingsWater(const LLSD &data) : - LLSettingsBase(data) + LLSettingsBase(data), + mNextNormalMapID() { } LLSettingsWater::LLSettingsWater() : - LLSettingsBase() + LLSettingsBase(), + mNextNormalMapID() { } @@ -167,6 +169,8 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + setBlendFactor(blendf); + mNextNormalMapID = other->getNormalMapID(); } LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index e9d8cb9613..642f86a9d6 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -199,6 +199,13 @@ public: return mWaterFogKS; } + //------------------------------------------- + LLUUID getNextNormalMapID() const + { + return mNextNormalMapID; + } + + virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); @@ -224,7 +231,7 @@ protected: F32 mWaterFogKS; private: - + LLUUID mNextNormalMapID; }; #endif |