summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glow/src/lib.rs3
-rw-r--r--graphics/Cargo.toml1
-rw-r--r--graphics/src/lib.rs2
-rw-r--r--graphics/src/transformation.rs (renamed from glow/src/transformation.rs)0
-rw-r--r--wgpu/src/lib.rs3
-rw-r--r--wgpu/src/transformation.rs54
6 files changed, 5 insertions, 58 deletions
diff --git a/glow/src/lib.rs b/glow/src/lib.rs
index 27c39b99..f8032433 100644
--- a/glow/src/lib.rs
+++ b/glow/src/lib.rs
@@ -7,7 +7,6 @@
mod backend;
mod quad;
mod text;
-mod transformation;
mod triangle;
mod viewport;
@@ -19,8 +18,8 @@ pub use settings::Settings;
pub use viewport::Viewport;
pub(crate) use backend::Backend;
+pub(crate) use iced_graphics::Transformation;
pub(crate) use quad::Quad;
-pub(crate) use transformation::Transformation;
pub type Renderer = iced_graphics::Renderer<Backend>;
diff --git a/graphics/Cargo.toml b/graphics/Cargo.toml
index dcbf5ce4..a81807d6 100644
--- a/graphics/Cargo.toml
+++ b/graphics/Cargo.toml
@@ -9,6 +9,7 @@ canvas = ["lyon"]
[dependencies]
bytemuck = "1.2"
+glam = "0.8"
[dependencies.iced_native]
version = "0.2"
diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs
index 596f72a4..6e5105d2 100644
--- a/graphics/src/lib.rs
+++ b/graphics/src/lib.rs
@@ -1,6 +1,7 @@
mod defaults;
mod primitive;
mod renderer;
+mod transformation;
mod widget;
pub mod backend;
@@ -13,3 +14,4 @@ pub use backend::Backend;
pub use defaults::Defaults;
pub use primitive::Primitive;
pub use renderer::Renderer;
+pub use transformation::Transformation;
diff --git a/glow/src/transformation.rs b/graphics/src/transformation.rs
index ff3b1d00..ff3b1d00 100644
--- a/glow/src/transformation.rs
+++ b/graphics/src/transformation.rs
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index 86827502..d2905bd0 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -36,7 +36,6 @@ mod backend;
mod quad;
mod target;
mod text;
-mod transformation;
mod viewport;
pub use iced_graphics::{Defaults, Primitive};
@@ -50,8 +49,8 @@ pub use viewport::Viewport;
#[doc(no_inline)]
pub use widget::*;
+pub(crate) use iced_graphics::Transformation;
pub(crate) use quad::Quad;
-pub(crate) use transformation::Transformation;
pub type Renderer = iced_graphics::Renderer<Backend>;
diff --git a/wgpu/src/transformation.rs b/wgpu/src/transformation.rs
deleted file mode 100644
index ff3b1d00..00000000
--- a/wgpu/src/transformation.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use glam::{Mat4, Vec3, Vec4};
-use std::ops::Mul;
-
-/// A 2D transformation matrix.
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub struct Transformation(Mat4);
-
-impl Transformation {
- /// Get the identity transformation.
- pub fn identity() -> Transformation {
- Transformation(Mat4::identity())
- }
-
- /// 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)
- ))
- }
-
- /// Creates a translate transformation.
- pub fn translate(x: f32, y: f32) -> Transformation {
- Transformation(Mat4::from_translation(Vec3::new(x, y, 0.0)))
- }
-
- /// Creates a scale transformation.
- pub fn scale(x: f32, y: f32) -> Transformation {
- Transformation(Mat4::from_scale(Vec3::new(x, y, 1.0)))
- }
-}
-
-impl Mul for Transformation {
- type Output = Self;
-
- fn mul(self, rhs: Self) -> Self {
- Transformation(self.0 * rhs.0)
- }
-}
-
-impl AsRef<[f32; 16]> for Transformation {
- fn as_ref(&self) -> &[f32; 16] {
- self.0.as_ref()
- }
-}
-
-impl From<Transformation> for [f32; 16] {
- fn from(t: Transformation) -> [f32; 16] {
- *t.as_ref()
- }
-}