diff options
author | Sven Gothel <[email protected]> | 2023-09-20 19:51:55 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-20 19:51:55 +0200 |
commit | 5d6e8a367c03644740187e500c6de5d3ac039d5e (patch) | |
tree | a649f559413c51272ee3f4afff1f68ebfea45477 /src/graphui/classes/jogamp/graph/ui | |
parent | bbe845846ffc00807395a5070a7352c6bbe7e4ef (diff) |
Bug 1452 - Decouple math functionality to 'com.jogamp.math' to be toolkit agnostic (PMVMatrix, Matrix4f, Vec4f, ..)
Math functionality (PMVMatrix, Matrix4f, Vec4f, ..)
- shall be used toolkit agnostic, e.g. independent from OpenGL
- shall be reused within our upcoming Vulkan implementation
- may also move outside of JOGL, i.e. GlueGen or within its own package to be reused for other purposed.
The 'com.jogamp.opengl.util.PMVMatrix' currently also used to feed in GLUniformData
via the toolkit agnostic SyncAction and SyncBuffer
shall also be split to a toolkit agnostic variant.
An OpenGL PMVMatrix specialization implementing GLMatrixFunc can still exist,
being derived from the toolkit agnostic base implementation.
+++
Initial commit .. compile clean, passing most unit tests.
Diffstat (limited to 'src/graphui/classes/jogamp/graph/ui')
-rw-r--r-- | src/graphui/classes/jogamp/graph/ui/TreeTool.java | 32 | ||||
-rw-r--r-- | src/graphui/classes/jogamp/graph/ui/shapes/Label0.java | 8 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/graphui/classes/jogamp/graph/ui/TreeTool.java b/src/graphui/classes/jogamp/graph/ui/TreeTool.java index c5701d6e2..d43c6c7f7 100644 --- a/src/graphui/classes/jogamp/graph/ui/TreeTool.java +++ b/src/graphui/classes/jogamp/graph/ui/TreeTool.java @@ -36,7 +36,7 @@ import com.jogamp.graph.ui.Scene; import com.jogamp.graph.ui.Shape; import com.jogamp.graph.ui.Shape.Visitor1; import com.jogamp.graph.ui.Shape.Visitor2; -import com.jogamp.opengl.util.PMVMatrix; +import com.jogamp.math.util.PMVMatrix4f; /** Generic static {@link Shape} tree traversal tools, utilized by {@link Scene} and {@link Container} implementations. */ public class TreeTool { @@ -48,24 +48,24 @@ public class TreeTool { * @param action * @return true to signal operation complete, i.e. {@code shape} found, otherwise false */ - public static boolean forOne(final List<Shape> shapes, final PMVMatrix pmv, final Shape shape, final Runnable action) { + public static boolean forOne(final List<Shape> shapes, final PMVMatrix4f pmv, final Shape shape, final Runnable action) { for(int i=0; i<shapes.size(); ++i) { final Shape s = shapes.get(i); if( s.equals(shape) ) { - pmv.glPushMatrix(); - s.setTransform(pmv); + pmv.pushMv(); + s.setMvTransform(pmv); action.run(); - pmv.glPopMatrix(); + pmv.popMv(); return true; } else if( s instanceof Container ) { final Container c = (Container)s; if( !c.contains(shape) ) { // fast-path: skip container continue; } - pmv.glPushMatrix(); - s.setTransform(pmv); + pmv.pushMv(); + s.setMvTransform(pmv); final boolean res = c.forOne(pmv, shape, action); - pmv.glPopMatrix(); + pmv.popMv(); if( !res ) { throw new InternalError("Not found "+shape+" in "+c+", but contained"); } return true; } @@ -99,17 +99,17 @@ public class TreeTool { * @param v * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false */ - public static boolean forAll(final List<Shape> shapes, final PMVMatrix pmv, final Visitor2 v) { + public static boolean forAll(final List<Shape> shapes, final PMVMatrix4f pmv, final Visitor2 v) { for(int i=0; i<shapes.size(); ++i) { final Shape s = shapes.get(i); - pmv.glPushMatrix(); - s.setTransform(pmv); + pmv.pushMv(); + s.setMvTransform(pmv); boolean res = v.visit(s, pmv); if( !res && s instanceof Container ) { final Container c = (Container)s; res = c.forAll(pmv, v); } - pmv.glPopMatrix(); + pmv.popMv(); if( res ) { return true; } @@ -127,20 +127,20 @@ public class TreeTool { * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false */ @SuppressWarnings({ "unchecked", "rawtypes" }) - public static boolean forSortedAll(final Comparator<Shape> sortComp, final List<Shape> shapes, final PMVMatrix pmv, final Visitor2 v) { + public static boolean forSortedAll(final Comparator<Shape> sortComp, final List<Shape> shapes, final PMVMatrix4f pmv, final Visitor2 v) { final Object[] shapesS = shapes.toArray(); Arrays.sort(shapesS, (Comparator)sortComp); for(int i=0; i<shapesS.length; ++i) { final Shape s = (Shape)shapesS[i]; - pmv.glPushMatrix(); - s.setTransform(pmv); + pmv.pushMv(); + s.setMvTransform(pmv); boolean res = v.visit(s, pmv); if( !res && s instanceof Container ) { final Container c = (Container)s; res = c.forSortedAll(sortComp, pmv, v); } - pmv.glPopMatrix(); + pmv.popMv(); if( res ) { return true; } diff --git a/src/graphui/classes/jogamp/graph/ui/shapes/Label0.java b/src/graphui/classes/jogamp/graph/ui/shapes/Label0.java index 3809c3a07..2ee370dea 100644 --- a/src/graphui/classes/jogamp/graph/ui/shapes/Label0.java +++ b/src/graphui/classes/jogamp/graph/ui/shapes/Label0.java @@ -30,10 +30,10 @@ package jogamp.graph.ui.shapes; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.plane.AffineTransform; -import com.jogamp.opengl.math.Vec2f; -import com.jogamp.opengl.math.Vec4f; -import com.jogamp.opengl.math.geom.AABBox; +import com.jogamp.math.Vec2f; +import com.jogamp.math.Vec4f; +import com.jogamp.math.geom.AABBox; +import com.jogamp.math.geom.plane.AffineTransform; public class Label0 { protected Font font; |