summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/font
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/jogamp/graph/font
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/jogamp/graph/font')
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java8
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index 1bc0fe0f4..cc0aece27 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -250,7 +250,7 @@ class TypecastFont implements Font {
@Override
public AABBox getMetricBounds(final CharSequence string) {
- return getMetricBoundsFU(string).scale2(1.0f/metrics.getUnitsPerEM(), new float[3]);
+ return getMetricBoundsFU(string).scale2(1.0f/metrics.getUnitsPerEM());
}
@Override
@@ -290,7 +290,7 @@ class TypecastFont implements Font {
}
@Override
public AABBox getGlyphBounds(final CharSequence string, final AffineTransform tmp1, final AffineTransform tmp2) {
- return getGlyphBoundsFU(string, tmp1, tmp2).scale2(1.0f/metrics.getUnitsPerEM(), new float[3]);
+ return getGlyphBoundsFU(string, tmp1, tmp2).scale2(1.0f/metrics.getUnitsPerEM());
}
@Override
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
index 6747cca82..560d0902b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
@@ -148,14 +148,14 @@ public final class TypecastGlyph implements Font.Glyph {
public final AABBox getBoundsFU(final AABBox dest) { return dest.copy(bbox); }
@Override
- public final AABBox getBounds(final AABBox dest, final float[] tmpV3) {
- return dest.copy(bbox).scale2(1.0f/font.getMetrics().getUnitsPerEM(), tmpV3);
+ public final AABBox getBounds(final AABBox dest) {
+ return dest.copy(bbox).scale2(1.0f/font.getMetrics().getUnitsPerEM());
}
@Override
public final AABBox getBounds() {
- final AABBox dest = new AABBox();
- return dest.copy(bbox).scale2(1.0f/font.getMetrics().getUnitsPerEM(), new float[2]);
+ final AABBox dest = new AABBox(bbox);
+ return dest.scale2(1.0f/font.getMetrics().getUnitsPerEM());
}
@Override
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
index 5e56d1932..11f1ce7c7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
@@ -119,7 +119,7 @@ final class TypecastHMetrics implements Metrics {
}
@Override
- public AABBox getBounds(final AABBox dest, final float[] tmpV3) {
- return dest.setSize(bbox.getLow(), bbox.getHigh()).scale2(unitsPerEM_inv, tmpV3);
+ public AABBox getBounds(final AABBox dest) {
+ return dest.copy(bbox).scale2(unitsPerEM_inv);
}
}