diff options
author | Kenneth Russel <[email protected]> | 2008-07-18 18:27:59 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-07-18 18:27:59 +0000 |
commit | 190d2e62712a7de5ee8e9a7989157d06b34aedd9 (patch) | |
tree | 96f3b6b5a84cbe8220e2d77fc2ebd52abe94ba07 | |
parent | bac504811d3fde4675b9a8f464a74f1c41be77d5 (diff) |
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
-rw-r--r-- | src/net/java/joglutils/msg/nodes/Camera.java | 10 |
1 files 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); |