diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llsettingssky.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llsky.cpp | 67 | ||||
-rw-r--r-- | indra/newview/llsky.h | 10 | ||||
-rw-r--r-- | indra/newview/lltoolgun.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llvosky.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llvosky.h | 9 |
7 files changed, 35 insertions, 72 deletions
diff --git a/indra/newview/llsettingssky.cpp b/indra/newview/llsettingssky.cpp index 024277a228..ccab35f669 100644 --- a/indra/newview/llsettingssky.cpp +++ b/indra/newview/llsettingssky.cpp @@ -376,9 +376,9 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() { // set direction (in CRF) and don't allow overriding LLVector3 crf_sunDirection(mSunDirection.mV[2], mSunDirection.mV[0], mSunDirection.mV[1]); + LLVector3 crf_moonDirection(mMoonDirection.mV[2], mMoonDirection.mV[0], mMoonDirection.mV[1]); - gSky.setSunDirection(crf_sunDirection, LLVector3(0, 0, 0)); - gSky.setOverrideSun(TRUE); + gSky.setSunDirection(crf_sunDirection, crf_moonDirection); } // is the normal from the sun or the moon diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index a961f0e3b4..fb3123fd81 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -76,7 +76,6 @@ LLSky::LLSky() mLightingGeneration = 0; mUpdatedThisFrame = TRUE; - mOverrideSimSunPosition = FALSE; mSunPhase = 0.f; } @@ -133,33 +132,13 @@ void LLSky::resetVertexBuffers() } } -void LLSky::setOverrideSun(BOOL override) -{ - if (!mOverrideSimSunPosition && override) - { - mLastSunDirection = getSunDirection(); - } - else if (mOverrideSimSunPosition && !override) - { - setSunDirection(mLastSunDirection, LLVector3::zero); - } - mOverrideSimSunPosition = override; -} - -void LLSky::setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity) +void LLSky::setSunDirection(const LLVector3 &sun_direction, const LLVector3 &moon_direction) { if(mVOSkyp.notNull()) { - mVOSkyp->setSunDirection(sun_direction, sun_ang_velocity); + mVOSkyp->setSunDirection(sun_direction, moon_direction); } } - -void LLSky::setSunTargetDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity) -{ - mSunTargDir = sun_direction; -} - - LLVector3 LLSky::getSunDirection() const { if (mVOSkyp) @@ -327,13 +306,13 @@ void LLSky::init(const LLVector3 &sun_direction) LLGLState::checkStates(); LLGLState::checkTextureChannels(); - if (gSavedSettings.getBOOL("SkyOverrideSimSunPosition") || mOverrideSimSunPosition) + if (gSavedSettings.getBOOL("SkyOverrideSimSunPosition")) { - setSunDirection(mSunDefaultPosition, LLVector3(0.f, 0.f, 0.f)); + setSunDirection(mSunDefaultPosition, -mSunDefaultPosition); } else { - setSunDirection(sun_direction, LLVector3(0.f, 0.f, 0.f)); + setSunDirection(sun_direction, -sun_direction); } LLGLState::checkStates(); @@ -363,24 +342,24 @@ void LLSky::setWind(const LLVector3& average_wind) void LLSky::propagateHeavenlyBodies(F32 dt) { - if (!mOverrideSimSunPosition) - { - LLVector3 curr_dir = getSunDirection(); - LLVector3 diff = mSunTargDir - curr_dir; - const F32 dist = diff.normVec(); - if (dist > 0) - { - const F32 step = llmin (dist, 0.00005f); - //const F32 step = min (dist, 0.0001); - diff *= step; - curr_dir += diff; - curr_dir.normVec(); - if (mVOSkyp) - { - mVOSkyp->setSunDirection(curr_dir, LLVector3()); - } - } - } +// if (!mOverrideSimSunPosition) +// { +// LLVector3 curr_dir = getSunDirection(); +// LLVector3 diff = mSunTargDir - curr_dir; +// const F32 dist = diff.normVec(); +// if (dist > 0) +// { +// const F32 step = llmin (dist, 0.00005f); +// //const F32 step = min (dist, 0.0001); +// diff *= step; +// curr_dir += diff; +// curr_dir.normVec(); +// if (mVOSkyp) +// { +// mVOSkyp->setSunDirection(curr_dir); +// } +// } +// } } F32 LLSky::getSunPhase() const diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index 7b98c97840..79549948f6 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -52,10 +52,7 @@ public: void cleanup(); - void setOverrideSun(BOOL override); - BOOL getOverrideSun() { return mOverrideSimSunPosition; } - void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity); - void setSunTargetDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity); + void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &moon_direction); LLColor4 getFogColor() const; @@ -97,8 +94,6 @@ public: LLPointer<LLVOWLSky> mVOWLSkyp; - LLVector3 mSunTargDir; - // Legacy stuff LLVector3 mSunDefaultPosition; @@ -106,12 +101,9 @@ public: static const F32 NIGHTTIME_ELEVATION_COS; protected: - BOOL mOverrideSimSunPosition; - F32 mSunPhase; LLColor4 mFogColor; // Color to use for fog and haze - LLVector3 mLastSunDirection; }; extern LLSky gSky; diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 6c9155be85..6903e69d46 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -107,8 +107,8 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) if (gSavedSettings.getBOOL("MouseSun")) { - gSky.setSunDirection(LLViewerCamera::getInstance()->getAtAxis(), LLVector3(0.f, 0.f, 0.f)); - gSky.setOverrideSun(TRUE); + LLVector3 sunpos = LLViewerCamera::getInstance()->getAtAxis(); + gSky.setSunDirection(sunpos, -sunpos); gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis()); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e7917c043f..cd3443eee2 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4738,10 +4738,9 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LL_DEBUGS("Windlight Sync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; gSky.setSunPhase(phase); - gSky.setSunTargetDirection(sun_direction, sun_ang_velocity); - if ( !(gSavedSettings.getBOOL("SkyOverrideSimSunPosition") || gSky.getOverrideSun()) ) + if ( !gSavedSettings.getBOOL("SkyOverrideSimSunPosition") ) { - gSky.setSunDirection(sun_direction, sun_ang_velocity); + gSky.setSunDirection(sun_direction, -sun_direction); } } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 22cd14a830..0c211b259c 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -833,7 +833,7 @@ void LLVOSky::calcAtmospherics(void) LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); mSun.setColor(psky->getSunlightColor()); - mMoon.setColor(LLColor3(1.0f, 1.0f, 1.0f)); + mMoon.setColor(LLColor3(2.0f, 2.0f, 2.0f)); mSun.renewDirection(); mSun.renewColor(); @@ -2063,7 +2063,7 @@ void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_an } } -void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity) +void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &moon_dir) { LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; sun_direction.normalize(); @@ -2086,8 +2086,8 @@ void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang F32 dp = mLastLightingDirection * sun_direction; mSun.setDirection(sun_direction); - mSun.setAngularVelocity(sun_ang_velocity); - mMoon.setDirection(-sun_direction); + + mMoon.setDirection(moon_dir); calcAtmospherics(); if (dp < 0.995f) { //the sun jumped a great deal, update immediately mForceUpdate = TRUE; diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index fe2d85df02..9123381c3d 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -461,7 +461,7 @@ public: void initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity); - void setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity); + void setSunDirection(const LLVector3 &sun_dir, const LLVector3 &moon_dir); BOOL updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 side, const BOOL is_sun, LLHeavenBody& hb, const F32 sin_max_angle, @@ -553,13 +553,6 @@ protected: F32 mFogRatio; F32 mWorldScale; -// LLColor4 mSunAmbient; -// LLColor4 mMoonAmbient; -// LLColor4 mTotalAmbient; -// LLColor3 mSunDiffuse; -// LLColor3 mMoonDiffuse; -// LLColor4U mFadeColor; // Color to fade in from - LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment S32 mDrawRefl; |