master
Mark 2023-12-22 21:44:03 -08:00
parent 02b58d6b55
commit 6ad23b4410
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
1 changed files with 8 additions and 4 deletions

View File

@ -270,10 +270,8 @@ impl GPUState {
let height = texture.height * s.scale;
let width = height * texture.aspect;
// Sprite scale is relative to the sprite's defined height,
// so we apply both factors here
// Don't compute matrices for sprites that are off the screen
// 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
@ -283,6 +281,12 @@ impl GPUState {
continue;
}
// Compute the values we need to draw
// scale: combines texture scale and zoom scale.
// screen_pos: position of this sprite in screen coordinates
//
// We can't use screen_pos to exclude off-screen sprites because
// it can't account for height and width.
let scale = height / camera.zoom;
let screen_pos: Point2<f32> = pos / camera.zoom;