Fixed hiding rotated sprites
parent
54a1a26a2c
commit
bffc7b9f23
|
@ -220,14 +220,17 @@ impl GPUState {
|
||||||
// Game dimensions of this sprite post-scale.
|
// Game dimensions of this sprite post-scale.
|
||||||
// Don't divide by 2, we use this later.
|
// Don't divide by 2, we use this later.
|
||||||
let height = s.size / s.pos.z;
|
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)
|
// Don't draw (or compute matrices for)
|
||||||
// sprites that are off the screen
|
// sprites that are off the screen
|
||||||
if pos.x < clip_ne.x - width
|
if pos.x < clip_ne.x - m
|
||||||
|| pos.y > clip_ne.y + height
|
|| pos.y > clip_ne.y + m
|
||||||
|| pos.x > clip_sw.x + width
|
|| pos.x > clip_sw.x + m
|
||||||
|| pos.y < clip_sw.y - height
|
|| pos.y < clip_sw.y - m
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue