diff options
Diffstat (limited to 'indra/llinventory/llsettingssky.h')
-rw-r--r-- | indra/llinventory/llsettingssky.h | 252 |
1 files changed, 91 insertions, 161 deletions
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 9379cd37c3..9b50f5a4b6 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -31,6 +31,12 @@ #include "llsettingsbase.h" #include "v4coloru.h" +const F32 EARTH_RADIUS = 6.370e6f; +const F32 SUN_RADIUS = 695.508e6f; +const F32 SUN_DIST = 149598.260e6f; +const F32 MOON_RADIUS = 1.737e6f; +const F32 MOON_DIST = 384.400e6f; + class LLSettingsSky: public LLSettingsBase { public: @@ -66,6 +72,7 @@ public: static const std::string SETTING_SKY_BOTTOM_RADIUS; static const std::string SETTING_SKY_TOP_RADIUS; static const std::string SETTING_SUN_ARC_RADIANS; + static const std::string SETTING_MIE_ANISOTROPY_FACTOR; static const std::string SETTING_RAYLEIGH_CONFIG; static const std::string SETTING_MIE_CONFIG; @@ -77,14 +84,15 @@ public: static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; - static const std::string SETTING_MIE_ANISOTROPY_FACTOR; + 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; - typedef std::pair<F32, F32> azimalt_t; //--------------------------------------------------------------------- LLSettingsSky(const LLSD &data); @@ -96,86 +104,65 @@ 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; static LLSD defaults(); - LLUUID getBloomTextureId() const + F32 getPlanetRadius() const { - return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); + return mSettings[SETTING_PLANET_RADIUS].asReal(); } - //--------------------------------------------------------------------- - LLColor3 getAmbientColor() const + F32 getSkyBottomRadius() const { - return LLColor3(mSettings[SETTING_AMBIENT]); + return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); } - void setAmbientColor(const LLColor3 &val) + F32 getSkyTopRadius() const { - setValue(SETTING_AMBIENT, val); + return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); } - LLColor3 getBlueDensity() const + F32 getSunArcRadians() const { - return LLColor3(mSettings[SETTING_BLUE_DENSITY]); + return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); } - void setBlueDensity(const LLColor3 &val) + F32 getMieAnisotropy() const { - setValue(SETTING_BLUE_DENSITY, val); + return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } - - LLColor3 getBlueHorizon() const - { - return LLColor3(mSettings[SETTING_BLUE_HORIZON]); - } - - void setBlueHorizon(const LLColor3 &val) - { - setValue(SETTING_BLUE_HORIZON, val); - } - - F32 getDensityMultiplier() const - { - return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); - } - - void setDensityMultiplier(F32 val) - { - setValue(SETTING_DENSITY_MULTIPLIER, val); - } - - F32 getDistanceMultiplier() const + + LLSD getRayleighConfigs() const { - return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); + return mSettings[SETTING_RAYLEIGH_CONFIG]; } - void setDistanceMultiplier(F32 val) + LLSD getMieConfigs() const { - setValue(SETTING_DISTANCE_MULTIPLIER, val); + return mSettings[SETTING_MIE_CONFIG]; } - F32 getHazeDensity() const + LLSD getAbsorptionConfigs() const { - return mSettings[SETTING_HAZE_DENSITY].asReal(); + return mSettings[SETTING_ABSORPTION_CONFIG]; } - void setHazeDensity(F32 val) + LLUUID getBloomTextureId() const { - setValue(SETTING_HAZE_DENSITY, val); + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); } - F32 getHazeHorizon() const + //--------------------------------------------------------------------- + LLColor3 getAmbientColor() const { - return mSettings[SETTING_HAZE_HORIZON].asReal(); + return LLColor3(mSettings[SETTING_AMBIENT]); } - void setHazeHorizon(F32 val) + void setAmbientColor(const LLColor3 &val) { - setValue(SETTING_HAZE_HORIZON, val); + setValue(SETTING_AMBIENT, val); } LLColor3 getCloudColor() const @@ -294,16 +281,6 @@ public: setValue(SETTING_GLOW, val); } - LLVector3 getLightNormal() const - { - return LLVector3(mSettings[SETTING_LIGHT_NORMAL]); - } - - void setLightNormal(const LLVector3 &val) - { - setValue(SETTING_LIGHT_NORMAL, val); - } - F32 getMaxY() const { return mSettings[SETTING_MAX_Y].asReal(); @@ -324,15 +301,6 @@ public: setValue(SETTING_MOON_ROTATION, val); } - azimalt_t getMoonRotationAzAl() const; - - void setMoonRotation(F32 azimuth, F32 altitude); - - void setMoonRotation(const azimalt_t &azialt) - { - setMoonRotation(azialt.first, azialt.second); - } - LLUUID getMoonTextureId() const { return mSettings[SETTING_MOON_TEXTUREID].asUUID(); @@ -368,20 +336,11 @@ public: return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); } - azimalt_t getSunRotationAzAl() const; - void setSunRotation(const LLQuaternion &val) { setValue(SETTING_SUN_ROTATION, val); } - void setSunRotation(F32 azimuth, F32 altitude); - - void setSunRotation(const azimalt_t & azimalt) - { - setSunRotation(azimalt.first, azimalt.second); - } - LLUUID getSunTextureId() const { return mSettings[SETTING_SUN_TEXTUREID].asUUID(); @@ -392,76 +351,6 @@ public: setValue(SETTING_SUN_TEXTUREID, id); } - // Internal/calculated settings - LLVector3 getLightDirection() const - { - update(); - return mLightDirection; - }; - - LLVector3 getClampedLightDirection() const - { - update(); - return mClampedLightDirection; - }; - - LLVector3 getSunDirection() const - { - update(); - return mSunDirection; - } - - LLVector3 getMoonDirection() const - { - update(); - return mMoonDirection; - } - - LLColor4U getFadeColor() const - { - update(); - return mFadeColor; - } - - LLColor4 getMoonAmbient() const - { - update(); - return mMoonAmbient; - } - - LLColor3 getMoonDiffuse() const - { - update(); - return mMoonDiffuse; - } - - LLColor4 getSunAmbient() const - { - update(); - return mSunAmbient; - } - - LLColor3 getSunDiffuse() const - { - update(); - return mSunDiffuse; - } - - LLColor4 getTotalAmbient() const - { - update(); - return mTotalAmbient; - } - - //===================================================================== - virtual void loadTextures() { }; - - //===================================================================== - virtual validation_list_t getValidationList() const override; - static validation_list_t validationList(); - - static LLSD translateLegacySettings(LLSD legacy); - //===================================================================== // transient properties used in animations. LLUUID getNextSunTextureId() const @@ -479,6 +368,49 @@ public: return mNextCloudTextureId; } + //===================================================================== + virtual void loadTextures() { }; + + //===================================================================== + virtual validation_list_t getValidationList() const override; + static validation_list_t validationList(); + + static LLSD translateLegacySettings(const LLSD& legacy); + static LLSD translateLegacyHazeSettings(const LLSD& legacy); + + LLColor3 getLightAttenuation(F32 distance) const; + LLColor3 getLightTransmittance() const; + LLColor3 gammaCorrect(const LLColor3& in) const; + +// LEGACY_ATMOSPHERICS + LLColor3 getBlueDensity() const; + LLColor3 getBlueHorizon() const; + F32 getHazeDensity() const; + F32 getHazeHorizon() const; + 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); + +// Internal/calculated settings + bool getIsSunUp() const; + bool getIsMoonUp() const; + + LLVector3 getLightDirection() const; + LLVector3 getSunDirection() const; + LLVector3 getMoonDirection() const; + LLColor4U getFadeColor() const; + LLColor4 getMoonAmbient() const; + LLColor3 getMoonDiffuse() const; + LLColor4 getSunAmbient() const; + LLColor3 getSunDiffuse() const; + LLColor4 getTotalAmbient() const; + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } protected: @@ -493,31 +425,29 @@ protected: virtual void updateSettings() override; private: + mutable bool mPositionsDirty = true; + mutable bool mLightingDirty = true; + static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); - static const F32 NIGHTTIME_ELEVATION; - static const F32 NIGHTTIME_ELEVATION_COS; + void calculateHeavnlyBodyPositions() const; + void calculateLightSettings() const; - void calculateHeavnlyBodyPositions(); - void calculateLightSettings(); - - LLVector3 mSunDirection; - LLVector3 mMoonDirection; - LLVector3 mLightDirection; - LLVector3 mClampedLightDirection; + mutable LLVector3 mSunDirection; + mutable LLVector3 mMoonDirection; + mutable LLVector3 mLightDirection; static const F32 DOME_RADIUS; static const F32 DOME_OFFSET; - LLColor4U mFadeColor; - LLColor4 mMoonAmbient; - LLColor3 mMoonDiffuse; - LLColor4 mSunAmbient; - LLColor3 mSunDiffuse; - - LLColor4 mTotalAmbient; + mutable LLColor4U mFadeColor; + mutable LLColor4 mMoonAmbient; + mutable LLColor3 mMoonDiffuse; + mutable LLColor4 mSunAmbient; + mutable LLColor3 mSunDiffuse; + mutable LLColor4 mTotalAmbient; LLUUID mNextSunTextureId; LLUUID mNextMoonTextureId; |