aboutsummaryrefslogtreecommitdiffstats
path: root/src/oculusvr/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-05 08:27:03 +0200
committerSven Gothel <[email protected]>2014-07-05 08:27:03 +0200
commitbda482e4eee76a5ba2139645682ae64dadacbc6b (patch)
tree51f67d3734276114754bff02bbde2217fc0fb797 /src/oculusvr/classes
parentf8f0f051604721bceaee214b8e5218fd47d2eb9e (diff)
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.
Diffstat (limited to 'src/oculusvr/classes')
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java16
1 files changed, 5 insertions, 11 deletions
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;
}