diff options
Diffstat (limited to 'indra/newview/llenvironment.h')
-rw-r--r-- | indra/newview/llenvironment.h | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 6382e0afd4..d79a1b408a 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -154,16 +154,18 @@ public: LLSettingsSky::ptr_t getCurrentSky() const { return mCurrentEnvironment->getSky(); } LLSettingsWater::ptr_t getCurrentWater() const { return mCurrentEnvironment->getWater(); } + static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky); + void update(const LLViewerCamera * cam); void updateGLVariablesForSettings(LLGLSLShader *shader, const LLSettingsBase::ptr_t &psetting); void updateShaderUniforms(LLGLSLShader *shader); - void setSelectedEnvironment(EnvSelection_t env, F64Seconds transition = TRANSITION_DEFAULT, bool forced = false); + void setSelectedEnvironment(EnvSelection_t env, LLSettingsBase::Seconds transition = TRANSITION_DEFAULT, bool forced = false); EnvSelection_t getSelectedEnvironment() const { return mSelectedEnvironment; } bool hasEnvironment(EnvSelection_t env); - void setEnvironment(EnvSelection_t env, const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset); + void setEnvironment(EnvSelection_t env, const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); void setEnvironment(EnvSelection_t env, fixedEnvironment_t fixed); void setEnvironment(EnvSelection_t env, const LLSettingsBase::ptr_t &fixed); void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(fixed, LLSettingsWater::ptr_t())); } @@ -173,13 +175,13 @@ public: void clearEnvironment(EnvSelection_t env); LLSettingsDay::ptr_t getEnvironmentDay(EnvSelection_t env); - S64Seconds getEnvironmentDayLength(EnvSelection_t env); - S64Seconds getEnvironmentDayOffset(EnvSelection_t env); + LLSettingsDay::Seconds getEnvironmentDayLength(EnvSelection_t env); + LLSettingsDay::Seconds getEnvironmentDayOffset(EnvSelection_t env); fixedEnvironment_t getEnvironmentFixed(EnvSelection_t env); LLSettingsSky::ptr_t getEnvironmentFixedSky(EnvSelection_t env) { return getEnvironmentFixed(env).first; }; LLSettingsWater::ptr_t getEnvironmentFixedWater(EnvSelection_t env) { return getEnvironmentFixed(env).second; }; - void updateEnvironment(F64Seconds transition = TRANSITION_DEFAULT, bool forced = false); + void updateEnvironment(LLSettingsBase::Seconds transition = TRANSITION_DEFAULT, bool forced = false); void addSky(const LLSettingsSky::ptr_t &sky); void addWater(const LLSettingsWater::ptr_t &sky); @@ -199,15 +201,23 @@ public: F32 getCamHeight() const; F32 getWaterHeight() const; - bool getIsDayTime() const; // "Day Time" is defined as the sun above the horizon. - bool getIsNightTime() const { return !getIsDayTime(); } // "Not Day Time" + bool getIsSunUp() const; + bool getIsMoonUp() const; + + // 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; + + // Returns light direction converted to CFR coord system + LLVector4 getLightDirectionCFR() const; - inline F32 getSceneLightStrength() const { return mSceneLightStrength; } - inline void setSceneLightStrength(F32 light_strength) { mSceneLightStrength = light_strength; } + // 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; - inline LLVector4 getLightDirection() const { return ((mCurrentEnvironment->getSky()) ? LLVector4(mCurrentEnvironment->getSky()->getLightDirection(), 0.0f) : LLVector4()); } - inline LLVector4 getClampedLightDirection() const { return LLVector4(mCurrentEnvironment->getSky()->getClampedLightDirection(), 0.0f); } - inline LLVector4 getRotatedLight() const { return mRotatedLight; } + // Returns light direction converted to OGL coord system + // and rotated by last cam yaw needed by water rendering shaders + LLVector4 getRotatedLightNorm() const; static LLSettingsWater::ptr_t createWaterFromLegacyPreset(const std::string filename); static LLSettingsSky::ptr_t createSkyFromLegacyPreset(const std::string filename); @@ -248,6 +258,9 @@ protected: virtual void initSingleton(); private: + LLVector4 toCFR(const LLVector3 vec) const; + LLVector4 toLightNorm(const LLVector3 vec) const; + class DayInstance { public: @@ -262,9 +275,9 @@ private: DayInstance(); virtual ~DayInstance() { }; - virtual void update(F64Seconds); + virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta); - void setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset); + void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); void setSky(const LLSettingsSky::ptr_t &psky); void setWater(const LLSettingsWater::ptr_t &pwater); @@ -278,8 +291,8 @@ private: LLSettingsDay::ptr_t getDayCycle() const { return mDayCycle; } LLSettingsSky::ptr_t getSky() const { return mSky; } LLSettingsWater::ptr_t getWater() const { return mWater; } - S64Seconds getDayLength() const { return mDayLength; } - S64Seconds getDayOffset() const { return mDayOffset; } + LLSettingsDay::Seconds getDayLength() const { return mDayLength; } + LLSettingsDay::Seconds getDayOffset() const { return mDayOffset; } S32 getSkyTrack() const { return mSkyTrack; } virtual void animate(); @@ -295,14 +308,14 @@ private: InstanceType_t mType; bool mInitialized; - S64Seconds mDayLength; - S64Seconds mDayOffset; + LLSettingsDay::Seconds mDayLength; + LLSettingsDay::Seconds mDayOffset; S32 mLastTrackAltitude; LLSettingsBlender::ptr_t mBlenderSky; LLSettingsBlender::ptr_t mBlenderWater; - F64 secondsToKeyframe(S64Seconds seconds); + LLSettingsBase::TrackPosition secondsToKeyframe(LLSettingsDay::Seconds seconds); }; typedef std::array<DayInstance::ptr_t, ENV_END> InstanceArray_t; @@ -310,21 +323,21 @@ private: class DayTransition : public DayInstance { public: - DayTransition(const LLSettingsSky::ptr_t &skystart, const LLSettingsWater::ptr_t &waterstart, DayInstance::ptr_t &end, S64Seconds time); + DayTransition(const LLSettingsSky::ptr_t &skystart, const LLSettingsWater::ptr_t &waterstart, DayInstance::ptr_t &end, LLSettingsDay::Seconds time); virtual ~DayTransition() { }; - virtual void update(F64Seconds); + virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta); virtual void animate(); protected: LLSettingsSky::ptr_t mStartSky; LLSettingsWater::ptr_t mStartWater; DayInstance::ptr_t mNextInstance; - S64Seconds mTransitionTime; + LLSettingsDay::Seconds mTransitionTime; }; static const F32 SUN_DELTA_YAW; - static const F32 NIGHTTIME_ELEVATION_COS; + F32 mLastCamYaw = 0.0f; typedef std::map<LLUUID, LLSettingsBase::ptr_t> AssetSettingMap_t; @@ -355,9 +368,6 @@ private: namedSettingMap_t mDayCycleByName; AssetSettingMap_t mDayCycleById; - F32 mSceneLightStrength; - LLVector4 mRotatedLight; - UserPrefs mUserPrefs; change_signal_t mSkyListChange; @@ -415,8 +425,8 @@ class LLTrackBlenderLoopingManual : public LLSettingsBlender public: LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno); - F64 setPosition(F64 position) override; - virtual void switchTrack(S32 trackno, F64 position) override; + F64 setPosition(const LLSettingsBase::TrackPosition& position); + virtual void switchTrack(S32 trackno, const LLSettingsBase::TrackPosition& position) override; S32 getTrack() const { return mTrackNo; } typedef std::shared_ptr<LLTrackBlenderLoopingManual> ptr_t; |