Rename `Orthographic3::unwrap` to `Orthographic3::into_inner` and deprecate `Orthographic3::unwrap`
See #460
This commit is contained in:
parent
43c5f4cb73
commit
9600c45dd4
|
@ -115,7 +115,7 @@ impl<N: Real> Matrix4<N> {
|
||||||
/// Creates a new homogeneous matrix for an orthographic projection.
|
/// Creates a new homogeneous matrix for an orthographic projection.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_orthographic(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> Self {
|
pub fn new_orthographic(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> Self {
|
||||||
Orthographic3::new(left, right, bottom, top, znear, zfar).unwrap()
|
Orthographic3::new(left, right, bottom, top, znear, zfar).into_inner()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new homogeneous matrix for a perspective projection.
|
/// Creates a new homogeneous matrix for a perspective projection.
|
||||||
|
|
|
@ -280,9 +280,17 @@ impl<N: Real> Orthographic3<N> {
|
||||||
/// 0.0, 0.0, -2.0 / 999.9, -1000.1 / 999.9,
|
/// 0.0, 0.0, -2.0 / 999.9, -1000.1 / 999.9,
|
||||||
/// 0.0, 0.0, 0.0, 1.0
|
/// 0.0, 0.0, 0.0, 1.0
|
||||||
/// );
|
/// );
|
||||||
/// assert_eq!(proj.unwrap(), expected);
|
/// assert_eq!(proj.into_inner(), expected);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
pub fn into_inner(self) -> Matrix4<N> {
|
||||||
|
self.matrix
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the underlying homogeneous matrix.
|
||||||
|
/// Deprecated: Use [Orthographic3::into_inner] instead.
|
||||||
|
#[deprecated(note="use `.into_inner()` instead")]
|
||||||
|
#[inline]
|
||||||
pub fn unwrap(self) -> Matrix4<N> {
|
pub fn unwrap(self) -> Matrix4<N> {
|
||||||
self.matrix
|
self.matrix
|
||||||
}
|
}
|
||||||
|
@ -725,6 +733,6 @@ where Matrix4<N>: Send
|
||||||
impl<N: Real> From<Orthographic3<N>> for Matrix4<N> {
|
impl<N: Real> From<Orthographic3<N>> for Matrix4<N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(orth: Orthographic3<N>) -> Self {
|
fn from(orth: Orthographic3<N>) -> Self {
|
||||||
orth.unwrap()
|
orth.into_inner()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ fn orthographic_inverse() {
|
||||||
let proj = Orthographic3::new(1.0, 2.0, -3.0, -2.5, 10.0, 900.0);
|
let proj = Orthographic3::new(1.0, 2.0, -3.0, -2.5, 10.0, 900.0);
|
||||||
let inv = proj.inverse();
|
let inv = proj.inverse();
|
||||||
|
|
||||||
let id = inv * proj.unwrap();
|
let id = inv * proj.into_inner();
|
||||||
|
|
||||||
assert!(id.is_identity(1.0e-7));
|
assert!(id.is_identity(1.0e-7));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue