From 3c9a6a531dad2821c834381af1a36fa6d8c4dd58 Mon Sep 17 00:00:00 2001 From: Boden Garman Date: Sat, 7 Dec 2013 14:36:11 +1100 Subject: [PATCH] Fixed Mat4::look_at --- src/cgmath/matrix.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cgmath/matrix.rs b/src/cgmath/matrix.rs index c9e7fcf..fd2be4f 100644 --- a/src/cgmath/matrix.rs +++ b/src/cgmath/matrix.rs @@ -226,13 +226,13 @@ impl Mat4 { impl Mat4 { pub fn look_at(eye: &Point3, center: &Point3, up: &Vec3) -> Mat4 { let f = center.sub_p(eye).normalize(); - let s = f.cross(&up.normalize()); - let u = s.cross(&f).normalize(); + let s = f.cross(up).normalize(); + let u = s.cross(&f); - Mat4::new(s.x.clone(), s.y.clone(), s.z.clone(), zero(), - u.x.clone(), u.y.clone(), u.z.clone(), zero(), - -f.x.clone(), -f.y.clone(), -f.z.clone(), zero(), - -eye.dot(&s), -eye.dot(&u), -eye.dot(&f), one()) + Mat4::new(s.x.clone(), u.x.clone(), -f.x.clone(), zero(), + s.y.clone(), u.y.clone(), -f.y.clone(), zero(), + s.z.clone(), u.z.clone(), -f.z.clone(), zero(), + -eye.dot(&s), -eye.dot(&u), eye.dot(&f), one()) } }