diff options
Diffstat (limited to 'jogl')
-rw-r--r-- | jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionMeshProducer.java | 18 | ||||
-rw-r--r-- | jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionSpec.java | 8 |
2 files changed, 12 insertions, 14 deletions
diff --git a/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionMeshProducer.java b/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionMeshProducer.java index aa64f6c..05c1011 100644 --- a/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionMeshProducer.java +++ b/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionMeshProducer.java @@ -88,17 +88,17 @@ package jogamp.opengl.oculusvr.stereo.lense; import jogamp.opengl.util.stereo.DistortionMesh; -import jogamp.opengl.util.stereo.GenericStereoDevice; import jogamp.opengl.util.stereo.ScaleAndOffset2D; import jogamp.opengl.util.stereo.DistortionMesh.DistortionVertex; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.VectorUtil; import com.jogamp.opengl.util.stereo.EyeParameter; +import com.jogamp.opengl.util.stereo.generic.GenericStereoDeviceConfig; public class DistortionMeshProducer implements DistortionMesh.Producer { private DistortionSpec[] distortionSpecs; - private GenericStereoDevice.Config deviceConfig; + private GenericStereoDeviceConfig deviceConfig; private final float[] eyeReliefInMeters; public DistortionMeshProducer() { @@ -108,14 +108,13 @@ public class DistortionMeshProducer implements DistortionMesh.Producer { } @Override - public void init(final GenericStereoDevice.Config deviceConfig, final float[] eyeReliefInMeters) { - if( this.deviceConfig != deviceConfig || - this.eyeReliefInMeters[0] != eyeReliefInMeters[0] || - this.eyeReliefInMeters[1] != eyeReliefInMeters[1] ) { - System.arraycopy(eyeReliefInMeters, 0, this.eyeReliefInMeters, 0, 2); - this.distortionSpecs = DistortionSpec.CalculateDistortionSpec(deviceConfig, eyeReliefInMeters); - this.deviceConfig = deviceConfig; + public void init(final GenericStereoDeviceConfig deviceConfig, final float[] eyeReliefInMeters) throws IllegalStateException { + if( null != this.deviceConfig ) { + throw new IllegalStateException("Already initialized"); } + System.arraycopy(eyeReliefInMeters, 0, this.eyeReliefInMeters, 0, 2); + this.distortionSpecs = DistortionSpec.CalculateDistortionSpec(deviceConfig, eyeReliefInMeters); + this.deviceConfig = deviceConfig; } // Pow2 for the Morton order to work! @@ -164,6 +163,7 @@ public class DistortionMeshProducer implements DistortionMesh.Producer { VectorUtil.scaleVec2(resultB, tanEyeAngleDistorted, distortionScales[2]); } + @Override public final DistortionMesh create(final EyeParameter eyeParam, final int distortionBits) { // Find the mapping from TanAngle space to target NDC space. final ScaleAndOffset2D eyeToSourceNDC = new ScaleAndOffset2D(eyeParam.fovhv); diff --git a/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionSpec.java b/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionSpec.java index 63a9a90..da2432b 100644 --- a/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionSpec.java +++ b/jogl/src/classes/jogamp/opengl/oculusvr/stereo/lense/DistortionSpec.java @@ -88,10 +88,8 @@ package jogamp.opengl.oculusvr.stereo.lense; import com.jogamp.nativewindow.util.DimensionImmutable; - -import jogamp.opengl.util.stereo.GenericStereoDevice; - import com.jogamp.opengl.math.VectorUtil; +import com.jogamp.opengl.util.stereo.generic.GenericStereoDeviceConfig; public class DistortionSpec { public DistortionSpec(final LensConfig lens) { @@ -109,7 +107,7 @@ public class DistortionSpec { final float[] tanEyeAngleScale; final float[] lensCenter; - public static DistortionSpec[] CalculateDistortionSpec (final GenericStereoDevice.Config deviceConfig, final float[] eyeReliefInMeters) { + public static DistortionSpec[] CalculateDistortionSpec (final GenericStereoDeviceConfig deviceConfig, final float[] eyeReliefInMeters) { final DistortionSpec[] result = new DistortionSpec[2]; /// FIXME: Add 'pluggable' lense configuration final LensConfig[] lensConfig = LensConfig.GenerateLensConfigFromEyeRelief(eyeReliefInMeters, LensConfig.DistortionEquation.CatmullRom10); @@ -119,7 +117,7 @@ public class DistortionSpec { } - private static DistortionSpec CalculateDistortionSpec (final GenericStereoDevice.Config deviceConfig, final int eyeName, + private static DistortionSpec CalculateDistortionSpec (final GenericStereoDeviceConfig deviceConfig, final int eyeName, final float eyeReliefInMeters, final LensConfig lensConfig) { // From eye relief, IPD and device characteristics, we get the distortion mapping. // This distortion does the following things: |