summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llinventory/llsettingssky.cpp45
-rw-r--r--indra/llinventory/llsettingssky.h3
-rw-r--r--indra/llmath/m3math.cpp24
-rw-r--r--indra/llmath/m3math.h4
-rw-r--r--indra/llmath/m4math.cpp27
-rw-r--r--indra/llmath/m4math.h6
-rw-r--r--indra/llmath/tests/m3math_test.cpp2
-rw-r--r--indra/newview/llappviewer.cpp1
-rw-r--r--indra/newview/llenvironment.cpp6
-rw-r--r--indra/newview/llsettingsvo.cpp6
-rw-r--r--indra/newview/llsky.cpp55
-rw-r--r--indra/newview/llsky.h16
-rw-r--r--indra/test/llsdmessagebuilder_tut.cpp2
-rw-r--r--indra/test/llsdmessagereader_tut.cpp2
-rw-r--r--indra/test/lltemplatemessagebuilder_tut.cpp5
15 files changed, 52 insertions, 152 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 25d197d9be..6b8acac3da 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -35,6 +35,7 @@
//=========================================================================
namespace
{
+ // vectors in +x at, +y up, +z right coord sys
const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0);
const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f);
const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f);
@@ -599,7 +600,12 @@ LLSD LLSettingsSky::defaults()
{
LLSD dfltsetting;
LLQuaternion sunquat;
+
+ // we're using the roll value of 80 degrees from horizon
+ // with an euler angle conversion meant for a +x right, +y up, +z at coord sys here
sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East
+
+ // then we're using the conjugate which does not give the opposite direction
LLQuaternion moonquat = ~sunquat;
// Magic constants copied form dfltsetting.xml
@@ -807,34 +813,41 @@ void LLSettingsSky::updateSettings()
calculateLightSettings();
}
+bool LLSettingsSky::getIsSunUp() const
+{
+ LLVector3 sunDir = getSunDirection();
+ return sunDir.mV[1] > NIGHTTIME_ELEVATION_SIN;
+}
+
+bool LLSettingsSky::getIsMoonUp() const
+{
+ LLVector3 moonDir = getMoonDirection();
+ return moonDir.mV[1] > NIGHTTIME_ELEVATION_SIN;
+}
+
void LLSettingsSky::calculateHeavnlyBodyPositions()
{
- mSunDirection = DUE_EAST * getSunRotation();
+ LLQuaternion sunq = getSunRotation();
+ LLQuaternion moonq = getMoonRotation();
+
+ mSunDirection = DUE_EAST * sunq;
mSunDirection.normalize();
- mMoonDirection = DUE_EAST * getMoonRotation();
+ mMoonDirection = DUE_EAST * moonq;
mMoonDirection.normalize();
// is the normal from the sun or the moon
- if (mSunDirection.mV[1] >= 0.0)
+ if (getIsSunUp())
{
mLightDirection = mSunDirection;
}
- else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN)
+ else if (getIsMoonUp())
{
- // clamp v1 to 0 so sun never points up and causes weirdness on some machines
- LLVector3 vec(mSunDirection);
- vec.mV[1] = 0.0;
- vec.normalize();
- mLightDirection = vec;
+ mLightDirection = mMoonDirection;
}
else
{
- // clamp v1 to 0 so moon never points up and causes weirdness on some machines
- LLVector3 vec(mMoonDirection);
- vec.mV[1] = 0.0;
- vec.normalize();
- mLightDirection = vec;
+ mLightDirection = LLVector3::z_axis;
}
// calculate the clamp lightnorm for sky (to prevent ugly banding in sky
@@ -846,6 +859,10 @@ void LLSettingsSky::calculateHeavnlyBodyPositions()
mClampedLightDirection.mV[1] = -0.1f;
mClampedLightDirection.normalize();
}
+
+ //LL_INFOS() << "Sun: " << mSunDirection << LL_ENDL;
+ //LL_INFOS() << "Moon: " << mMoonDirection << LL_ENDL;
+ //LL_INFOS() << "Light: " << mLightDirection << LL_ENDL;
}
LLColor3 LLSettingsSky::getBlueDensity() const
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 8e96735abf..bb8633d338 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -490,6 +490,9 @@ public:
void setHazeDensity(F32 val);
void setHazeHorizon(F32 val);
+ bool getIsSunUp() const;
+ bool getIsMoonUp() const;
+
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp
index 802ddb9e57..65eb3348de 100644
--- a/indra/llmath/m3math.cpp
+++ b/indra/llmath/m3math.cpp
@@ -75,13 +75,6 @@ LLMatrix3::LLMatrix3(const F32 angle, const LLVector4 &vec)
setRot(quat);
}
-LLMatrix3::LLMatrix3(const F32 angle, const F32 x, const F32 y, const F32 z)
-{
- LLVector3 vec(x, y, z);
- LLQuaternion quat(angle, vec);
- setRot(quat);
-}
-
LLMatrix3::LLMatrix3(const F32 roll, const F32 pitch, const F32 yaw)
{
setRot(roll,pitch,yaw);
@@ -294,14 +287,6 @@ LLQuaternion LLMatrix3::quaternion() const
return quat;
}
-
-// These functions take Rotation arguments
-const LLMatrix3& LLMatrix3::setRot(const F32 angle, const F32 x, const F32 y, const F32 z)
-{
- setRot(LLQuaternion(angle,x,y,z));
- return *this;
-}
-
const LLMatrix3& LLMatrix3::setRot(const F32 angle, const LLVector3 &vec)
{
setRot(LLQuaternion(angle, vec));
@@ -394,15 +379,6 @@ const LLMatrix3& LLMatrix3::setCol( U32 colIndex, const LLVector3& col )
return *this;
}
-
-// Rotate exisitng mMatrix
-const LLMatrix3& LLMatrix3::rotate(const F32 angle, const F32 x, const F32 y, const F32 z)
-{
- LLMatrix3 mat(angle, x, y, z);
- *this *= mat;
- return *this;
-}
-
const LLMatrix3& LLMatrix3::rotate(const F32 angle, const LLVector3 &vec)
{
diff --git a/indra/llmath/m3math.h b/indra/llmath/m3math.h
index 2be5452f8d..bf38895855 100644
--- a/indra/llmath/m3math.h
+++ b/indra/llmath/m3math.h
@@ -60,7 +60,6 @@ class LLMatrix3
explicit LLMatrix3(const F32 *mat); // Initializes Matrix to values in mat
explicit LLMatrix3(const LLQuaternion &q); // Initializes Matrix with rotation q
- LLMatrix3(const F32 angle, const F32 x, const F32 y, const F32 z); // Initializes Matrix with axis angle
LLMatrix3(const F32 angle, const LLVector3 &vec); // Initializes Matrix with axis angle
LLMatrix3(const F32 angle, const LLVector3d &vec); // Initializes Matrix with axis angle
LLMatrix3(const F32 angle, const LLVector4 &vec); // Initializes Matrix with axis angle
@@ -81,8 +80,7 @@ class LLMatrix3
// Matrix setters - set some properties without modifying others
//
- // These functions take Rotation arguments
- const LLMatrix3& setRot(const F32 angle, const F32 x, const F32 y, const F32 z); // Calculate rotation matrix for rotating angle radians about (x, y, z)
+ // These functions take Rotation arguments
const LLMatrix3& setRot(const F32 angle, const LLVector3 &vec); // Calculate rotation matrix for rotating angle radians about vec
const LLMatrix3& setRot(const F32 roll, const F32 pitch, const F32 yaw); // Calculate rotation matrix from Euler angles
const LLMatrix3& setRot(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos
diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp
index d89c482804..3baf1bad18 100644
--- a/indra/llmath/m4math.cpp
+++ b/indra/llmath/m4math.cpp
@@ -384,13 +384,6 @@ void LLMatrix4::initRows(const LLVector4 &row0,
}
-const LLMatrix4& LLMatrix4::initRotation(const F32 angle, const F32 x, const F32 y, const F32 z)
-{
- LLMatrix3 mat(angle, x, y, z);
- return initMatrix(mat);
-}
-
-
const LLMatrix4& LLMatrix4::initRotation(F32 angle, const LLVector4 &vec)
{
LLMatrix3 mat(angle, vec);
@@ -412,17 +405,6 @@ const LLMatrix4& LLMatrix4::initRotation(const LLQuaternion &q)
}
-// Position and Rotation
-const LLMatrix4& LLMatrix4::initRotTrans(const F32 angle, const F32 rx, const F32 ry, const F32 rz,
- const F32 tx, const F32 ty, const F32 tz)
-{
- LLMatrix3 mat(angle, rx, ry, rz);
- LLVector3 translation(tx, ty, tz);
- initMatrix(mat);
- setTranslation(translation);
- return (*this);
-}
-
const LLMatrix4& LLMatrix4::initRotTrans(const F32 angle, const LLVector3 &axis, const LLVector3&translation)
{
LLMatrix3 mat(angle, axis);
@@ -513,15 +495,6 @@ const LLMatrix4& LLMatrix4::initAll(const LLVector3 &scale, const LLQuaternion &
return (*this);
}
-// Rotate exisitng mMatrix
-const LLMatrix4& LLMatrix4::rotate(const F32 angle, const F32 x, const F32 y, const F32 z)
-{
- LLVector4 vec4(x, y, z);
- LLMatrix4 mat(angle, vec4);
- *this *= mat;
- return *this;
-}
-
const LLMatrix4& LLMatrix4::rotate(const F32 angle, const LLVector4 &vec)
{
LLMatrix4 mat(angle, vec);
diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h
index a77c5bc76d..bf60adb9b6 100644
--- a/indra/llmath/m4math.h
+++ b/indra/llmath/m4math.h
@@ -137,7 +137,6 @@ public:
bool isIdentity() const;
const LLMatrix4& setZero(); // Clears matrix to all zeros.
- const LLMatrix4& initRotation(const F32 angle, const F32 x, const F32 y, const F32 z); // Calculate rotation matrix by rotating angle radians about (x, y, z)
const LLMatrix4& initRotation(const F32 angle, const LLVector4 &axis); // Calculate rotation matrix for rotating angle radians about vec
const LLMatrix4& initRotation(const F32 roll, const F32 pitch, const F32 yaw); // Calculate rotation matrix from Euler angles
const LLMatrix4& initRotation(const LLQuaternion &q); // Set with Quaternion and position
@@ -148,10 +147,6 @@ public:
// These operation create a matrix that will rotate and translate by the
// specified amounts.
- const LLMatrix4& initRotTrans(const F32 angle,
- const F32 rx, const F32 ry, const F32 rz,
- const F32 px, const F32 py, const F32 pz);
-
const LLMatrix4& initRotTrans(const F32 angle, const LLVector3 &axis, const LLVector3 &translation); // Rotation from axis angle + translation
const LLMatrix4& initRotTrans(const F32 roll, const F32 pitch, const F32 yaw, const LLVector4 &pos); // Rotation from Euler + translation
const LLMatrix4& initRotTrans(const LLQuaternion &q, const LLVector4 &pos); // Set with Quaternion and position
@@ -211,7 +206,6 @@ public:
// Rotate existing matrix
// These are really, really, inefficient as implemented! - djs
- const LLMatrix4& rotate(const F32 angle, const F32 x, const F32 y, const F32 z); // Rotate matrix by rotating angle radians about (x, y, z)
const LLMatrix4& rotate(const F32 angle, const LLVector4 &vec); // Rotate matrix by rotating angle radians about vec
const LLMatrix4& rotate(const F32 roll, const F32 pitch, const F32 yaw); // Rotate matrix by Euler angles
const LLMatrix4& rotate(const LLQuaternion &q); // Rotate matrix by Quaternion
diff --git a/indra/llmath/tests/m3math_test.cpp b/indra/llmath/tests/m3math_test.cpp
index 1ca2b005d9..2a0fe76aa7 100644
--- a/indra/llmath/tests/m3math_test.cpp
+++ b/indra/llmath/tests/m3math_test.cpp
@@ -77,7 +77,7 @@ namespace tut
template<> template<>
void m3math_test_object_t::test<2>()
{
- LLMatrix3 llmat3_obj(30, 1, 2, 3);
+ LLMatrix3 llmat3_obj;
llmat3_obj.setZero();
ensure("LLMatrix3::setZero failed", 0.f == llmat3_obj.setZero().mMatrix[0][0] &&
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f936cdc202..6231a0f432 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4954,7 +4954,6 @@ void LLAppViewer::idle()
//
// Update weather effects
//
- gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets
// Update wind vector
LLVector3 wind_position_region;
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index cc3a30d0b1..1e14a0c5fb 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -379,14 +379,12 @@ F32 LLEnvironment::getWaterHeight() const
bool LLEnvironment::getIsSunUp() const
{
- LLVector3 sunDir = mCurrentEnvironment->getSky()->getSunDirection();
- return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN;
+ return mCurrentEnvironment->getSky()->getIsSunUp();
}
bool LLEnvironment::getIsMoonUp() const
{
- LLVector3 moonDir = mCurrentEnvironment->getSky()->getMoonDirection();
- return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN;
+ return mCurrentEnvironment->getSky()->getIsMoonUp();
}
//-------------------------------------------------------------------------
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 804e4671ab..68513e37ac 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -464,8 +464,10 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA
legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS];
legacy[SETTING_SUNLIGHT_COLOR] = ensureArray4(settings[SETTING_SUNLIGHT_COLOR], 1.0f);
+// convert to azimuth (yaw) from east and alt (pitch) from horizon
+// in +x is at (north), +z up, +y right (east)
LLSettingsSky::azimalt_t azialt = psky->getSunRotationAzAl();
-
+
legacy[SETTING_LEGACY_EAST_ANGLE] = azialt.first;
legacy[SETTING_LEGACY_SUN_ANGLE] = azialt.second;
@@ -480,6 +482,8 @@ void LLSettingsVOSky::updateSettings()
LLVector3 sun_direction = getSunDirection();
LLVector3 moon_direction = getMoonDirection();
+ // axis swap converts from +x right, +y up, +z at
+ // to CFR (+x at, +z up, +y right)
// set direction (in CRF) and don't allow overriding
LLVector3 crf_sunDirection(sun_direction.mV[2], sun_direction.mV[0], sun_direction.mV[1]);
LLVector3 crf_moonDirection(moon_direction.mV[2], moon_direction.mV[0], moon_direction.mV[1]);
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index a81e74b6ed..4ad579b33f 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -74,7 +74,6 @@ LLSky::LLSky()
mLightingGeneration = 0;
mUpdatedThisFrame = TRUE;
- mSunPhase = 0.f;
}
@@ -292,27 +291,6 @@ void LLSky::init(const LLVector3 &sun_direction)
gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio"));
- ////////////////////////////
- //
- // Legacy code, ignore
- //
- //
-
- // Get the parameters.
- mSunDefaultPosition = gSavedSettings.getVector3("SkySunDefaultPosition");
-
- LLGLState::checkStates();
- LLGLState::checkTextureChannels();
-
- if (gSavedSettings.getBOOL("SkyOverrideSimSunPosition"))
- {
- setSunDirection(mSunDefaultPosition, -mSunDefaultPosition);
- }
- else
- {
- setSunDirection(sun_direction, -sun_direction);
- }
-
LLGLState::checkStates();
LLGLState::checkTextureChannels();
@@ -337,39 +315,6 @@ 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);
-// }
-// }
-// }
-}
-
-F32 LLSky::getSunPhase() const
-{
- return mSunPhase;
-}
-
-void LLSky::setSunPhase(const F32 phase)
-{
- mSunPhase = phase;
-}
-
//////////////////////////////////////////////////////////////////////
// Private Methods
//////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h
index 27029b254b..8b4f91b7d7 100644
--- a/indra/newview/llsky.h
+++ b/indra/newview/llsky.h
@@ -63,8 +63,6 @@ public:
void updateCull();
void updateSky();
- void propagateHeavenlyBodies(F32 dt); // dt = seconds
-
S32 mLightingGeneration;
BOOL mUpdatedThisFrame;
@@ -81,8 +79,8 @@ public:
LLColor4 getTotalAmbientColor() const;
BOOL sunUp() const;
- F32 getSunPhase() const;
- void setSunPhase(const F32 phase);
+ // Legacy
+ void setSunPhase(const F32) { }
void destroyGL();
void restoreGL();
@@ -91,17 +89,11 @@ public:
public:
LLPointer<LLVOSky> mVOSkyp; // Pointer to the LLVOSky object (only one, ever!)
LLPointer<LLVOGround> mVOGroundp;
-
LLPointer<LLVOWLSky> mVOWLSkyp;
- // Legacy stuff
- LLVector3 mSunDefaultPosition;
-
protected:
- F32 mSunPhase;
- LLColor4 mFogColor; // Color to use for fog and haze
-
+ LLColor4 mFogColor;
};
-extern LLSky gSky;
+extern LLSky gSky;
#endif
diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp
index b7283f53a6..b65a3fefd5 100644
--- a/indra/test/llsdmessagebuilder_tut.cpp
+++ b/indra/test/llsdmessagebuilder_tut.cpp
@@ -272,7 +272,7 @@ namespace tut
void LLSDMessageBuilderTestObject::test<14>()
// Quaternion
{
- LLQuaternion outValue, inValue = LLQuaternion(1,2,3,4);
+ LLQuaternion outValue, inValue = LLQuaternion(1,LLVector3(2,3,4));
LLSDMessageBuilder builder = defaultBuilder();
builder.addQuat("var", inValue);
LLSDMessageReader reader = setReader(builder);
diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp
index 6dc5cf593e..3c402765d8 100644
--- a/indra/test/llsdmessagereader_tut.cpp
+++ b/indra/test/llsdmessagereader_tut.cpp
@@ -274,7 +274,7 @@ namespace tut
void LLSDMessageReaderTestObject::test<17>()
// Quaternion
{
- LLQuaternion outValue, inValue = LLQuaternion(1,2,3,4);
+ LLQuaternion outValue, inValue = LLQuaternion(1,LLVector3(2,3,4));
LLSD sdValue = ll_sd_from_quaternion(inValue);
LLSDMessageReader msg = testType(sdValue);
msg.getQuat("block", "var", outValue);
diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp
index 7b4b6a8b70..10564ad7b3 100644
--- a/indra/test/lltemplatemessagebuilder_tut.cpp
+++ b/indra/test/lltemplatemessagebuilder_tut.cpp
@@ -319,7 +319,8 @@ namespace tut
{
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_LLQuaternion, 12));
- LLQuaternion outValue, inValue = LLQuaternion(0.3713907f, 0.5570861f, 0.7427813f,0.0f);
+ LLQuaternion outValue, inValue = LLQuaternion(0.0f, LLVector3(0.3713907f, 0.5570861f, 0.7427813f));
+
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addQuat(_PREHASH_Test0, inValue);
LLTemplateMessageReader* reader = setReader(messageTemplate, builder);
@@ -786,7 +787,7 @@ namespace tut
{
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_LLQuaternion, 12));
- LLQuaternion outValue, inValue = LLQuaternion(0.3713907f, 0.5570861f, 0.7427813f,0.0f);
+ LLQuaternion outValue, inValue = LLQuaternion(0.0f, LLVector3(0.3713907f, 0.5570861f, 0.7427813f));
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addQuat(_PREHASH_Test0, inValue);
LLTemplateMessageReader* reader = setReader(