diff --git a/src/base/cg.rs b/src/base/cg.rs index 212cdc03..ba5dffa3 100644 --- a/src/base/cg.rs +++ b/src/base/cg.rs @@ -121,7 +121,7 @@ impl Matrix4 { /// Creates a new homogeneous matrix for a perspective projection. #[inline] pub fn new_perspective(aspect: N, fovy: N, znear: N, zfar: N) -> Self { - Perspective3::new(aspect, fovy, znear, zfar).unwrap() + Perspective3::new(aspect, fovy, znear, zfar).into_inner() } /// Creates an isometry that corresponds to the local frame of an observer standing at the diff --git a/src/geometry/perspective.rs b/src/geometry/perspective.rs index 77642554..b7e0d8ea 100644 --- a/src/geometry/perspective.rs +++ b/src/geometry/perspective.rs @@ -141,6 +141,14 @@ impl Perspective3 { /// Retrieves the underlying homogeneous matrix. #[inline] + pub fn into_inner(self) -> Matrix4 { + self.matrix + } + + /// Retrieves the underlying homogeneous matrix. + /// Deprecated: Use [Perspective3::into_inner] instead. + #[deprecated(note="use `.into_inner()` instead")] + #[inline] pub fn unwrap(self) -> Matrix4 { self.matrix } @@ -279,6 +287,6 @@ impl Arbitrary for Perspective3 { impl From> for Matrix4 { #[inline] fn from(orth: Perspective3) -> Self { - orth.unwrap() + orth.into_inner() } } diff --git a/tests/geometry/projection.rs b/tests/geometry/projection.rs index 866d5795..0f38bc37 100644 --- a/tests/geometry/projection.rs +++ b/tests/geometry/projection.rs @@ -5,7 +5,7 @@ fn perspective_inverse() { let proj = Perspective3::new(800.0 / 600.0, 3.14 / 2.0, 1.0, 1000.0); let inv = proj.inverse(); - let id = inv * proj.unwrap(); + let id = inv * proj.into_inner(); assert!(id.is_identity(1.0e-7)); }