summaryrefslogtreecommitdiff
path: root/indra/newview/llenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llenvironment.cpp')
-rw-r--r--indra/newview/llenvironment.cpp66
1 files changed, 60 insertions, 6 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index a5ee7d0737..f0bec2fda1 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -700,6 +700,18 @@ void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool f
}
}
+LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const
+{
+ LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f);
+ return vec_cfr;
+}
+
+LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const
+{
+ LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f);
+ return vec_ogl;
+}
+
LLVector3 LLEnvironment::getLightDirection() const
{
LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
@@ -710,16 +722,24 @@ LLVector3 LLEnvironment::getLightDirection() const
return psky->getLightDirection();
}
-LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const
+LLVector3 LLEnvironment::getSunDirection() const
{
- LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f);
- return vec_cfr;
+ LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
+ if (!psky)
+ {
+ return LLVector3(0, 0, 1);
+ }
+ return psky->getSunDirection();
}
-LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const
+LLVector3 LLEnvironment::getMoonDirection() const
{
- LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f);
- return vec_ogl;
+ LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
+ if (!psky)
+ {
+ return LLVector3(0, 0, -1);
+ }
+ return psky->getMoonDirection();
}
LLVector4 LLEnvironment::getLightDirectionCFR() const
@@ -729,6 +749,20 @@ LLVector4 LLEnvironment::getLightDirectionCFR() const
return light_direction_cfr;
}
+LLVector4 LLEnvironment::getSunDirectionCFR() const
+{
+ LLVector3 light_direction = getSunDirection();
+ LLVector4 light_direction_cfr = toCFR(light_direction);
+ return light_direction_cfr;
+}
+
+LLVector4 LLEnvironment::getMoonDirectionCFR() const
+{
+ LLVector3 light_direction = getMoonDirection();
+ LLVector4 light_direction_cfr = toCFR(light_direction);
+ return light_direction_cfr;
+}
+
LLVector4 LLEnvironment::getClampedLightNorm() const
{
LLVector3 light_direction = getLightDirection();
@@ -739,6 +773,26 @@ LLVector4 LLEnvironment::getClampedLightNorm() const
return toLightNorm(light_direction);
}
+LLVector4 LLEnvironment::getClampedSunNorm() const
+{
+ LLVector3 light_direction = getSunDirection();
+ if (light_direction.mV[2] < -0.1f)
+ {
+ light_direction.mV[2] = -0.1f;
+ }
+ return toLightNorm(light_direction);
+}
+
+LLVector4 LLEnvironment::getClampedMoonNorm() const
+{
+ LLVector3 light_direction = getMoonDirection();
+ if (light_direction.mV[2] < -0.1f)
+ {
+ light_direction.mV[2] = -0.1f;
+ }
+ return toLightNorm(light_direction);
+}
+
LLVector4 LLEnvironment::getRotatedLightNorm() const
{
LLVector3 light_direction = getLightDirection();