Comments
parent
02b58d6b55
commit
6ad23b4410
|
@ -270,10 +270,8 @@ impl GPUState {
|
||||||
let height = texture.height * s.scale;
|
let height = texture.height * s.scale;
|
||||||
let width = height * texture.aspect;
|
let width = height * texture.aspect;
|
||||||
|
|
||||||
// Sprite scale is relative to the sprite's defined height,
|
// Don't draw (or compute matrices for)
|
||||||
// so we apply both factors here
|
// sprites that are off the screen
|
||||||
|
|
||||||
// Don't compute matrices for sprites that are off the screen
|
|
||||||
if pos.x < clip_ne.x - width
|
if pos.x < clip_ne.x - width
|
||||||
|| pos.y > clip_ne.y + height
|
|| pos.y > clip_ne.y + height
|
||||||
|| pos.x > clip_sw.x + width
|
|| pos.x > clip_sw.x + width
|
||||||
|
@ -283,6 +281,12 @@ impl GPUState {
|
||||||
continue;
|
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 scale = height / camera.zoom;
|
||||||
let screen_pos: Point2<f32> = pos / camera.zoom;
|
let screen_pos: Point2<f32> = pos / camera.zoom;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue