Skip to content

Commit 8e0d5ec

Browse files
authored
Fix deprecation warnings (#522)
1 parent 5213713 commit 8e0d5ec

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/matrix.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl<S: BaseFloat> Matrix4<S> {
387387
/// `center`, using `up` for orientation.
388388
#[deprecated = "Use Matrix4::look_at_rh"]
389389
pub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {
390-
Matrix4::look_at_dir(eye, center - eye, up)
390+
Matrix4::look_at_rh(eye, center, up)
391391
}
392392

393393
/// Create a homogeneous transformation matrix that will cause a vector to point at
@@ -1122,7 +1122,7 @@ impl<S: BaseFloat> Transform<Point2<S>> for Matrix3<S> {
11221122
impl<S: BaseFloat> Transform<Point3<S>> for Matrix3<S> {
11231123
fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S> {
11241124
let dir = center - eye;
1125-
Matrix3::look_at(dir, up)
1125+
Matrix3::look_to_lh(dir, up)
11261126
}
11271127

11281128
fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S> {
@@ -1155,7 +1155,7 @@ impl<S: BaseFloat> Transform<Point3<S>> for Matrix3<S> {
11551155
impl<S: BaseFloat> Transform<Point3<S>> for Matrix4<S> {
11561156

11571157
fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {
1158-
Matrix4::look_at(eye, center, up)
1158+
Matrix4::look_at_rh(eye, center, up)
11591159
}
11601160

11611161
fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {

src/quaternion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl<S: BaseFloat> Rotation for Quaternion<S> {
485485

486486
#[inline]
487487
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S> {
488-
Matrix3::look_at(dir, up).into()
488+
Matrix3::look_to_lh(dir, up).into()
489489
}
490490

491491
#[inline]

src/rotation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl<S: BaseFloat> Rotation for Basis3<S> {
365365
#[inline]
366366
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> {
367367
Basis3 {
368-
mat: Matrix3::look_at(dir, up),
368+
mat: Matrix3::look_to_lh(dir, up),
369369
}
370370
}
371371

tests/matrix.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,9 @@ pub mod matrix3 {
740740
]));
741741

742742
#[allow(deprecated)]
743-
assert_ulps_eq!(m, Matrix3::look_at(dir, up));
743+
{
744+
assert_ulps_eq!(m, Matrix3::look_at(dir, up));
745+
}
744746
}
745747

746748
#[test]
@@ -1164,7 +1166,9 @@ pub mod matrix4 {
11641166

11651167
let m = Matrix4::look_to_rh(eye, dir, up);
11661168
#[allow(deprecated)]
1167-
assert_ulps_eq!(m, Matrix4::look_at_dir(eye, dir, up));
1169+
{
1170+
assert_ulps_eq!(m, Matrix4::look_at_dir(eye, dir, up));
1171+
}
11681172

11691173
let expected = Matrix4::from([
11701174
[-0.9486833, -0.16903086, -0.26726127, 0.0],

0 commit comments

Comments
 (0)