aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/math/Ray.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-05 09:42:28 +0200
committerSven Gothel <[email protected]>2023-04-05 09:42:28 +0200
commit15e60161787224e85172685f74dc0ac195969b51 (patch)
tree68f3b44be2b340cfb7903996cea4820512049463 /src/jogl/classes/com/jogamp/opengl/math/Ray.java
parent603233b19373bfa157dd033132bff809af6a123f (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/math/Ray.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Ray.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Ray.java b/src/jogl/classes/com/jogamp/opengl/math/Ray.java
index a528f0763..25a7d9a70 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Ray.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Ray.java
@@ -47,14 +47,14 @@ import com.jogamp.opengl.math.geom.AABBox;
* </p>
*/
public class Ray {
- /** Origin of Ray, float[3]. */
- public final float[] orig = new float[3];
+ /** Origin of Ray. */
+ public final Vec3f orig = new Vec3f();
- /** Normalized direction vector of ray, float[3]. */
- public final float[] dir = new float[3];
+ /** Normalized direction vector of ray. */
+ public final Vec3f dir = new Vec3f();
@Override
public String toString() {
- return "Ray[orig["+orig[0]+", "+orig[1]+", "+orig[2]+"], dir["+dir[0]+", "+dir[1]+", "+dir[2]+"]]";
+ return "Ray[orig["+orig+"], dir["+dir+"]]";
}
} \ No newline at end of file