Use interp position in GL billboarding

This commit is contained in:
Eidolon 2022-10-30 23:03:47 -05:00 committed by toaster
parent 8ae551e6bc
commit d814674d81

View file

@ -3019,11 +3019,24 @@ static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts
{ {
if (cv_grspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts) if (cv_grspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
{ {
float basey = FIXED_TO_FLOAT(spr->mobj->z); // uncapped/interpolation
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused)
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
}
float basey = FIXED_TO_FLOAT(interp.z);
float lowy = wallVerts[0].y; float lowy = wallVerts[0].y;
if (P_MobjFlip(spr->mobj) == -1) if (P_MobjFlip(spr->mobj) == -1)
{ {
basey = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height); basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
} }
// Rotate sprites to fully billboard with the camera // Rotate sprites to fully billboard with the camera
// X, Y, AND Z need to be manipulated for the polys to rotate around the // X, Y, AND Z need to be manipulated for the polys to rotate around the