aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-09 08:26:57 +0200
committerSven Gothel <[email protected]>2023-04-09 08:26:57 +0200
commitdf60909c70b5dba10c9734e0c26d31e0649f4309 (patch)
treee600920890e52670c2749ce70f70b1913d77dd3c /src/graphui
parent003eb8ca1f296f287dc3d224fa19781705e10dd9 (diff)
Matrix4f.mapWin*(): Drop unused temp matrices, map*() returns false on invPMv null; PMVMatrix: Make Mvi, Mvit optional at ctor, add user PMv and PMvi - used at gluUnProject() ..
Matrix4f.mapWin*() variants w/ invPMv don't need temp matrices, they also shall handle null invPMv -> return false to streamline usage w/ PMVMatrix if inversion failed. PMVMatrix adds user space common premultiplies Pmv and Pmvi on demand like Frustum. These are commonly required for e.g. gluUnProject(..)/mapWinToObj(..) and might benefit from caching if stack is maintained and no modification occured. PMVMatrix now has the shader related Mvi and Mvit optional at construction(!), so its backing buffers. This reduces footprint for other use cases. The 2nd temp matrix is also on-demand, to reduce footprint for certain use cases. Removed public access to temporary storage. +++ While these additional matrices are on demand and/or at request @ ctor, general memory footprint is reduced per default and hence deemed acceptable while still having PMVMatrix acting as a core flexible matrix provider.
Diffstat (limited to 'src/graphui')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Shape.java12
2 files changed, 4 insertions, 10 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index cfc8dd534..aa6952031 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -147,7 +147,7 @@ public class Group extends Shape implements Container {
}
}
- private final boolean doFrustumCulling = true; // FIXME
+ private final boolean doFrustumCulling = false; // FIXME
@Override
protected final void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount, final float[] rgba) {
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
index 0f6b0ec28..10532d462 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
@@ -527,8 +527,7 @@ public abstract class Shape {
final Vec3f high = box.getHigh();
final Vec3f low = box.getLow();
- // Efficiently reuse matPMv and temporary PMVMatrix storage
- final Matrix4f matPMv = pmv.mulPMvMat(pmv.getTmp1Mat());
+ final Matrix4f matPMv = pmv.getPMvMat();
if( Matrix4f.mapObjToWin(high, matPMv, viewport, winCoordHigh) ) {
if( Matrix4f.mapObjToWin(low, matPMv, viewport, winCoordLow) ) {
surfaceSize[0] = (int)Math.abs(winCoordHigh.x() - winCoordLow.x());
@@ -706,14 +705,9 @@ public abstract class Shape {
public Vec3f winToShapeCoord(final PMVMatrix pmv, final Recti viewport, final int glWinX, final int glWinY, final Vec3f objPos) {
final Vec3f ctr = box.getCenter();
- // Efficiently reuse matPMv and temporary PMVMatrix storage
- final Matrix4f matPMv = pmv.mulPMvMat(pmv.getTmp1Mat());
- if( Matrix4f.mapObjToWin(ctr, matPMv, viewport, objPos) ) {
+ if( Matrix4f.mapObjToWin(ctr, pmv.getPMvMat(), viewport, objPos) ) {
final float winZ = objPos.z();
- if( !matPMv.invert() ) {
- return null;
- }
- if( Matrix4f.mapWinToObj(glWinX, glWinY, winZ, matPMv, viewport, objPos, pmv.getTmp2Mat()) ) {
+ if( Matrix4f.mapWinToObj(glWinX, glWinY, winZ, pmv.getPMviMat(), viewport, objPos) ) {
return objPos;
}
}