Comments
parent
02b58d6b55
commit
6ad23b4410
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue