forked from M-Labs/nalgebra
Rename Perspective3::unwrap
to Perspective3::into_inner
and deprecate Perspective3::unwrap
See #460
This commit is contained in:
parent
9600c45dd4
commit
0d47a8e16b
@ -121,7 +121,7 @@ impl<N: Real> Matrix4<N> {
|
|||||||
/// Creates a new homogeneous matrix for a perspective projection.
|
/// Creates a new homogeneous matrix for a perspective projection.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_perspective(aspect: N, fovy: N, znear: N, zfar: N) -> Self {
|
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
|
/// Creates an isometry that corresponds to the local frame of an observer standing at the
|
||||||
|
@ -141,6 +141,14 @@ impl<N: Real> Perspective3<N> {
|
|||||||
|
|
||||||
/// Retrieves the underlying homogeneous matrix.
|
/// Retrieves the underlying homogeneous matrix.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
pub fn into_inner(self) -> Matrix4<N> {
|
||||||
|
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<N> {
|
pub fn unwrap(self) -> Matrix4<N> {
|
||||||
self.matrix
|
self.matrix
|
||||||
}
|
}
|
||||||
@ -279,6 +287,6 @@ impl<N: Real + Arbitrary> Arbitrary for Perspective3<N> {
|
|||||||
impl<N: Real> From<Perspective3<N>> for Matrix4<N> {
|
impl<N: Real> From<Perspective3<N>> for Matrix4<N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(orth: Perspective3<N>) -> Self {
|
fn from(orth: Perspective3<N>) -> Self {
|
||||||
orth.unwrap()
|
orth.into_inner()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ fn perspective_inverse() {
|
|||||||
let proj = Perspective3::new(800.0 / 600.0, 3.14 / 2.0, 1.0, 1000.0);
|
let proj = Perspective3::new(800.0 / 600.0, 3.14 / 2.0, 1.0, 1000.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
Block a user