From d99b7bf16fe316a10784e9588408ab28b204e506 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 20 Jul 2015 02:59:54 +0200 Subject: StereoDevice (Generic/OVR): Add knowledge about LocationSensorParameter and allow reset origin of location-sensor --- .../jogamp/opengl/oculusvr/OVRStereoDevice.java | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/oculusvr/classes/jogamp/opengl') diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java index b22aecab8..44bf13cd3 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java @@ -40,6 +40,8 @@ import com.jogamp.oculusvr.ovrHmdDesc; import com.jogamp.oculusvr.ovrSizei; import com.jogamp.oculusvr.ovrTrackingState; import com.jogamp.opengl.math.FovHVHalves; +import com.jogamp.opengl.math.geom.Frustum; +import com.jogamp.opengl.util.stereo.LocationSensorParameter; import com.jogamp.opengl.util.stereo.StereoDevice; import com.jogamp.opengl.util.stereo.StereoDeviceFactory; import com.jogamp.opengl.util.stereo.StereoDeviceRenderer; @@ -69,6 +71,8 @@ public class OVRStereoDevice implements StereoDevice { private final PointImmutable position; private final int dkVersion; + private final LocationSensorParameter locationSensorParams; + public OVRStereoDevice(final StereoDeviceFactory factory, final ovrHmdDesc hmdDesc, final int deviceIndex) { if( null == hmdDesc ) { throw new IllegalArgumentException("Passed null hmdDesc"); @@ -81,6 +85,15 @@ public class OVRStereoDevice implements StereoDevice { this.handle = nativeContext; 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