aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java21
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java13
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java3
6 files changed, 22 insertions, 33 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java
index 075da340b..43a6cfc58 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java
@@ -30,7 +30,7 @@ package com.jogamp.opengl.util.stereo;
import com.jogamp.opengl.math.FovHVHalves;
/**
- * Constant parameter for one eye.
+ * Constant single eye parameter of the viewer, relative to its {@link ViewerPose}.
*/
public final class EyeParameter {
/** Eye number, <code>0</code> for the left eye and <code>1</code> for the right eye. */
@@ -39,7 +39,7 @@ public final class EyeParameter {
/** float[3] eye position vector used to define eye height in meter relative to <i>actor</i>. */
public final float[] positionOffset;
- /** Field of view in both directions, may not be centered, either in radians or tangent. */
+ /** Field of view in both directions, may not be centered, either {@link FovHVHalves#inTangents} or radians. */
public final FovHVHalves fovhv;
/** IPD related horizontal distance from nose to pupil in meter. */
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java
index 40411ac88..10ee4c994 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java
@@ -30,7 +30,7 @@ package com.jogamp.opengl.util.stereo;
import com.jogamp.opengl.math.Quaternion;
/**
- * Position and orientation of viewer.
+ * {@link #position} and {@link #orientation} of viewer.
*/
public final class ViewerPose {
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
index 491535dc1..88be3b26b 100644
--- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
+++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
@@ -163,31 +163,22 @@ public class GenericStereoDevice implements StereoDevice {
}
@Override
- public boolean isValid() {
- return true;
- }
+ public boolean isValid() { return true; }
@Override
- public final PointImmutable getPosition() {
- return surfacePos;
- }
+ public final PointImmutable getPosition() { return surfacePos; }
@Override
- public final DimensionImmutable getSurfaceSize() {
- return config.surfaceSizeInPixels;
- }
+ public final DimensionImmutable getSurfaceSize() { return config.surfaceSizeInPixels; }
@Override
public int getRequiredRotation() { return 0; }
@Override
- public float[] getDefaultEyePositionOffset() {
- return config.defaultEyeParam[0].positionOffset;
- }
+ public float[] getDefaultEyePositionOffset() { return config.defaultEyeParam[0].positionOffset; }
@Override
- public final FovHVHalves[] getDefaultFOV() {
- return defaultEyeFov;
- }
+ public final FovHVHalves[] getDefaultFOV() { return defaultEyeFov; }
+
@Override
public final boolean startSensors(final int desiredSensorBits, final int requiredSensorBits) {
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
index fc46a9aab..b22aecab8 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
@@ -160,16 +160,13 @@ public class OVRStereoDevice implements StereoDevice {
public int getRequiredRotation() { return requiredRotation; }
@Override
- public float[] getDefaultEyePositionOffset() {
- return DEFAULT_EYE_POSITION_OFFSET;
- }
+ public float[] getDefaultEyePositionOffset() { return DEFAULT_EYE_POSITION_OFFSET; }
@Override
- public final FovHVHalves[] getDefaultFOV() {
- return defaultEyeFov;
+ public final FovHVHalves[] getDefaultFOV() { return defaultEyeFov; }
}
- public void updateUsedSensorBits(final ovrTrackingState trackingState) {
+ /* pp */ void updateUsedSensorBits(final ovrTrackingState trackingState) {
final int pre = usedSensorBits;
if( sensorsStarted && null != trackingState ) {
usedSensorBits = StereoDevice.SENSOR_ORIENTATION |
@@ -188,7 +185,7 @@ public class OVRStereoDevice implements StereoDevice {
@Override
public final boolean startSensors(final int desiredSensorBits, final int requiredSensorBits) {
- if( !sensorsStarted ) {
+ if( isValid() && !sensorsStarted ) {
if( requiredSensorBits != ( supportedSensorBits & requiredSensorBits ) ) {
// required sensors not available
if( StereoDevice.DEBUG ) {
@@ -228,7 +225,7 @@ public class OVRStereoDevice implements StereoDevice {
}
@Override
public final boolean stopSensors() {
- if( sensorsStarted ) {
+ if( isValid() && sensorsStarted ) {
OVR.ovrHmd_ConfigureTracking(hmdDesc, 0, 0); // STOP
sensorsStarted = false;
usedSensorBits = 0;
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
index 7d05bb7ac..5487ca087 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
@@ -357,7 +357,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
private final OVREye[] eyes;
private final ovrPosef[] ovrEyePoses;
private final ovrVector3f[] hmdToEyeViewOffset;
- private final ViewerPose eyePoses;
+ private final ViewerPose viewerPose;
private final ovrTrackingState trackingState;
private final int distortionBits;
private final int textureCount;
@@ -431,7 +431,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
hmdToEyeViewOffset = new ovrVector3f[2];
hmdToEyeViewOffset[0] = eyes[0].ovrEyeDesc.getHmdToEyeViewOffset();
hmdToEyeViewOffset[1] = eyes[1].ovrEyeDesc.getHmdToEyeViewOffset();
- eyePoses = new ViewerPose();
+ viewerPose = new ViewerPose();
trackingState = ovrTrackingState.create();
sp = null;
@@ -551,14 +551,14 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
// where ovrEyePoses already have hmdToEyeViewOffset applied (IPD .. etc).
final ovrPosef pose = trackingState.getHeadPose().getThePose();
final ovrVector3f pos = pose.getPosition();
- eyePoses.setPosition(pos.getX(), pos.getY(), pos.getZ());
- OVRUtil.copyToQuaternion(pose.getOrientation(), eyePoses.orientation);
- return eyePoses;
+ viewerPose.setPosition(pos.getX(), pos.getY(), pos.getZ());
+ OVRUtil.copyToQuaternion(pose.getOrientation(), viewerPose.orientation);
+ return viewerPose;
}
@Override
public final ViewerPose getLastViewerPose() {
- return eyePoses;
+ return viewerPose;
}
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index 9b414d7c5..f70df89dc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -428,7 +428,8 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
final Quaternion rollPitchYaw = new Quaternion();
// private final float eyeYaw = FloatUtil.PI; // 180 degrees in radians
// rollPitchYaw.rotateByAngleY(eyeYaw);
- final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
+ // final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
+ final float[] shiftedEyePos = VectorUtil.copyVec3(vec3Tmp1, 0, viewerPose.position, 0);
VectorUtil.scaleVec3(shiftedEyePos, shiftedEyePos, vec3ScalePos); // amplify viewerPose position
VectorUtil.addVec3(shiftedEyePos, shiftedEyePos, eyeParam.positionOffset);