From 101fe0ed01296cbc5df48224529be01198e2bfa7 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Tue, 14 Jun 2011 01:11:47 -0500 Subject: [PATCH] Workaround for hardware light brighness/atten being too intense upon fullscreen toggle. --- indra/newview/pipeline.cpp | 26 ++++++++++++++++++++++++++ indra/newview/pipeline.h | 1 + 2 files changed, 27 insertions(+) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3b5a8b2ef..9ece8613b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -929,6 +929,8 @@ void LLPipeline::restoreGL() } } } + + resetLocalLights(); //Default all gl light parameters. Fixes light brightness problems on fullscren toggle } @@ -4679,6 +4681,29 @@ static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_ return dist; } +//Default all gl light parameters. Used upon restoreGL. Fixes brightness problems on fullscren toggle +void LLPipeline::resetLocalLights() +{ + glEnable(GL_LIGHTING); + for (S32 i = 0; i < 8; ++i) + { + LLLightState *pLight = gGL.getLight(i); + pLight->enable(); + pLight->setAmbient(LLColor4::black); + pLight->setConstantAttenuation(0.f); + pLight->setDiffuse(LLColor4::black); + pLight->setLinearAttenuation(0.f); + pLight->setPosition(LLVector4(0.f,0.f,0.f,0.f)); + pLight->setQuadraticAttenuation(0.f); + pLight->setSpecular(LLColor4::black); + pLight->setSpotCutoff(0.f); + pLight->setSpotDirection(LLVector3(0.f,0.f,0.f)); + pLight->setSpotExponent(0.f); + pLight->disable(); + } + glDisable(GL_LIGHTING); +} + void LLPipeline::calcNearbyLights(LLCamera& camera) { assertInitialized(); @@ -4712,6 +4737,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) LLVOVolume* volight = drawable->getVOVolume(); if (!volight || !drawable->isState(LLDrawable::LIGHT)) { + setLight(drawable,false); //remove from mLight list drawable->clearState(LLDrawable::NEARBY_LIGHT); continue; } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 56720d027..4145a9476 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -242,6 +242,7 @@ public: S32 getLightCount() const { return mLights.size(); } + void resetLocalLights(); //Default all gl light parameters. Used upon restoreGL. Fixes light brightness problems on fullscren toggle void calcNearbyLights(LLCamera& camera); void setupHWLights(LLDrawPool* pool); void setupAvatarLights(BOOL for_edit = FALSE);