Workaround for hardware light brighness/atten being too intense upon fullscreen toggle.

This commit is contained in:
Shyotl
2011-06-14 01:11:47 -05:00
parent 28098c79d2
commit 101fe0ed01
2 changed files with 27 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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);