Upgrade glam to 0.9 & use glam's Mat4 ortho rh gl.

This commit is contained in:
Cameron Hart 2020-08-17 12:01:58 +12:00
parent 00d66da0ce
commit b90e5c4e05
4 changed files with 3 additions and 10 deletions

View File

@ -20,7 +20,6 @@ glow_glyph = "0.3"
glyph_brush = "0.7" glyph_brush = "0.7"
euclid = "0.20" euclid = "0.20"
bytemuck = "1.2" bytemuck = "1.2"
glam = "0.8"
log = "0.4" log = "0.4"
[dependencies.iced_native] [dependencies.iced_native]

View File

@ -13,7 +13,7 @@ opengl = []
[dependencies] [dependencies]
bytemuck = "1.2" bytemuck = "1.2"
glam = "0.8" glam = "0.9"
raw-window-handle = "0.3" raw-window-handle = "0.3"
[dependencies.iced_native] [dependencies.iced_native]

View File

@ -1,4 +1,4 @@
use glam::{Mat4, Vec3, Vec4}; use glam::{Mat4, Vec3};
use std::ops::Mul; use std::ops::Mul;
/// A 2D transformation matrix. /// A 2D transformation matrix.
@ -14,12 +14,7 @@ impl Transformation {
/// Creates an orthographic projection. /// Creates an orthographic projection.
#[rustfmt::skip] #[rustfmt::skip]
pub fn orthographic(width: u32, height: u32) -> Transformation { pub fn orthographic(width: u32, height: u32) -> Transformation {
Transformation(Mat4::from_cols( Transformation(Mat4::orthographic_rh_gl(0.0, width as f32, 0.0, height as f32, -1.0, 1.0))
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)
))
} }
/// Creates a translate transformation. /// Creates a translate transformation.

View File

@ -19,7 +19,6 @@ glyph_brush = "0.7"
zerocopy = "0.3" zerocopy = "0.3"
bytemuck = "1.2" bytemuck = "1.2"
raw-window-handle = "0.3" raw-window-handle = "0.3"
glam = "0.8"
log = "0.4" log = "0.4"
guillotiere = "0.5" guillotiere = "0.5"
# Pin `gfx-memory` until https://github.com/gfx-rs/wgpu-rs/issues/261 is # Pin `gfx-memory` until https://github.com/gfx-rs/wgpu-rs/issues/261 is