fix normals for sprite lighting

This commit is contained in:
Ricardo Luís Vaz Silva 2025-01-18 14:28:59 -03:00 committed by Magnus Norddahl
commit b862adb747
9 changed files with 48 additions and 25 deletions

View file

@ -280,7 +280,7 @@ void HWDrawInfo::GetDynSpriteLightList(AActor *self, FDynLightData &modellightda
ActorTraceStaticLight staticLight(self);
if (gl_spritelight > 0 || ActorTraceStaticLight::TraceSunVisibility(x, y, z, (self ? &self->StaticLightsTraceCache : nullptr), (self ? staticLight.ActorMoved : false)))
if ((level.lightmaps && gl_spritelight > 0) || ActorTraceStaticLight::TraceSunVisibility(x, y, z, (self ? &self->StaticLightsTraceCache : nullptr), (self ? staticLight.ActorMoved : false)))
{
AddSunLightToList(modellightdata, x, y, z, self->Level->SunDirection, self->Level->SunColor * self->Level->SunIntensity, gl_spritelight > 0);
}

View file

@ -305,6 +305,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.SetDepthBias(-1, -128);
}
state.SetLightNoNormals(true);
state.SetLightIndex(dynlightindex);
state.Draw(DT_TriangleStrip, vertexindex, 4);
state.SetLightIndex(-1);
@ -318,6 +319,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.Draw(DT_TriangleStrip, vertexindex, 4);
state.SetTextureMode(TM_NORMAL);
}
state.SetLightNoNormals(false);
}
else
{