Make rendering of sun / moon work with both in the sky (test visibility independently).
parent
589e23884f
commit
ae5f24eb4d
|
|
@ -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);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 = light_color + voskyp->getSunAmbientColor();
|
||||
light_diffuse += voskyp->getSunDiffuseColor();
|
||||
}
|
||||
|
||||
// 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_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() * 0.5f;
|
||||
|
||||
if (!sun_up)
|
||||
{
|
||||
light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f);
|
||||
}
|
||||
}
|
||||
|
||||
light_diffuse.normalize();
|
||||
light_diffuse *= (light_exp + 0.25f);
|
||||
|
||||
light_exp *= light_exp;
|
||||
light_exp *= light_exp;
|
||||
|
|
|
|||
|
|
@ -377,9 +377,16 @@ F32 LLEnvironment::getWaterHeight() const
|
|||
return gAgent.getRegion()->getWaterHeight();
|
||||
}
|
||||
|
||||
bool LLEnvironment::getIsDayTime() const
|
||||
bool LLEnvironment::getIsSunUp() const
|
||||
{
|
||||
return mCurrentEnvironment->getSky()->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_SIN;
|
||||
LLVector3 sunDir = mCurrentEnvironment->getSky()->getSunDirection();
|
||||
return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN;
|
||||
}
|
||||
|
||||
bool LLEnvironment::getIsMoonUp() const
|
||||
{
|
||||
LLVector3 moonDir = mCurrentEnvironment->getSky()->getMoonDirection();
|
||||
return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -183,8 +183,8 @@ public:
|
|||
|
||||
F32 getCamHeight() const;
|
||||
F32 getWaterHeight() const;
|
||||
bool getIsDayTime() const; // "Day Time" is defined as the sun above the horizon.
|
||||
bool getIsNightTime() const { return !getIsDayTime(); } // "Not Day Time"
|
||||
bool getIsSunUp() const;
|
||||
bool getIsMoonUp() const;
|
||||
|
||||
inline F32 getSceneLightStrength() const { return mSceneLightStrength; }
|
||||
inline void setSceneLightStrength(F32 light_strength) { mSceneLightStrength = light_strength; }
|
||||
|
|
|
|||
|
|
@ -696,11 +696,8 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
|
|||
bool draw_sun = updateHeavenlyBodyGeometry(drawable, FACE_SUN, mSun, up, right);
|
||||
bool draw_moon = updateHeavenlyBodyGeometry(drawable, FACE_MOON, mMoon, up, right);
|
||||
|
||||
bool daytime = LLEnvironment::getInstance()->getIsDayTime();
|
||||
|
||||
// makeshift check until we properly handle moon in daytime
|
||||
draw_sun &= daytime;
|
||||
draw_moon &= !daytime;
|
||||
draw_sun &= LLEnvironment::getInstance()->getIsSunUp();
|
||||
draw_moon &= LLEnvironment::getInstance()->getIsMoonUp();
|
||||
|
||||
mSun.setDraw(draw_sun);
|
||||
mMoon.setDraw(draw_moon);
|
||||
|
|
|
|||
Loading…
Reference in New Issue