From 7acd4ecdccc9cbb4a8c412970755055c226a37f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Fri, 4 Jun 2021 10:52:28 +0200 Subject: [PATCH] Fix bug in the glam conversion Vec2 -> Isometry2 --- src/third_party/glam/common/glam_isometry.rs | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/third_party/glam/common/glam_isometry.rs b/src/third_party/glam/common/glam_isometry.rs index 6bd970d2..3a8d4961 100644 --- a/src/third_party/glam/common/glam_isometry.rs +++ b/src/third_party/glam/common/glam_isometry.rs @@ -1,5 +1,5 @@ use super::glam::{DMat3, DMat4, DQuat, DVec2, DVec3, Mat3, Mat4, Quat, Vec2, Vec3}; -use crate::{Isometry2, Isometry3, Matrix3, Matrix4}; +use crate::{Isometry2, Isometry3, Matrix3, Matrix4, Translation3, UnitQuaternion, Vector2}; use std::convert::TryFrom; impl From> for Mat3 { @@ -102,61 +102,61 @@ impl From<(DVec2, f64)> for Isometry2 { impl From for Isometry3 { fn from(rot: Quat) -> Self { - Isometry3::from_parts(crate::one(), rot.into()) + Isometry3::from_parts(Translation3::identity(), rot.into()) } } impl From for Isometry3 { fn from(rot: DQuat) -> Self { - Isometry3::from_parts(crate::one(), rot.into()) + Isometry3::from_parts(Translation3::identity(), rot.into()) } } impl From for Isometry2 { fn from(rot: Quat) -> Self { - Isometry2::new(crate::zero(), rot.to_axis_angle().1) + Isometry2::new(Vector2::zeros(), rot.to_axis_angle().1) } } impl From for Isometry2 { fn from(rot: DQuat) -> Self { - Isometry2::new(crate::zero(), rot.to_axis_angle().1) + Isometry2::new(Vector2::zeros(), rot.to_axis_angle().1) } } impl From for Isometry3 { fn from(tra: Vec3) -> Self { - Isometry3::from_parts(tra.into(), crate::one()) + Isometry3::from_parts(tra.into(), UnitQuaternion::identity()) } } impl From for Isometry3 { fn from(tra: DVec3) -> Self { - Isometry3::from_parts(tra.into(), crate::one()) + Isometry3::from_parts(tra.into(), UnitQuaternion::identity()) } } impl From for Isometry2 { fn from(tra: Vec2) -> Self { - Isometry2::new(tra.into(), crate::one()) + Isometry2::new(tra.into(), 0.0) } } impl From for Isometry2 { fn from(tra: DVec2) -> Self { - Isometry2::new(tra.into(), crate::one()) + Isometry2::new(tra.into(), 0.0) } } impl From for Isometry2 { fn from(tra: Vec3) -> Self { - Isometry2::new([tra.x, tra.y].into(), crate::one()) + Isometry2::new([tra.x, tra.y].into(), 0.0) } } impl From for Isometry2 { fn from(tra: DVec3) -> Self { - Isometry2::new([tra.x, tra.y].into(), crate::one()) + Isometry2::new([tra.x, tra.y].into(), 0.0) } }