software: clip sprites that are out of view

similar to what the frustum cull does in opengl, clips sprites that are out of view in vertical direction
This commit is contained in:
Alug committed 2025-11-27 22:07:55 +01:00
1 parent 77af507b7a
commit cfa853d022
1 file changed
+25
+25
View File
@@ -1620,6 +1620,20 @@ static void R_ProjectSprite(mobj_t *thing)
return;
}
if (!papersprite)
{
// killough 4/9/98: clip things which are out of view due to height
// e6y: fix of hanging decoration disappearing in Batman Doom MAP02
// centeryfrac -> viewheightfrac
// [kb] add +1 so sprites are shown even with the extended freelook
// lug: attempt to account for freelook properly
if (interp.z > viewz + FixedMul(FixedDiv(centeryfrac, projectiony), tz) ||
gzt < viewz + FixedMul(FixedDiv(centeryfrac - (viewheight << FRACBITS), projectiony), tz))
{
return;
}
}
// killough 3/27/98: exclude things totally separated
// from the viewer, by either water or fake ceilings
// killough 4/11/98: improve sprite clipping for underwater/fake ceilings
@@ -1969,6 +1983,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
return;
}
// killough 4/9/98: clip things which are out of view due to height
// e6y: fix of hanging decoration disappearing in Batman Doom MAP02
// centeryfrac -> viewheightfrac
// [kb] add +1 so sprites are shown even with the extended freelook
// lug: attempt to account for freelook properly
if (interp.z > viewz + FixedMul(FixedDiv(centeryfrac, projectiony), tz) ||
gzt < viewz + FixedMul(FixedDiv(centeryfrac - (viewheight << FRACBITS), projectiony), tz))
{
return;
}
// aspect ratio stuff :
yscale = FixedDiv(projectiony, tz);