aboutsummaryrefslogtreecommitdiffstats
path: root/src/oculusvr/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-07-20 03:59:57 +0200
committerSven Gothel <[email protected]>2015-07-20 03:59:57 +0200
commit5d58f63300771843687db18ad4da67c5882fd52e (patch)
treeda6d53e0f985dc862635f7733e1a7f675b8d9b87 /src/oculusvr/classes/jogamp
parentd99b7bf16fe316a10784e9588408ab28b204e506 (diff)
Bug 1151 - Fix using DK1 on OVR 0.5*; Minor changes
Diffstat (limited to 'src/oculusvr/classes/jogamp')
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java23
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java4
2 files changed, 19 insertions, 8 deletions
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
index 44bf13cd3..5025e80c5 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
@@ -86,14 +86,6 @@ public class OVRStereoDevice implements StereoDevice {
this.deviceIndex = deviceIndex;
this.hmdDesc = hmdDesc;
- {
- final FovHVHalves posFov = FovHVHalves.byRadians(hmdDesc.getCameraFrustumHFovInRadians(),
- hmdDesc.getCameraFrustumVFovInRadians());
- final float posZNear = hmdDesc.getCameraFrustumNearZInMeters();
- final float posZFar = hmdDesc.getCameraFrustumFarZInMeters();
- locationSensorParams = new LocationSensorParameter(new Frustum.FovDesc(posFov, posZNear, posZFar));
- }
-
final ovrFovPort[] defaultOVREyeFov = hmdDesc.getDefaultEyeFov(0, new ovrFovPort[ovrHmdDesc.getEyeRenderOrderArrayLength()]);
defaultEyeFov = new FovHVHalves[defaultOVREyeFov.length];
for(int i=0; i<defaultEyeFov.length; i++) {
@@ -108,6 +100,21 @@ public class OVRStereoDevice implements StereoDevice {
usedSensorBits = 0;
supportedSensorBits = OVRUtil.ovrTrackingCaps2SensorBits(hmdDesc.getTrackingCaps());
+ LocationSensorParameter _locationSensorParams = null;
+ if( StereoUtil.usesPositionSensor(supportedSensorBits)) {
+ try {
+ final FovHVHalves posFov = FovHVHalves.byRadians(hmdDesc.getCameraFrustumHFovInRadians(),
+ hmdDesc.getCameraFrustumVFovInRadians());
+ final float posZNear = hmdDesc.getCameraFrustumNearZInMeters();
+ final float posZFar = hmdDesc.getCameraFrustumFarZInMeters();
+ _locationSensorParams = new LocationSensorParameter(new Frustum.FovDesc(posFov, posZNear, posZFar));
+ } catch (final IllegalArgumentException iae) {
+ // probably zNear/zFar issue ..
+ System.err.println(iae.getMessage());
+ }
+ }
+ locationSensorParams = _locationSensorParams;
+
// DK1 delivers unrotated resolution in target orientation
// DK2 delivers rotated resolution in target orientation, monitor screen is rotated 90deg clockwise
deviceName = hmdDesc.getDisplayDeviceNameAsString();
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
index 5487ca087..95565dd0f 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
@@ -553,6 +553,10 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
final ovrVector3f pos = pose.getPosition();
viewerPose.setPosition(pos.getX(), pos.getY(), pos.getZ());
OVRUtil.copyToQuaternion(pose.getOrientation(), viewerPose.orientation);
+
+ // System.err.println("Viewer: "+OVRUtil.toString(pos));
+ // System.err.println("Camera: "+OVRUtil.toString(trackingState.getCameraPose().getPosition()));
+ // System.err.println("Leveld: "+OVRUtil.toString(trackingState.getLeveledCameraPose().getPosition()));
return viewerPose;
}