Fixed hiding rotated sprites
parent
54a1a26a2c
commit
bffc7b9f23
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue