summaryrefslogtreecommitdiff
path: root/indra/newview/llvosky.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-06-08 22:22:20 +0100
committerGraham Linden <graham@lindenlab.com>2018-06-08 22:22:20 +0100
commit507c4921826e73635f6ae31087ab0e6cd1280f43 (patch)
tree1f6a5aba26ba21f43ae79b3eddd1f8d5a458c481 /indra/newview/llvosky.cpp
parent363f7f84a149c0bc4fe21df80aead821f02a7ff0 (diff)
Add specific shader for the moon to allow different rendering at day vs night.
Add MouseMoon positioning ala MouseSun debug setting and accessors to use it.
Diffstat (limited to 'indra/newview/llvosky.cpp')
-rw-r--r--indra/newview/llvosky.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index fc83218b1a..6d066ecfd9 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -1354,3 +1354,39 @@ void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLV
LLSkyTex::stepCurrent();
}
+
+void LLVOSky::setSunDirectionCFR(const LLVector3 &sun_dir_cfr)
+{
+ mSun.setDirection(sun_dir_cfr);
+
+ mLastLightingDirection = mSun.getDirection();
+
+ // Push the sun "South" as it approaches directly overhead so that we can always see bump mapping
+ // on the upward facing faces of cubes.
+ {
+ // Same as dot product with the up direction + clamp.
+ F32 sunDot = llmax(0.f, sun_dir_cfr.mV[2]);
+ sunDot *= sunDot;
+
+ // Create normalized vector that has the sunDir pushed south about an hour and change.
+ LLVector3 adjustedDir = (sun_dir_cfr + LLVector3(0.f, -0.70711f, 0.70711f)) * 0.5f;
+
+ // Blend between normal sun dir and adjusted sun dir based on how close we are
+ // to having the sun overhead.
+ mBumpSunDir = adjustedDir * sunDot + sun_dir_cfr * (1.0f - sunDot);
+ mBumpSunDir.normalize();
+ }
+
+ updateDirections();
+
+ LLSkyTex::stepCurrent();
+}
+
+void LLVOSky::setMoonDirectionCFR(const LLVector3 &moon_dir_cfr)
+{
+ mMoon.setDirection(moon_dir_cfr);
+
+ updateDirections();
+
+ LLSkyTex::stepCurrent();
+}