diff options
Diffstat (limited to 'indra/llinventory/llsettingssky.h')
-rw-r--r-- | indra/llinventory/llsettingssky.h | 270 |
1 files changed, 99 insertions, 171 deletions
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 82c2d6a804..fd613e4299 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,16 +84,11 @@ 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 LLUUID DEFAULT_ASSET_ID; + static const std::string SETTING_LEGACY_HAZE; - typedef std::shared_ptr<LLSettingsSky> ptr_t; - typedef std::pair<F32, F32> azimalt_t; + typedef PTR_NAMESPACE::shared_ptr<LLSettingsSky> ptr_t; //--------------------------------------------------------------------- LLSettingsSky(const LLSD &data); @@ -95,89 +97,68 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("sky"); } - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } - + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("sky"); } + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; static LLSD defaults(); - LLUUID getBloomTextureId() const - { - return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); - } - - //--------------------------------------------------------------------- - LLColor3 getAmbientColor() const - { - return LLColor3(mSettings[SETTING_AMBIENT]); - } - - void setAmbientColor(const LLColor3 &val) - { - setValue(SETTING_AMBIENT, val); - } - - LLColor3 getBlueDensity() const - { - return LLColor3(mSettings[SETTING_BLUE_DENSITY]); - } - - void setBlueDensity(const LLColor3 &val) + F32 getPlanetRadius() const { - setValue(SETTING_BLUE_DENSITY, val); + return mSettings[SETTING_PLANET_RADIUS].asReal(); } - LLColor3 getBlueHorizon() const + F32 getSkyBottomRadius() const { - return LLColor3(mSettings[SETTING_BLUE_HORIZON]); + return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); } - void setBlueHorizon(const LLColor3 &val) + F32 getSkyTopRadius() const { - setValue(SETTING_BLUE_HORIZON, val); + return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); } - F32 getDensityMultiplier() const + F32 getSunArcRadians() const { - return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); + return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); } - void setDensityMultiplier(F32 val) + F32 getMieAnisotropy() const { - setValue(SETTING_DENSITY_MULTIPLIER, val); + return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } - - 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 @@ -296,16 +277,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(); @@ -326,15 +297,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(); @@ -370,20 +332,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(); @@ -394,94 +347,71 @@ public: setValue(SETTING_SUN_TEXTUREID, id); } - // Internal/calculated settings - LLVector3 getLightDirection() const - { - update(); - return mLightDirection; - }; - - LLVector3 getClampedLightDirection() const - { - update(); - return mClampedLightDirection; - }; - - LLVector3 getSunDirection() const + //===================================================================== + // transient properties used in animations. + LLUUID getNextSunTextureId() const { - update(); - return mSunDirection; + return mNextSunTextureId; } - LLVector3 getMoonDirection() const + LLUUID getNextMoonTextureId() const { - update(); - return mMoonDirection; + return mNextMoonTextureId; } - LLColor4U getFadeColor() const + LLUUID getNextCloudNoiseTextureId() const { - update(); - return mFadeColor; + return mNextCloudTextureId; } - LLColor4 getMoonAmbient() const - { - update(); - return mMoonAmbient; - } + //===================================================================== + virtual void loadTextures() { }; - LLColor3 getMoonDiffuse() const - { - update(); - return mMoonDiffuse; - } + //===================================================================== + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; + static validation_list_t validationList(); - LLColor4 getSunAmbient() const - { - update(); - return mSunAmbient; - } + static LLSD translateLegacySettings(const LLSD& legacy); - LLColor3 getSunDiffuse() const - { - update(); - return mSunDiffuse; - } +// LEGACY_ATMOSPHERICS + static LLSD translateLegacyHazeSettings(const LLSD& legacy); - LLColor4 getTotalAmbient() const - { - update(); - return mTotalAmbient; - } + LLColor3 getLightAttenuation(F32 distance) const; + LLColor3 getLightTransmittance() const; + LLColor3 gammaCorrect(const LLColor3& in) const; - //===================================================================== - virtual void loadTextures() { }; - //===================================================================== - virtual validation_list_t getValidationList() const override; - static validation_list_t validationList(); + LLColor3 getBlueDensity() const; + LLColor3 getBlueHorizon() const; + F32 getHazeDensity() const; + F32 getHazeHorizon() const; + F32 getDensityMultiplier() const; + F32 getDistanceMultiplier() const; - static LLSD translateLegacySettings(LLSD legacy); + 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); - //===================================================================== - // transient properties used in animations. - LLUUID getNextSunTextureId() const - { - return mNextSunTextureId; - } +// Internal/calculated settings + bool getIsSunUp() const; + bool getIsMoonUp() const; - LLUUID getNextMoonTextureId() const - { - return mNextMoonTextureId; - } + 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; - LLUUID getNextCloudNoiseTextureId() const - { - return mNextCloudTextureId; - } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + static LLUUID GetDefaultAssetId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; @@ -490,36 +420,34 @@ protected: LLSettingsSky(); - virtual stringset_t getSlerpKeys() const override; - - virtual void updateSettings() override; + virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE; + virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE; + virtual void updateSettings() SETTINGS_OVERRIDE; private: + mutable bool mPositionsDirty; + mutable bool mLightingDirty; + static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); - static const F32 NIGHTTIME_ELEVATION; - static const F32 NIGHTTIME_ELEVATION_COS; + void calculateHeavenlyBodyPositions() 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; |