Fixed hiding rotated sprites

master
Mark 2023-12-29 17:54:51 -08:00
parent 54a1a26a2c
commit bffc7b9f23
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
1 changed files with 8 additions and 5 deletions

View File

@ -220,14 +220,17 @@ impl GPUState {
// Game dimensions of this sprite post-scale.
// Don't divide by 2, we use this later.
let height = s.size / s.pos.z;
let width = height * texture.aspect;
// Width or height, whichever is larger
// Accounts for sprite rotation.
let m = height * texture.aspect.max(1.0);
// Don't draw (or compute matrices for)
// sprites that are off the screen
if pos.x < clip_ne.x - width
|| pos.y > clip_ne.y + height
|| pos.x > clip_sw.x + width
|| pos.y < clip_sw.y - height
if pos.x < clip_ne.x - m
|| pos.y > clip_ne.y + m
|| pos.x > clip_sw.x + m
|| pos.y < clip_sw.y - m
{
return;
}