diff options
author | Sven Gothel <[email protected]> | 2023-04-05 09:42:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-05 09:42:28 +0200 |
commit | 15e60161787224e85172685f74dc0ac195969b51 (patch) | |
tree | 68f3b44be2b340cfb7903996cea4820512049463 /src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java | |
parent | 603233b19373bfa157dd033132bff809af6a123f (diff) |
Math: Complete Matrix4f w/ Vec[234]f and adopt it throughout Quaternion, Ray, AABBox, Frustum, Stereo*, ... adding hook to PMVMatrix
Motivation was to simplify matrix + vector math usage, ease review and avoid usage bugs.
Matrix4f implementation uses dedicated float fields instead of an array.
Performance didn't increase much,
as JVM >= 11(?) has some optimizations to drop the array bounds check.
AMD64 + OpenJDK17
- Matrix4f.mul(a, b) got a roughly ~10% enhancement over FloatUtil.multMatrix(a, b, dest)
- Matrix4f.mul(b) roughly ~3% slower than FloatUtil.multMatrix(a, b, dest)
- FloatUtil.multMatrix(a, a_off, b, b_off, dest) is considerable slower than all
- Matrix4f.invert(..) roughly ~3% slower than FloatUtil.invertMatrix(..)
RaspberryPi 4b aarch64 + OpenJDK17
- Matrix4f.mul(a, b) got a roughly ~10% enhancement over FloatUtil.multMatrix(a, b, dest)
- Matrix4f.mul(b) roughly ~20% slower than FloatUtil.multMatrix(a, b)
- FloatUtil.multMatrix(a, a_off, b, b_off, dest) is considerable slower than all
- Matrix4f.invert(..) roughly ~4% slower than FloatUtil.invertMatrix(..)
Conclusion
- Matrix4f.mul(b) needs to be revised (esp for aarch64)
- Matrix4f.invert(..) should also not be slower ..
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java index b6112650a..85e752302 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java +++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -33,6 +33,7 @@ import com.jogamp.nativewindow.util.PointImmutable; import jogamp.opengl.Debug; import com.jogamp.opengl.math.FovHVHalves; +import com.jogamp.opengl.math.Vec3f; /** * Interface describing a native stereoscopic device @@ -94,7 +95,7 @@ public interface StereoDevice { public int getRequiredRotation(); /** - * Return the device default eye position offset for {@link #createRenderer(int, int, float[], FovHVHalves[], float)}. + * Return the device default eye position offset for {@link #createRenderer(int, int, Vec3f, FovHVHalves[], float)}. * <p> * Result is an array of float values for * <ul> @@ -105,7 +106,7 @@ public interface StereoDevice { * </p> * @return */ - public float[] getDefaultEyePositionOffset(); + public Vec3f getDefaultEyePositionOffset(); /** * Returns the device default {@link FovHVHalves} for all supported eyes @@ -198,7 +199,7 @@ public interface StereoDevice { * Returns the supported distortion compensation of the {@link StereoDeviceRenderer}, * e.g. {@link StereoDeviceRenderer#DISTORTION_BARREL}, {@link StereoDeviceRenderer#DISTORTION_CHROMATIC}, etc. * @see StereoDeviceRenderer#getDistortionBits() - * @see #createRenderer(int, int, float[], FovHVHalves[], float, int) + * @see #createRenderer(int, int, Vec3f, FovHVHalves[], float, int) * @see #getRecommendedDistortionBits() * @see #getMinimumDistortionBits() */ @@ -212,7 +213,7 @@ public interface StereoDevice { * User shall use the recommended distortion compensation to achieve a distortion free view. * </p> * @see StereoDeviceRenderer#getDistortionBits() - * @see #createRenderer(int, int, float[], FovHVHalves[], float, int) + * @see #createRenderer(int, int, Vec3f, FovHVHalves[], float, int) * @see #getSupportedDistortionBits() * @see #getMinimumDistortionBits() */ @@ -227,7 +228,7 @@ public interface StereoDevice { * @see #getSupportedDistortionBits() * @see #getRecommendedDistortionBits() * @see StereoDeviceRenderer#getDistortionBits() - * @see #createRenderer(int, int, float[], FovHVHalves[], float, int) + * @see #createRenderer(int, int, Vec3f, FovHVHalves[], float, int) */ public int getMinimumDistortionBits(); @@ -245,6 +246,6 @@ public interface StereoDevice { * @return */ public StereoDeviceRenderer createRenderer(final int distortionBits, - final int textureCount, final float[] eyePositionOffset, + final int textureCount, final Vec3f eyePositionOffset, final FovHVHalves[] eyeFov, final float pixelsPerDisplayPixel, final int textureUnit); } |