From 1b5da61ccbcd4fad9c1a5d1a89eed01aa18365f2 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Thu, 18 Sep 2014 16:19:26 +0200 Subject: [PATCH] Update for rustc 0e784e168 2014-09-16 23:26:11 +0000 --- src/frustum.rs | 2 +- src/matrix.rs | 36 ++++++++++++++++++------------------ src/projection.rs | 12 ++++++------ src/quaternion.rs | 2 +- src/rotation.rs | 10 +++++----- src/transform.rs | 4 ++-- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/frustum.rs b/src/frustum.rs index 648bcc9..08500cc 100644 --- a/src/frustum.rs +++ b/src/frustum.rs @@ -32,7 +32,7 @@ pub struct Frustum { pub far: Plane, } -impl +impl Frustum { /// Constructs a frustum pub fn new(left: Plane, right: Plane, diff --git a/src/matrix.rs b/src/matrix.rs index d035a79..4054388 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -77,7 +77,7 @@ impl Matrix2 { } } -impl Matrix2 { +impl Matrix2 { /// Create a transformation matrix that will cause a vector to point at /// `dir`, using `up` for orientation. pub fn look_at(dir: &Vector2, up: &Vector2) -> Matrix2 { @@ -134,7 +134,7 @@ impl Matrix3 { } } -impl +impl Matrix3 { /// Create a transformation matrix that will cause a vector to point at /// `dir`, using `up` for orientation. @@ -369,13 +369,13 @@ pub trait Matrix>: Array2 fn is_symmetric(&self) -> bool; } -impl Add, Matrix2> for Matrix2 { #[inline] fn add(&self, other: &Matrix2) -> Matrix2 { self.add_m(other) } } -impl Add, Matrix3> for Matrix3 { #[inline] fn add(&self, other: &Matrix3) -> Matrix3 { self.add_m(other) } } -impl Add, Matrix4> for Matrix4 { #[inline] fn add(&self, other: &Matrix4) -> Matrix4 { self.add_m(other) } } +impl Add, Matrix2> for Matrix2 { #[inline] fn add(&self, other: &Matrix2) -> Matrix2 { self.add_m(other) } } +impl Add, Matrix3> for Matrix3 { #[inline] fn add(&self, other: &Matrix3) -> Matrix3 { self.add_m(other) } } +impl Add, Matrix4> for Matrix4 { #[inline] fn add(&self, other: &Matrix4) -> Matrix4 { self.add_m(other) } } -impl Sub, Matrix2> for Matrix2 { #[inline] fn sub(&self, other: &Matrix2) -> Matrix2 { self.sub_m(other) } } -impl Sub, Matrix3> for Matrix3 { #[inline] fn sub(&self, other: &Matrix3) -> Matrix3 { self.sub_m(other) } } -impl Sub, Matrix4> for Matrix4 { #[inline] fn sub(&self, other: &Matrix4) -> Matrix4 { self.sub_m(other) } } +impl Sub, Matrix2> for Matrix2 { #[inline] fn sub(&self, other: &Matrix2) -> Matrix2 { self.sub_m(other) } } +impl Sub, Matrix3> for Matrix3 { #[inline] fn sub(&self, other: &Matrix3) -> Matrix3 { self.sub_m(other) } } +impl Sub, Matrix4> for Matrix4 { #[inline] fn sub(&self, other: &Matrix4) -> Matrix4 { self.sub_m(other) } } impl Neg> for Matrix2 { #[inline] fn neg(&self) -> Matrix2 { Matrix2::from_cols(self[0].neg(), self[1].neg()) } } impl Neg> for Matrix3 { #[inline] fn neg(&self) -> Matrix3 { Matrix3::from_cols(self[0].neg(), self[1].neg(), self[2].neg()) } } @@ -385,9 +385,9 @@ impl Zero for Matrix2 { #[inline] fn zero() -> Matrix2 { Mat impl Zero for Matrix3 { #[inline] fn zero() -> Matrix3 { Matrix3::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } } impl Zero for Matrix4 { #[inline] fn zero() -> Matrix4 { Matrix4::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } } -impl Mul, Matrix2> for Matrix2 { #[inline] fn mul(&self, other: &Matrix2) -> Matrix2 { self.mul_m(other) } } -impl Mul, Matrix3> for Matrix3 { #[inline] fn mul(&self, other: &Matrix3) -> Matrix3 { self.mul_m(other) } } -impl Mul, Matrix4> for Matrix4 { #[inline] fn mul(&self, other: &Matrix4) -> Matrix4 { self.mul_m(other) } } +impl Mul, Matrix2> for Matrix2 { #[inline] fn mul(&self, other: &Matrix2) -> Matrix2 { self.mul_m(other) } } +impl Mul, Matrix3> for Matrix3 { #[inline] fn mul(&self, other: &Matrix3) -> Matrix3 { self.mul_m(other) } } +impl Mul, Matrix4> for Matrix4 { #[inline] fn mul(&self, other: &Matrix4) -> Matrix4 { self.mul_m(other) } } impl One for Matrix2 { #[inline] fn one() -> Matrix2 { Matrix2::identity() } } impl One for Matrix3 { #[inline] fn one() -> Matrix3 { Matrix3::identity() } } @@ -450,7 +450,7 @@ impl IndexMut> for Matrix2 { } } -impl Array2, Vector2, S> for Matrix2 { +impl Array2, Vector2, S> for Matrix2 { #[inline] fn row(&self, r: uint) -> Vector2 { Vector2::new(self[0][r], @@ -530,7 +530,7 @@ impl IndexMut> for Matrix3 { } } -impl Array2, Vector3, S> for Matrix3 { +impl Array2, Vector3, S> for Matrix3 { #[inline] fn row(&self, r: uint) -> Vector3 { Vector3::new(self[0][r], @@ -615,7 +615,7 @@ impl IndexMut> for Matrix4 { } } -impl Array2, Vector4, S> for Matrix4 { +impl Array2, Vector4, S> for Matrix4 { #[inline] fn row(&self, r: uint) -> Vector4 { Vector4::new(self[0][r], @@ -642,7 +642,7 @@ impl Array2, Vector4, S> for Matrix4 { } } -impl Matrix> for Matrix2 { +impl Matrix> for Matrix2 { #[inline] fn mul_s(&self, s: S) -> Matrix2 { Matrix2::from_cols(self[0].mul_s(s), @@ -766,7 +766,7 @@ impl Matrix> for Matrix2 { } } -impl Matrix> for Matrix3 { +impl Matrix> for Matrix3 { #[inline] fn mul_s(&self, s: S) -> Matrix3 { Matrix3::from_cols(self[0].mul_s(s), @@ -927,7 +927,7 @@ macro_rules! dot_matrix4( ($A[3][$I]) * ($B[$J][3]) )) -impl Matrix> for Matrix4 { +impl Matrix> for Matrix4 { #[inline] fn mul_s(&self, s: S) -> Matrix4 { Matrix4::from_cols(self[0].mul_s(s), @@ -1227,7 +1227,7 @@ impl ToMatrix4 for Matrix3 { } } -impl ToQuaternion for Matrix3 { +impl ToQuaternion for Matrix3 { /// Convert the matrix to a quaternion fn to_quaternion(&self) -> Quaternion { // http://www.cs.ucr.edu/~vbz/resources/quatut.pdf diff --git a/src/projection.rs b/src/projection.rs index 56e4331..3ac3c63 100644 --- a/src/projection.rs +++ b/src/projection.rs @@ -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>(fovy: A, aspect: S, near: S, far: S) -> Matrix4 { +pub fn perspective>(fovy: A, aspect: S, near: S, far: S) -> Matrix4 { PerspectiveFov { fovy: fovy, aspect: aspect, @@ -38,7 +38,7 @@ pub fn perspective>(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(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { +pub fn frustum(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { Perspective { left: left, right: right, @@ -53,7 +53,7 @@ pub fn frustum(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(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { +pub fn ortho(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { Ortho { left: left, right: right, @@ -94,7 +94,7 @@ impl> PerspectiveFov { } } -impl> Projection for PerspectiveFov { +impl> Projection for PerspectiveFov { fn to_frustum(&self) -> Frustum { // TODO: Could this be faster? Frustum::from_matrix4(self.to_matrix4()) @@ -150,14 +150,14 @@ pub struct Perspective { pub near: S, far: S, } -impl Projection for Perspective { +impl Projection for Perspective { fn to_frustum(&self) -> Frustum { // TODO: Could this be faster? Frustum::from_matrix4(self.to_matrix4()) } } -impl ToMatrix4 for Perspective { +impl ToMatrix4 for Perspective { fn to_matrix4(&self) -> Matrix4 { 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); diff --git a/src/quaternion.rs b/src/quaternion.rs index 08e55a5..893dfe2 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -345,7 +345,7 @@ impl ToQuaternion for Quaternion { fn to_quaternion(&self) -> Quaternion { self.clone() } } -impl Rotation, Point3> for Quaternion { +impl Rotation, Point3> for Quaternion { #[inline] fn identity() -> Quaternion { Quaternion::identity() } diff --git a/src/rotation.rs b/src/rotation.rs index 7587443..006826c 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -187,7 +187,7 @@ impl ToMatrix2 for Basis2 { fn to_matrix2(&self) -> Matrix2 { self.mat.clone() } } -impl Rotation, Point2> for Basis2 { +impl Rotation, Point2> for Basis2 { #[inline] fn identity() -> Basis2 { Basis2{ mat: Matrix2::identity() } } @@ -228,7 +228,7 @@ impl ApproxEq for Basis2 { } } -impl Rotation2 for Basis2 { +impl Rotation2 for Basis2 { fn from_angle(theta: Rad) -> Basis2 { Basis2 { mat: Matrix2::from_angle(theta) } } } @@ -271,12 +271,12 @@ impl ToMatrix3 for Basis3 { fn to_matrix3(&self) -> Matrix3 { self.mat.clone() } } -impl ToQuaternion for Basis3 { +impl ToQuaternion for Basis3 { #[inline] fn to_quaternion(&self) -> Quaternion { self.mat.to_quaternion() } } -impl Rotation, Point3> for Basis3 { +impl Rotation, Point3> for Basis3 { #[inline] fn identity() -> Basis3 { Basis3{ mat: Matrix3::identity() } } @@ -318,7 +318,7 @@ impl ApproxEq for Basis3 { } } -impl Rotation3 for Basis3 { +impl Rotation3 for Basis3 { fn from_axis_angle(axis: &Vector3, angle: Rad) -> Basis3 { Basis3 { mat: Matrix3::from_axis_angle(axis, angle) } } diff --git a/src/transform.rs b/src/transform.rs index 629784f..9d5c62f 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -141,7 +141,7 @@ impl, P: Point, R: Rotation> Transform pub trait Transform3: Transform, Point3>+ ToMatrix4 {} -impl> ToMatrix4 for Decomposed, R> { +impl> ToMatrix4 for Decomposed, R> { fn to_matrix4(&self) -> Matrix4 { 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 { pub mat: Matrix4, } -impl Transform, Point3> for AffineMatrix3 { +impl Transform, Point3> for AffineMatrix3 { #[inline] fn identity() -> AffineMatrix3 { AffineMatrix3 { mat: Matrix4::identity() }