diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-21 19:10:32 +0100 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-21 19:10:32 +0100 |
commit | ae5f24eb4d8a215cc26ef45ababc6ddec8f28edb (patch) | |
tree | 9e64b5e79ad3cc503de5a766b863eeb07ed159ea /indra/newview/lldrawpoolwater.cpp | |
parent | 589e23884f957e00328b7aa04629f47d1f070a4e (diff) |
Make rendering of sun / moon work with both in the sky (test visibility independently).
Diffstat (limited to 'indra/newview/lldrawpoolwater.cpp')
-rw-r--r-- | indra/newview/lldrawpoolwater.cpp | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 2804ad1f46..bcc0023089 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -493,45 +493,30 @@ void LLDrawPoolWater::shade() light_dir = voskyp->getLightDirection(); light_dir.normalize(); - if (LLEnvironment::instance().getIsDayTime()) + bool sun_up = LLEnvironment::instance().getIsSunUp(); + bool moon_up = LLEnvironment::instance().getIsSunUp(); + + if (sun_up) { - light_color = voskyp->getSunAmbientColor(); - light_diffuse = voskyp->getSunDiffuseColor(); - light_diffuse.normalize(); - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); - light_diffuse *= (light_exp + 0.25f); + light_color = light_color + voskyp->getSunAmbientColor(); + light_diffuse += voskyp->getSunDiffuseColor(); } - else + + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); + + if (moon_up) { - light_color = voskyp->getMoonDiffuseColor(); - light_diffuse = voskyp->getMoonDiffuseColor(); - light_diffuse.normalize(); - light_diffuse *= 0.5f; - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); + light_color += voskyp->getMoonDiffuseColor(); + light_diffuse += voskyp->getMoonDiffuseColor() * 0.5f; + + if (!sun_up) + { + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); + } } -// if (gSky.getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS) -// { -// light_dir = gSky.getSunDirection(); -// light_dir.normVec(); -// light_color = gSky.getSunDiffuseColor(); -// if(gSky.mVOSkyp) { -// light_diffuse = gSky.mVOSkyp->getSun().getColorCached(); -// light_diffuse.normVec(); -// } -// light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); -// light_diffuse *= light_exp + 0.25f; -// } -// else -// { -// light_dir = gSky.getMoonDirection(); -// light_dir.normVec(); -// light_color = gSky.getMoonDiffuseColor(); -// light_diffuse = gSky.mVOSkyp->getMoon().getColorCached(); -// light_diffuse.normVec(); -// light_diffuse *= 0.5f; -// light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); -// } + light_diffuse.normalize(); + light_diffuse *= (light_exp + 0.25f); light_exp *= light_exp; light_exp *= light_exp; |