Fix deprecation warnings (#522)

This commit is contained in:
aloucks 2020-12-05 18:41:30 -05:00 committed by GitHub
parent 521371365c
commit 8e0d5ece92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View file

@ -387,7 +387,7 @@ impl<S: BaseFloat> Matrix4<S> {
/// `center`, using `up` for orientation. /// `center`, using `up` for orientation.
#[deprecated = "Use Matrix4::look_at_rh"] #[deprecated = "Use Matrix4::look_at_rh"]
pub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> { pub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {
Matrix4::look_at_dir(eye, center - eye, up) Matrix4::look_at_rh(eye, center, up)
} }
/// Create a homogeneous transformation matrix that will cause a vector to point at /// 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> {
impl<S: BaseFloat> Transform<Point3<S>> for Matrix3<S> { impl<S: BaseFloat> Transform<Point3<S>> for Matrix3<S> {
fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S> { fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S> {
let dir = center - eye; let dir = center - eye;
Matrix3::look_at(dir, up) Matrix3::look_to_lh(dir, up)
} }
fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S> { 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> {
impl<S: BaseFloat> Transform<Point3<S>> for Matrix4<S> { impl<S: BaseFloat> Transform<Point3<S>> for Matrix4<S> {
fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> { fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {
Matrix4::look_at(eye, center, up) Matrix4::look_at_rh(eye, center, up)
} }
fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> { fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {

View file

@ -485,7 +485,7 @@ impl<S: BaseFloat> Rotation for Quaternion<S> {
#[inline] #[inline]
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S> { fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S> {
Matrix3::look_at(dir, up).into() Matrix3::look_to_lh(dir, up).into()
} }
#[inline] #[inline]

View file

@ -365,7 +365,7 @@ impl<S: BaseFloat> Rotation for Basis3<S> {
#[inline] #[inline]
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> { fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> {
Basis3 { Basis3 {
mat: Matrix3::look_at(dir, up), mat: Matrix3::look_to_lh(dir, up),
} }
} }

View file

@ -740,7 +740,9 @@ pub mod matrix3 {
])); ]));
#[allow(deprecated)] #[allow(deprecated)]
assert_ulps_eq!(m, Matrix3::look_at(dir, up)); {
assert_ulps_eq!(m, Matrix3::look_at(dir, up));
}
} }
#[test] #[test]
@ -1164,7 +1166,9 @@ pub mod matrix4 {
let m = Matrix4::look_to_rh(eye, dir, up); let m = Matrix4::look_to_rh(eye, dir, up);
#[allow(deprecated)] #[allow(deprecated)]
assert_ulps_eq!(m, Matrix4::look_at_dir(eye, dir, up)); {
assert_ulps_eq!(m, Matrix4::look_at_dir(eye, dir, up));
}
let expected = Matrix4::from([ let expected = Matrix4::from([
[-0.9486833, -0.16903086, -0.26726127, 0.0], [-0.9486833, -0.16903086, -0.26726127, 0.0],