(width: u32, height: u32)
| 59 | |
| 60 | impl Camera { |
| 61 | pub(crate) fn new(width: u32, height: u32) -> Self { |
| 62 | const INITIAL_ZOOM: f64 = 1.0; |
| 63 | let aspect = width as f64 / height as f64; |
| 64 | let half_height = INITIAL_ZOOM; |
| 65 | let half_width = aspect * half_height; |
| 66 | Self { |
| 67 | position: DVec2::ZERO, |
| 68 | half_extents: DVec2::new(half_width, half_height), |
| 69 | render_offset: DVec2::ZERO, |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | pub(crate) fn build_view_projection_matrix(&self) -> Mat4 { |
| 74 | let proj = Mat4::orthographic_rh( |