diff options
author | Sven Gothel <[email protected]> | 2015-07-20 02:58:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-07-20 02:58:17 +0200 |
commit | d9674620bc4f03dff9611a785a27dd41b1b72648 (patch) | |
tree | 1e695f5cd623e6aa6ebcd2df4662ebdcb5b7826f /src/oculusvr | |
parent | befd56510a781e65509256ae37e18888ff58181d (diff) |
Clarify code in stereo/ovr: Comments, states, names, formatting.
Diffstat (limited to 'src/oculusvr')
-rw-r--r-- | src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java | 13 | ||||
-rw-r--r-- | src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java | 12 |
2 files changed, 11 insertions, 14 deletions
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 |