From bda482e4eee76a5ba2139645682ae64dadacbc6b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 5 Jul 2014 08:27:03 +0200 Subject: Fix FloatUtil.makePerspective(..): The tan(fovy/2) shall be used, not tan(fovy), fix callers; Simplify FloatUtil.makePerspective(..FovHVHalves..) Fix FloatUtil.makePerspective(..): The tan(fovy/2) shall be used, not tan(fovy), fix callers - This bug didn't hit (yet), since callers already performed the division (degree -> radian) by falsly claiming the passed value is in radian - where it was actually fov/2 in radians. Simplify FloatUtil.makePerspective(..FovHVHalves..) - Due to the fix above, it became pretty clear that the makeFrustum(..) method can be utilized. Simply apply all our tan-half-fov values on zNear. --- src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/oculusvr/classes/jogamp/opengl') diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java index 4de05fc92..48222ea97 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java @@ -122,17 +122,11 @@ public class OVRUtil { } public static ovrFovPort getOVRFovPort(final FovHVHalves fovHVHalves) { final ovrFovPort tanHalfFov = ovrFovPort.create(); - if( fovHVHalves.inTangents ) { - tanHalfFov.setLeftTan(fovHVHalves.left); - tanHalfFov.setRightTan(fovHVHalves.right); - tanHalfFov.setUpTan(fovHVHalves.top); - tanHalfFov.setDownTan(fovHVHalves.bottom); - } else { - tanHalfFov.setLeftTan((float)Math.tan(fovHVHalves.left)); - tanHalfFov.setRightTan((float)Math.tan(fovHVHalves.right)); - tanHalfFov.setUpTan((float)Math.tan(fovHVHalves.top)); - tanHalfFov.setDownTan((float)Math.tan(fovHVHalves.bottom)); - } + final FovHVHalves fovHVHalvesTan = fovHVHalves.getInTangents(); + tanHalfFov.setLeftTan(fovHVHalvesTan.left); + tanHalfFov.setRightTan(fovHVHalvesTan.right); + tanHalfFov.setUpTan(fovHVHalvesTan.top); + tanHalfFov.setDownTan(fovHVHalvesTan.bottom); return tanHalfFov; } -- cgit v1.2.3