Skip to content

Commit 51312d1

Browse files
authored
Merge pull request #903 from dimforge/glam-conversion-bug
Fix bug in the glam conversion Vec2 -> Isometry2
2 parents dfc8ad3 + 7acd4ec commit 51312d1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/third_party/glam/common/glam_isometry.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::glam::{DMat3, DMat4, DQuat, DVec2, DVec3, Mat3, Mat4, Quat, Vec2, Vec3};
2-
use crate::{Isometry2, Isometry3, Matrix3, Matrix4};
2+
use crate::{Isometry2, Isometry3, Matrix3, Matrix4, Translation3, UnitQuaternion, Vector2};
33
use std::convert::TryFrom;
44

55
impl From<Isometry2<f32>> for Mat3 {
@@ -102,61 +102,61 @@ impl From<(DVec2, f64)> for Isometry2<f64> {
102102

103103
impl From<Quat> for Isometry3<f32> {
104104
fn from(rot: Quat) -> Self {
105-
Isometry3::from_parts(crate::one(), rot.into())
105+
Isometry3::from_parts(Translation3::identity(), rot.into())
106106
}
107107
}
108108

109109
impl From<DQuat> for Isometry3<f64> {
110110
fn from(rot: DQuat) -> Self {
111-
Isometry3::from_parts(crate::one(), rot.into())
111+
Isometry3::from_parts(Translation3::identity(), rot.into())
112112
}
113113
}
114114

115115
impl From<Quat> for Isometry2<f32> {
116116
fn from(rot: Quat) -> Self {
117-
Isometry2::new(crate::zero(), rot.to_axis_angle().1)
117+
Isometry2::new(Vector2::zeros(), rot.to_axis_angle().1)
118118
}
119119
}
120120

121121
impl From<DQuat> for Isometry2<f64> {
122122
fn from(rot: DQuat) -> Self {
123-
Isometry2::new(crate::zero(), rot.to_axis_angle().1)
123+
Isometry2::new(Vector2::zeros(), rot.to_axis_angle().1)
124124
}
125125
}
126126

127127
impl From<Vec3> for Isometry3<f32> {
128128
fn from(tra: Vec3) -> Self {
129-
Isometry3::from_parts(tra.into(), crate::one())
129+
Isometry3::from_parts(tra.into(), UnitQuaternion::identity())
130130
}
131131
}
132132

133133
impl From<DVec3> for Isometry3<f64> {
134134
fn from(tra: DVec3) -> Self {
135-
Isometry3::from_parts(tra.into(), crate::one())
135+
Isometry3::from_parts(tra.into(), UnitQuaternion::identity())
136136
}
137137
}
138138

139139
impl From<Vec2> for Isometry2<f32> {
140140
fn from(tra: Vec2) -> Self {
141-
Isometry2::new(tra.into(), crate::one())
141+
Isometry2::new(tra.into(), 0.0)
142142
}
143143
}
144144

145145
impl From<DVec2> for Isometry2<f64> {
146146
fn from(tra: DVec2) -> Self {
147-
Isometry2::new(tra.into(), crate::one())
147+
Isometry2::new(tra.into(), 0.0)
148148
}
149149
}
150150

151151
impl From<Vec3> for Isometry2<f32> {
152152
fn from(tra: Vec3) -> Self {
153-
Isometry2::new([tra.x, tra.y].into(), crate::one())
153+
Isometry2::new([tra.x, tra.y].into(), 0.0)
154154
}
155155
}
156156

157157
impl From<DVec3> for Isometry2<f64> {
158158
fn from(tra: DVec3) -> Self {
159-
Isometry2::new([tra.x, tra.y].into(), crate::one())
159+
Isometry2::new([tra.x, tra.y].into(), 0.0)
160160
}
161161
}
162162

0 commit comments

Comments
 (0)