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/jogamp/opengl/ProjectFloat.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/jogamp/opengl/ProjectFloat.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/ProjectFloat.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java index 5ec5a8e3f..3fcc75f3d 100644 --- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java +++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java @@ -227,7 +227,7 @@ public class ProjectFloat { final float[] projMatrix, final int projMatrix_offset, final int[] viewport, final int viewport_offset, final float[] win_pos, final int win_pos_offset ) { - return FloatUtil.mapObjToWinCoords(objx, objy, objz, + return FloatUtil.mapObjToWin(objx, objy, objz, modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, viewport, viewport_offset, @@ -347,7 +347,7 @@ public class ProjectFloat { final float[] projMatrix, final int projMatrix_offset, final int[] viewport, final int viewport_offset, final float[] obj_pos, final int obj_pos_offset) { - return FloatUtil.mapWinToObjCoords(winx, winy, winz, + return FloatUtil.mapWinToObj(winx, winy, winz, modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, viewport, viewport_offset, @@ -505,7 +505,7 @@ public class ProjectFloat { final int[] viewport, final int viewport_offset, final float near, final float far, final float[] obj_pos, final int obj_pos_offset ) { - return FloatUtil.mapWinToObjCoords(winx, winy, winz, clipw, + return FloatUtil.mapWinToObj4(winx, winy, winz, clipw, modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, viewport, viewport_offset, |