Update for rustc 0e784e168 2014-09-16 23:26:11 +0000

This commit is contained in:
Tomaka17 2014-09-18 16:19:26 +02:00
parent 9ade4ce92d
commit 1b5da61ccb
6 changed files with 33 additions and 33 deletions

View file

@ -32,7 +32,7 @@ pub struct Frustum<S> {
pub far: Plane<S>,
}
impl<S: BaseFloat>
impl<S: BaseFloat + 'static>
Frustum<S> {
/// Constructs a frustum
pub fn new(left: Plane<S>, right: Plane<S>,

View file

@ -77,7 +77,7 @@ impl<S: BaseNum> Matrix2<S> {
}
}
impl<S: BaseFloat> Matrix2<S> {
impl<S: BaseFloat + 'static> Matrix2<S> {
/// Create a transformation matrix that will cause a vector to point at
/// `dir`, using `up` for orientation.
pub fn look_at(dir: &Vector2<S>, up: &Vector2<S>) -> Matrix2<S> {
@ -134,7 +134,7 @@ impl<S: BaseNum> Matrix3<S> {
}
}
impl<S: BaseFloat>
impl<S: BaseFloat + 'static>
Matrix3<S> {
/// Create a transformation matrix that will cause a vector to point at
/// `dir`, using `up` for orientation.
@ -369,13 +369,13 @@ pub trait Matrix<S: BaseFloat, V: Clone + Vector<S>>: Array2<V, V, S>
fn is_symmetric(&self) -> bool;
}
impl<S: BaseFloat> Add<Matrix2<S>, Matrix2<S>> for Matrix2<S> { #[inline] fn add(&self, other: &Matrix2<S>) -> Matrix2<S> { self.add_m(other) } }
impl<S: BaseFloat> Add<Matrix3<S>, Matrix3<S>> for Matrix3<S> { #[inline] fn add(&self, other: &Matrix3<S>) -> Matrix3<S> { self.add_m(other) } }
impl<S: BaseFloat> Add<Matrix4<S>, Matrix4<S>> for Matrix4<S> { #[inline] fn add(&self, other: &Matrix4<S>) -> Matrix4<S> { self.add_m(other) } }
impl<S: BaseFloat + 'static> Add<Matrix2<S>, Matrix2<S>> for Matrix2<S> { #[inline] fn add(&self, other: &Matrix2<S>) -> Matrix2<S> { self.add_m(other) } }
impl<S: BaseFloat + 'static> Add<Matrix3<S>, Matrix3<S>> for Matrix3<S> { #[inline] fn add(&self, other: &Matrix3<S>) -> Matrix3<S> { self.add_m(other) } }
impl<S: BaseFloat + 'static> Add<Matrix4<S>, Matrix4<S>> for Matrix4<S> { #[inline] fn add(&self, other: &Matrix4<S>) -> Matrix4<S> { self.add_m(other) } }
impl<S: BaseFloat> Sub<Matrix2<S>, Matrix2<S>> for Matrix2<S> { #[inline] fn sub(&self, other: &Matrix2<S>) -> Matrix2<S> { self.sub_m(other) } }
impl<S: BaseFloat> Sub<Matrix3<S>, Matrix3<S>> for Matrix3<S> { #[inline] fn sub(&self, other: &Matrix3<S>) -> Matrix3<S> { self.sub_m(other) } }
impl<S: BaseFloat> Sub<Matrix4<S>, Matrix4<S>> for Matrix4<S> { #[inline] fn sub(&self, other: &Matrix4<S>) -> Matrix4<S> { self.sub_m(other) } }
impl<S: BaseFloat + 'static> Sub<Matrix2<S>, Matrix2<S>> for Matrix2<S> { #[inline] fn sub(&self, other: &Matrix2<S>) -> Matrix2<S> { self.sub_m(other) } }
impl<S: BaseFloat + 'static> Sub<Matrix3<S>, Matrix3<S>> for Matrix3<S> { #[inline] fn sub(&self, other: &Matrix3<S>) -> Matrix3<S> { self.sub_m(other) } }
impl<S: BaseFloat + 'static> Sub<Matrix4<S>, Matrix4<S>> for Matrix4<S> { #[inline] fn sub(&self, other: &Matrix4<S>) -> Matrix4<S> { self.sub_m(other) } }
impl<S: BaseFloat> Neg<Matrix2<S>> for Matrix2<S> { #[inline] fn neg(&self) -> Matrix2<S> { Matrix2::from_cols(self[0].neg(), self[1].neg()) } }
impl<S: BaseFloat> Neg<Matrix3<S>> for Matrix3<S> { #[inline] fn neg(&self) -> Matrix3<S> { Matrix3::from_cols(self[0].neg(), self[1].neg(), self[2].neg()) } }
@ -385,9 +385,9 @@ impl<S: BaseFloat> Zero for Matrix2<S> { #[inline] fn zero() -> Matrix2<S> { Mat
impl<S: BaseFloat> Zero for Matrix3<S> { #[inline] fn zero() -> Matrix3<S> { Matrix3::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } }
impl<S: BaseFloat> Zero for Matrix4<S> { #[inline] fn zero() -> Matrix4<S> { Matrix4::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } }
impl<S: BaseFloat> Mul<Matrix2<S>, Matrix2<S>> for Matrix2<S> { #[inline] fn mul(&self, other: &Matrix2<S>) -> Matrix2<S> { self.mul_m(other) } }
impl<S: BaseFloat> Mul<Matrix3<S>, Matrix3<S>> for Matrix3<S> { #[inline] fn mul(&self, other: &Matrix3<S>) -> Matrix3<S> { self.mul_m(other) } }
impl<S: BaseFloat> Mul<Matrix4<S>, Matrix4<S>> for Matrix4<S> { #[inline] fn mul(&self, other: &Matrix4<S>) -> Matrix4<S> { self.mul_m(other) } }
impl<S: BaseFloat + 'static> Mul<Matrix2<S>, Matrix2<S>> for Matrix2<S> { #[inline] fn mul(&self, other: &Matrix2<S>) -> Matrix2<S> { self.mul_m(other) } }
impl<S: BaseFloat + 'static> Mul<Matrix3<S>, Matrix3<S>> for Matrix3<S> { #[inline] fn mul(&self, other: &Matrix3<S>) -> Matrix3<S> { self.mul_m(other) } }
impl<S: BaseFloat + 'static> Mul<Matrix4<S>, Matrix4<S>> for Matrix4<S> { #[inline] fn mul(&self, other: &Matrix4<S>) -> Matrix4<S> { self.mul_m(other) } }
impl<S: BaseFloat> One for Matrix2<S> { #[inline] fn one() -> Matrix2<S> { Matrix2::identity() } }
impl<S: BaseFloat> One for Matrix3<S> { #[inline] fn one() -> Matrix3<S> { Matrix3::identity() } }
@ -450,7 +450,7 @@ impl<S> IndexMut<uint, Vector2<S>> for Matrix2<S> {
}
}
impl<S: Copy> Array2<Vector2<S>, Vector2<S>, S> for Matrix2<S> {
impl<S: Copy + 'static> Array2<Vector2<S>, Vector2<S>, S> for Matrix2<S> {
#[inline]
fn row(&self, r: uint) -> Vector2<S> {
Vector2::new(self[0][r],
@ -530,7 +530,7 @@ impl<S> IndexMut<uint, Vector3<S>> for Matrix3<S> {
}
}
impl<S: Copy> Array2<Vector3<S>, Vector3<S>, S> for Matrix3<S> {
impl<S: Copy + 'static> Array2<Vector3<S>, Vector3<S>, S> for Matrix3<S> {
#[inline]
fn row(&self, r: uint) -> Vector3<S> {
Vector3::new(self[0][r],
@ -615,7 +615,7 @@ impl<S> IndexMut<uint, Vector4<S>> for Matrix4<S> {
}
}
impl<S: Copy> Array2<Vector4<S>, Vector4<S>, S> for Matrix4<S> {
impl<S: Copy + 'static> Array2<Vector4<S>, Vector4<S>, S> for Matrix4<S> {
#[inline]
fn row(&self, r: uint) -> Vector4<S> {
Vector4::new(self[0][r],
@ -642,7 +642,7 @@ impl<S: Copy> Array2<Vector4<S>, Vector4<S>, S> for Matrix4<S> {
}
}
impl<S: BaseFloat> Matrix<S, Vector2<S>> for Matrix2<S> {
impl<S: BaseFloat + 'static> Matrix<S, Vector2<S>> for Matrix2<S> {
#[inline]
fn mul_s(&self, s: S) -> Matrix2<S> {
Matrix2::from_cols(self[0].mul_s(s),
@ -766,7 +766,7 @@ impl<S: BaseFloat> Matrix<S, Vector2<S>> for Matrix2<S> {
}
}
impl<S: BaseFloat> Matrix<S, Vector3<S>> for Matrix3<S> {
impl<S: BaseFloat + 'static> Matrix<S, Vector3<S>> for Matrix3<S> {
#[inline]
fn mul_s(&self, s: S) -> Matrix3<S> {
Matrix3::from_cols(self[0].mul_s(s),
@ -927,7 +927,7 @@ macro_rules! dot_matrix4(
($A[3][$I]) * ($B[$J][3])
))
impl<S: BaseFloat> Matrix<S, Vector4<S>> for Matrix4<S> {
impl<S: BaseFloat + 'static> Matrix<S, Vector4<S>> for Matrix4<S> {
#[inline]
fn mul_s(&self, s: S) -> Matrix4<S> {
Matrix4::from_cols(self[0].mul_s(s),
@ -1227,7 +1227,7 @@ impl<S: BaseFloat> ToMatrix4<S> for Matrix3<S> {
}
}
impl<S: BaseFloat> ToQuaternion<S> for Matrix3<S> {
impl<S: BaseFloat + 'static> ToQuaternion<S> for Matrix3<S> {
/// Convert the matrix to a quaternion
fn to_quaternion(&self) -> Quaternion<S> {
// http://www.cs.ucr.edu/~vbz/resources/quatut.pdf

View file

@ -25,7 +25,7 @@ use plane::Plane;
///
/// This is the equivalent to the [gluPerspective]
/// (http://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml) function.
pub fn perspective<S: BaseFloat, A: Angle<S>>(fovy: A, aspect: S, near: S, far: S) -> Matrix4<S> {
pub fn perspective<S: BaseFloat + 'static, A: Angle<S>>(fovy: A, aspect: S, near: S, far: S) -> Matrix4<S> {
PerspectiveFov {
fovy: fovy,
aspect: aspect,
@ -38,7 +38,7 @@ pub fn perspective<S: BaseFloat, A: Angle<S>>(fovy: A, aspect: S, near: S, far:
///
/// This is the equivalent of the now deprecated [glFrustrum]
/// (http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml) function.
pub fn frustum<S: BaseFloat>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
pub fn frustum<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
Perspective {
left: left,
right: right,
@ -53,7 +53,7 @@ pub fn frustum<S: BaseFloat>(left: S, right: S, bottom: S, top: S, near: S, far:
///
/// This is the equivalent of the now deprecated [glOrtho]
/// (http://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml) function.
pub fn ortho<S: BaseFloat>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
pub fn ortho<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
Ortho {
left: left,
right: right,
@ -94,7 +94,7 @@ impl<S: BaseFloat, A: Angle<S>> PerspectiveFov<S, A> {
}
}
impl<S: BaseFloat, A: Angle<S>> Projection<S> for PerspectiveFov<S, A> {
impl<S: BaseFloat + 'static, A: Angle<S>> Projection<S> for PerspectiveFov<S, A> {
fn to_frustum(&self) -> Frustum<S> {
// TODO: Could this be faster?
Frustum::from_matrix4(self.to_matrix4())
@ -150,14 +150,14 @@ pub struct Perspective<S> {
pub near: S, far: S,
}
impl<S: BaseFloat> Projection<S> for Perspective<S> {
impl<S: BaseFloat + 'static> Projection<S> for Perspective<S> {
fn to_frustum(&self) -> Frustum<S> {
// TODO: Could this be faster?
Frustum::from_matrix4(self.to_matrix4())
}
}
impl<S: BaseFloat> ToMatrix4<S> for Perspective<S> {
impl<S: BaseFloat + 'static> ToMatrix4<S> for Perspective<S> {
fn to_matrix4(&self) -> Matrix4<S> {
assert!(self.left <= self.right, "`left` cannot be greater than `right`, found: left: {} right: {}", self.left, self.right);
assert!(self.bottom <= self.top, "`bottom` cannot be greater than `top`, found: bottom: {} top: {}", self.bottom, self.top);

View file

@ -345,7 +345,7 @@ impl<S: BaseFloat> ToQuaternion<S> for Quaternion<S> {
fn to_quaternion(&self) -> Quaternion<S> { self.clone() }
}
impl<S: BaseFloat> Rotation<S, Vector3<S>, Point3<S>> for Quaternion<S> {
impl<S: BaseFloat + 'static> Rotation<S, Vector3<S>, Point3<S>> for Quaternion<S> {
#[inline]
fn identity() -> Quaternion<S> { Quaternion::identity() }

View file

@ -187,7 +187,7 @@ impl<S: BaseFloat> ToMatrix2<S> for Basis2<S> {
fn to_matrix2(&self) -> Matrix2<S> { self.mat.clone() }
}
impl<S: BaseFloat> Rotation<S, Vector2<S>, Point2<S>> for Basis2<S> {
impl<S: BaseFloat + 'static> Rotation<S, Vector2<S>, Point2<S>> for Basis2<S> {
#[inline]
fn identity() -> Basis2<S> { Basis2{ mat: Matrix2::identity() } }
@ -228,7 +228,7 @@ impl<S: BaseFloat> ApproxEq<S> for Basis2<S> {
}
}
impl<S: BaseFloat> Rotation2<S> for Basis2<S> {
impl<S: BaseFloat + 'static> Rotation2<S> for Basis2<S> {
fn from_angle(theta: Rad<S>) -> Basis2<S> { Basis2 { mat: Matrix2::from_angle(theta) } }
}
@ -271,12 +271,12 @@ impl<S: BaseFloat> ToMatrix3<S> for Basis3<S> {
fn to_matrix3(&self) -> Matrix3<S> { self.mat.clone() }
}
impl<S: BaseFloat> ToQuaternion<S> for Basis3<S> {
impl<S: BaseFloat + 'static> ToQuaternion<S> for Basis3<S> {
#[inline]
fn to_quaternion(&self) -> Quaternion<S> { self.mat.to_quaternion() }
}
impl<S: BaseFloat> Rotation<S, Vector3<S>, Point3<S>> for Basis3<S> {
impl<S: BaseFloat + 'static> Rotation<S, Vector3<S>, Point3<S>> for Basis3<S> {
#[inline]
fn identity() -> Basis3<S> { Basis3{ mat: Matrix3::identity() } }
@ -318,7 +318,7 @@ impl<S: BaseFloat> ApproxEq<S> for Basis3<S> {
}
}
impl<S: BaseFloat> Rotation3<S> for Basis3<S> {
impl<S: BaseFloat + 'static> Rotation3<S> for Basis3<S> {
fn from_axis_angle(axis: &Vector3<S>, angle: Rad<S>) -> Basis3<S> {
Basis3 { mat: Matrix3::from_axis_angle(axis, angle) }
}

View file

@ -141,7 +141,7 @@ impl<S: BaseFloat, V: Vector<S>, P: Point<S, V>, R: Rotation<S, V, P>> Transform
pub trait Transform3<S>: Transform<S, Vector3<S>, Point3<S>>+ ToMatrix4<S> {}
impl<S: BaseFloat, R: Rotation3<S>> ToMatrix4<S> for Decomposed<S, Vector3<S>, R> {
impl<S: BaseFloat + 'static, R: Rotation3<S>> ToMatrix4<S> for Decomposed<S, Vector3<S>, R> {
fn to_matrix4(&self) -> Matrix4<S> {
let mut m = self.rot.to_matrix3().mul_s(self.scale.clone()).to_matrix4();
m.w = self.disp.extend(num::one());
@ -164,7 +164,7 @@ pub struct AffineMatrix3<S> {
pub mat: Matrix4<S>,
}
impl<S : BaseFloat> Transform<S, Vector3<S>, Point3<S>> for AffineMatrix3<S> {
impl<S: BaseFloat + 'static> Transform<S, Vector3<S>, Point3<S>> for AffineMatrix3<S> {
#[inline]
fn identity() -> AffineMatrix3<S> {
AffineMatrix3 { mat: Matrix4::identity() }