diff options
author | 2020-08-17 21:53:59 +0200 | |
---|---|---|
committer | 2020-08-17 21:53:59 +0200 | |
commit | 24297b11ee13dbe705b2fafa93643261560cbc45 (patch) | |
tree | 51f0f4f0e1636d4a8a918ad0a3081dfbf3a92217 /graphics/src/transformation.rs | |
parent | 00d66da0cee1dc7faeccc5b3f0794a0393a38da7 (diff) | |
parent | 02ca90a22d5c4235de4491f840dc9f55f9967618 (diff) | |
download | iced-24297b11ee13dbe705b2fafa93643261560cbc45.tar.gz iced-24297b11ee13dbe705b2fafa93643261560cbc45.tar.bz2 iced-24297b11ee13dbe705b2fafa93643261560cbc45.zip |
Merge pull request #482 from bitshifter/glam-0.9
Upgrade glam to 0.9 & use glam's Mat4 ortho rh gl.
Diffstat (limited to 'graphics/src/transformation.rs')
-rw-r--r-- | graphics/src/transformation.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/graphics/src/transformation.rs b/graphics/src/transformation.rs index ff3b1d00..2a19caed 100644 --- a/graphics/src/transformation.rs +++ b/graphics/src/transformation.rs @@ -1,4 +1,4 @@ -use glam::{Mat4, Vec3, Vec4}; +use glam::{Mat4, Vec3}; use std::ops::Mul; /// A 2D transformation matrix. @@ -14,11 +14,10 @@ impl Transformation { /// Creates an orthographic projection. #[rustfmt::skip] pub fn orthographic(width: u32, height: u32) -> Transformation { - Transformation(Mat4::from_cols( - Vec4::new(2.0 / width as f32, 0.0, 0.0, 0.0), - Vec4::new(0.0, -2.0 / height as f32, 0.0, 0.0), - Vec4::new(0.0, 0.0, -1.0, 0.0), - Vec4::new(-1.0, 1.0, 0.0, 1.0) + Transformation(Mat4::orthographic_rh_gl( + 0.0, width as f32, + height as f32, 0.0, + -1.0, 1.0 )) } |