polymer: cull sprite lights after computing sprite geometry

This was broken ever since updatesprite() had been forked off drawsprite() and
would cause static lights to never hit static sprites until one or the other
changed, after which the light would always get culled against outdated sprite
geometry.

git-svn-id: https://svn.eduke32.com/eduke32@2536 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2012-03-26 00:55:53 +00:00
parent 3818282811
commit 90e410cf47

View file

@ -3498,35 +3498,9 @@ void polymer_updatesprite(int32_t snum)
if (tspr->cstat & 48 && searchit != 2)
{
uint32_t crc = crc32once((uint8_t *)tspr, offsetof(spritetype, owner));
int32_t curpriority = 0;
if (crc == s->crc && tspr->picnum == curpicnum) return;
s->crc = crc;
polymer_resetplanelights(&s->plane);
while (curpriority < pr_maxlightpriority)
{
i = j = 0;
while (j < lightcount)
{
while (!prlights[i].flags.active)
i++;
if (prlights[i].priority != curpriority)
{
i++;
j++;
continue;
}
if (polymer_planeinlight(&s->plane, &prlights[i]))
polymer_addplanelight(&s->plane, i);
i++;
j++;
}
curpriority++;
}
}
polymer_getbuildmaterial(&s->plane.material, curpicnum, tspr->pal, tspr->shade, 4);
@ -3684,6 +3658,36 @@ void polymer_updatesprite(int32_t snum)
bglDeleteBuffersARB(1, &s->plane.vbo);
s->plane.vbo = 0;
}
if (tspr->cstat & 48)
{
int32_t curpriority = 0;
polymer_resetplanelights(&s->plane);
while (curpriority < pr_maxlightpriority)
{
i = j = 0;
while (j < lightcount)
{
while (!prlights[i].flags.active)
i++;
if (prlights[i].priority != curpriority)
{
i++;
j++;
continue;
}
if (polymer_planeinlight(&s->plane, &prlights[i]))
polymer_addplanelight(&s->plane, i);
i++;
j++;
}
curpriority++;
}
}
}
// SKIES