From 190d2e62712a7de5ee8e9a7989157d06b34aedd9 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Fri, 18 Jul 2008 18:27:59 +0000 Subject: Fixed bug in test and use of 1/w value in Camera.unproject() git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/joglutils/trunk@102 83d24430-9974-4f80-8418-2cc3294053b9 --- src/net/java/joglutils/msg/nodes/Camera.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net/java/joglutils/msg/nodes/Camera.java b/src/net/java/joglutils/msg/nodes/Camera.java index ecd7179..250d3d1 100644 --- a/src/net/java/joglutils/msg/nodes/Camera.java +++ b/src/net/java/joglutils/msg/nodes/Camera.java @@ -213,14 +213,14 @@ public abstract class Camera extends Node { // Multiply Vec4f unproj = new Vec4f(); mat.xformVec(pt3d, unproj); - if (unproj.z() == 0) { + if (unproj.w() == 0) { // FIXME: is this the right exception to throw in this case? throw new SingularMatrixException(); } - float ooZ = 1.0f / unproj.w(); - Vec3f to = new Vec3f(unproj.x() * ooZ, - unproj.y() * ooZ, - unproj.z() * ooZ); + float ooW = 1.0f / unproj.w(); + Vec3f to = new Vec3f(unproj.x() * ooW, + unproj.y() * ooW, + unproj.z() * ooW); Vec3f from = getRayStartPoint(point, to); Vec3f dir = to.minus(from); -- cgit v1.2.3