Skip to content
Snippets Groups Projects
Commit 41c7523e authored by Graham Linden's avatar Graham Linden
Browse files

SL-11676

Make sun/moon textures render on Low/Low-Mid again.

Fix solar additive being present when moon was only heavenly body in sky.
parent 71af0a2a
No related branches found
No related tags found
No related merge requests found
...@@ -111,37 +111,52 @@ void LLDrawPoolSky::render(S32 pass) ...@@ -111,37 +111,52 @@ void LLDrawPoolSky::render(S32 pass)
LLVertexBuffer::unbind(); LLVertexBuffer::unbind();
gGL.diffuseColor4f(1,1,1,1); gGL.diffuseColor4f(1,1,1,1);
for (S32 i = 0; i < llmin(6, face_count); ++i) for (S32 i = 0; i < face_count; ++i)
{ {
renderSkyCubeFace(i); renderSkyFace(i);
} }
gGL.popMatrix(); gGL.popMatrix();
} }
void LLDrawPoolSky::renderSkyCubeFace(U8 side) void LLDrawPoolSky::renderSkyFace(U8 index)
{ {
LLFace &face = *mDrawFace[LLVOSky::FACE_SIDE0 + side]; LLFace* face = mDrawFace[index];
if (!face.getGeomCount())
if (!face || !face->getGeomCount())
{ {
return; return;
} }
llassert(mSkyTex); F32 interp_val = gSky.mVOSkyp ? gSky.mVOSkyp->getInterpVal() : 0.0f;
mSkyTex[side].bindTexture(TRUE);
if (index < 6) // sky tex...interp
gGL.getTexUnit(0)->setTextureColorSpace(LLTexUnit::TCS_SRGB); {
llassert(mSkyTex);
face.renderIndexed(); mSkyTex[index].bindTexture(true); // bind the current tex
if (LLSkyTex::doInterpolate()) face->renderIndexed();
{
if (interp_val > 0.01f) // iff, we've got enough info to lerp (a to and a from)
LLGLEnable blend(GL_BLEND); {
mSkyTex[side].bindTexture(FALSE); LLGLEnable blend(GL_BLEND);
gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled llassert(mSkyTex);
face.renderIndexed(); mSkyTex[index].bindTexture(false); // bind the "other" texture
} gGL.diffuseColor4f(1, 1, 1, interp_val); // lighting is disabled
face->renderIndexed();
}
}
else // heavenly body faces, no interp...
{
LLGLEnable blend(GL_BLEND);
LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP);
if (tex)
{
gGL.getTexUnit(0)->bind(tex, true);
face->renderIndexed();
}
}
} }
void LLDrawPoolSky::endRenderPass( S32 pass ) void LLDrawPoolSky::endRenderPass( S32 pass )
......
...@@ -61,7 +61,7 @@ class LLDrawPoolSky : public LLFacePool ...@@ -61,7 +61,7 @@ class LLDrawPoolSky : public LLFacePool
/*virtual*/ void endRenderPass(S32 pass); /*virtual*/ void endRenderPass(S32 pass);
void setSkyTex(LLSkyTex* const st) { mSkyTex = st; } void setSkyTex(LLSkyTex* const st) { mSkyTex = st; }
void renderSkyCubeFace(U8 side); void renderSkyFace(U8 index);
void renderHeavenlyBody(U8 hb, LLFace* face); void renderHeavenlyBody(U8 hb, LLFace* face);
void renderSunHalo(LLFace* face); void renderSunHalo(LLFace* face);
......
...@@ -442,7 +442,7 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) ...@@ -442,7 +442,7 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
vars.density_multiplier = psky->getDensityMultiplier(); vars.density_multiplier = psky->getDensityMultiplier();
vars.distance_multiplier = psky->getDistanceMultiplier(); vars.distance_multiplier = psky->getDistanceMultiplier();
vars.max_y = psky->getMaxY(); vars.max_y = psky->getMaxY();
vars.sun_norm = LLEnvironment::instance().getLightDirectionCFR(); vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR();
vars.sunlight = psky->getSunlightColor(); vars.sunlight = psky->getSunlightColor();
vars.ambient = psky->getAmbientColor(); vars.ambient = psky->getAmbientColor();
vars.glow = psky->getGlow(); vars.glow = psky->getGlow();
......
...@@ -90,7 +90,6 @@ namespace ...@@ -90,7 +90,6 @@ namespace
S32 LLSkyTex::sComponents = 4; S32 LLSkyTex::sComponents = 4;
S32 LLSkyTex::sResolution = 64; S32 LLSkyTex::sResolution = 64;
F32 LLSkyTex::sInterpVal = 0.f;
S32 LLSkyTex::sCurrent = 0; S32 LLSkyTex::sCurrent = 0;
...@@ -479,7 +478,7 @@ void LLVOSky::init() ...@@ -479,7 +478,7 @@ void LLVOSky::init()
m_atmosphericsVars.haze_horizon = psky->getHazeHorizon(); m_atmosphericsVars.haze_horizon = psky->getHazeHorizon();
m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier(); m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier();
m_atmosphericsVars.max_y = psky->getMaxY(); m_atmosphericsVars.max_y = psky->getMaxY();
m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedLightNorm(); m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm();
m_atmosphericsVars.sunlight = psky->getSunlightColor(); m_atmosphericsVars.sunlight = psky->getSunlightColor();
m_atmosphericsVars.ambient = psky->getAmbientColor(); m_atmosphericsVars.ambient = psky->getAmbientColor();
m_atmosphericsVars.glow = psky->getGlow(); m_atmosphericsVars.glow = psky->getGlow();
...@@ -531,7 +530,7 @@ void LLVOSky::calc() ...@@ -531,7 +530,7 @@ void LLVOSky::calc()
m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier(); m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier();
m_atmosphericsVars.distance_multiplier = psky->getDistanceMultiplier(); m_atmosphericsVars.distance_multiplier = psky->getDistanceMultiplier();
m_atmosphericsVars.max_y = psky->getMaxY(); m_atmosphericsVars.max_y = psky->getMaxY();
m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedLightNorm(); m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm();
m_atmosphericsVars.sunlight = psky->getSunlightColor(); m_atmosphericsVars.sunlight = psky->getSunlightColor();
m_atmosphericsVars.ambient = psky->getAmbientColor(); m_atmosphericsVars.ambient = psky->getAmbientColor();
m_atmosphericsVars.glow = psky->getGlow(); m_atmosphericsVars.glow = psky->getGlow();
...@@ -725,8 +724,6 @@ bool LLVOSky::updateSky() ...@@ -725,8 +724,6 @@ bool LLVOSky::updateSky()
next_frame = next_frame % cycle_frame_no; next_frame = next_frame % cycle_frame_no;
mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / cycle_frame_no; mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / cycle_frame_no;
// sInterpVal = (F32)next_frame / cycle_frame_no;
LLSkyTex::setInterpVal( mInterpVal );
LLHeavenBody::setInterpVal( mInterpVal ); LLHeavenBody::setInterpVal( mInterpVal );
updateDirections(); updateDirections();
...@@ -912,6 +909,8 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur ...@@ -912,6 +909,8 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur
mSunTexturep[0] = sun_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mSunTexturep[0] = sun_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
mSunTexturep[1] = sun_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mSunTexturep[1] = sun_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
bool can_use_wl = gPipeline.canUseWindLightShaders();
if (mFace[FACE_SUN]) if (mFace[FACE_SUN])
{ {
if (mSunTexturep[0]) if (mSunTexturep[0])
...@@ -934,11 +933,14 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur ...@@ -934,11 +933,14 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur
mFace[FACE_SUN]->setTexture(LLRender::DIFFUSE_MAP, mSunTexturep[0]); mFace[FACE_SUN]->setTexture(LLRender::DIFFUSE_MAP, mSunTexturep[0]);
if (mSunTexturep[1]) if (can_use_wl)
{ {
mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP); if (mSunTexturep[1])
{
mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
}
mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]);
} }
mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]);
} }
} }
...@@ -946,6 +948,8 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex ...@@ -946,6 +948,8 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex
{ {
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
bool can_use_wl = gPipeline.canUseWindLightShaders();
mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
...@@ -957,7 +961,7 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex ...@@ -957,7 +961,7 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex
} }
mFace[FACE_MOON]->setTexture(LLRender::DIFFUSE_MAP, mMoonTexturep[0]); mFace[FACE_MOON]->setTexture(LLRender::DIFFUSE_MAP, mMoonTexturep[0]);
if (mMoonTexturep[1]) if (mMoonTexturep[1] && can_use_wl)
{ {
mMoonTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP); mMoonTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
mFace[FACE_MOON]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mMoonTexturep[1]); mFace[FACE_MOON]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mMoonTexturep[1]);
......
...@@ -57,13 +57,8 @@ class LLSkyTex ...@@ -57,13 +57,8 @@ class LLSkyTex
LLColor4 *mSkyData; LLColor4 *mSkyData;
LLVector3 *mSkyDirs; // Cache of sky direction vectors LLVector3 *mSkyDirs; // Cache of sky direction vectors
static S32 sCurrent; static S32 sCurrent;
static F32 sInterpVal;
public: public:
static F32 getInterpVal() { return sInterpVal; }
static void setInterpVal(const F32 v) { sInterpVal = v; }
static BOOL doInterpolate() { return sInterpVal > 0.001f; }
void bindTexture(BOOL curr = TRUE); void bindTexture(BOOL curr = TRUE);
protected: protected:
...@@ -299,6 +294,8 @@ class LLVOSky : public LLStaticViewerObject ...@@ -299,6 +294,8 @@ class LLVOSky : public LLStaticViewerObject
LLFace *mFace[FACE_COUNT]; LLFace *mFace[FACE_COUNT];
LLVector3 mBumpSunDir; LLVector3 mBumpSunDir;
F32 getInterpVal() const { return mInterpVal; }
protected: protected:
~LLVOSky(); ~LLVOSky();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment