mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
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:
parent
3818282811
commit
90e410cf47
1 changed files with 30 additions and 26 deletions
|
@ -3498,35 +3498,9 @@ void polymer_updatesprite(int32_t snum)
|
||||||
if (tspr->cstat & 48 && searchit != 2)
|
if (tspr->cstat & 48 && searchit != 2)
|
||||||
{
|
{
|
||||||
uint32_t crc = crc32once((uint8_t *)tspr, offsetof(spritetype, owner));
|
uint32_t crc = crc32once((uint8_t *)tspr, offsetof(spritetype, owner));
|
||||||
int32_t curpriority = 0;
|
|
||||||
|
|
||||||
if (crc == s->crc && tspr->picnum == curpicnum) return;
|
if (crc == s->crc && tspr->picnum == curpicnum) return;
|
||||||
s->crc = crc;
|
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);
|
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);
|
bglDeleteBuffersARB(1, &s->plane.vbo);
|
||||||
s->plane.vbo = 0;
|
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
|
// SKIES
|
||||||
|
|
Loading…
Reference in a new issue