aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-20 19:51:55 +0200
committerSven Gothel <[email protected]>2023-09-20 19:51:55 +0200
commit5d6e8a367c03644740187e500c6de5d3ac039d5e (patch)
treea649f559413c51272ee3f4afff1f68ebfea45477 /src/graphui/classes/com/jogamp
parentbbe845846ffc00807395a5070a7352c6bbe7e4ef (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/com/jogamp')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java74
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Container.java23
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/GraphShape.java4
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java44
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Scene.java146
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Shape.java322
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java20
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java24
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java12
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java6
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java4
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java2
15 files changed, 344 insertions, 343 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
index f0c2f9df4..d6cbacd18 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
@@ -36,20 +36,20 @@ import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.Font.Glyph;
-import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.ui.Group.Layout;
import com.jogamp.graph.ui.shapes.GlyphShape;
+import com.jogamp.math.FloatUtil;
+import com.jogamp.math.Quaternion;
+import com.jogamp.math.Recti;
+import com.jogamp.math.Vec2f;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.Vec4f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.geom.plane.AffineTransform;
+import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.Quaternion;
-import com.jogamp.opengl.math.Recti;
-import com.jogamp.opengl.math.Vec2f;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
-import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.PMVMatrix;
/**
* Group of animated {@link Shape}s including other static {@link Shape}s, optionally utilizing a {@link Group.Layout}.
@@ -304,13 +304,13 @@ public class AnimGroup extends Group {
/**
* Add a new {@link Set} with an empty {@link ShapeData} container.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * only, without a shape's {@link #setTransform(PMVMatrix)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * only, without a shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* </p>
* @param pixPerMM monitor pixel per millimeter for accurate animation
* @param glp used {@link GLProfile}
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* @param viewport the int[4] viewport
* @param accel translation acceleration in [m]/[s*s]
* @param velocity translation velocity in [m]/[s]
@@ -322,21 +322,21 @@ public class AnimGroup extends Group {
* @return a new {@link Set} instance
*/
public Set addAnimSet(final float pixPerMM,
- final GLProfile glp, final PMVMatrix pmv, final Recti viewport,
- final float accel, final float velocity,
- final float ang_accel, final float ang_velo,
- final LerpFunc lerp, final Shape refShape)
+ final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport,
+ final float accel, final float velocity,
+ final float ang_accel, final float ang_velo,
+ final LerpFunc lerp, final Shape refShape)
{
final Set as;
refShape.validate(glp);
- pmv.glPushMatrix();
+ pmv.pushMv();
{
- refShape.setTransform(pmv);
+ refShape.setMvTransform(pmv);
as = new Set(pixPerMM, refShape.getPixelPerShapeUnit(pmv, viewport, new float[2]), refShape,
accel, velocity, ang_accel, ang_velo,
new ArrayList<ShapeData>(), new AABBox(), lerp);
}
- pmv.glPopMatrix();
+ pmv.popMv();
animSets.add(as);
return as;
}
@@ -345,13 +345,13 @@ public class AnimGroup extends Group {
* Add a new {@link Set} with {@link ShapeData} for each {@link GlyphShape}, moving towards its target position
* using a generic displacement via {@link ShapeSetup} to determine each {@link ShapeData}'s starting position.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * only, without a shape's {@link #setTransform(PMVMatrix)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * only, without a shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* </p>
* @param pixPerMM monitor pixel per millimeter for accurate animation
* @param glp used {@link GLProfile}
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* @param viewport the int[4] viewport
* @param renderModes used {@link GLRegion#create(GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence) region render-modes}
* @param font {@link Font} to be used for resulting {@link GlyphShape}s
@@ -367,10 +367,10 @@ public class AnimGroup extends Group {
* @return newly created and added {@link Set}
*/
public final Set addGlyphSet(final float pixPerMM,
- final GLProfile glp, final PMVMatrix pmv, final Recti viewport, final int renderModes,
- final Font font, final char refChar, final CharSequence text, final float fontScale,
- final float accel, final float velocity, final float ang_accel, final float ang_velo,
- final LerpFunc lerp, final ShapeSetup op)
+ final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes,
+ final Font font, final char refChar, final CharSequence text, final float fontScale,
+ final float accel, final float velocity, final float ang_accel, final float ang_velo,
+ final LerpFunc lerp, final ShapeSetup op)
{
final Set as;
{
@@ -379,13 +379,13 @@ public class AnimGroup extends Group {
final GlyphShape refShape = new GlyphShape(renderModes, font, refChar, 0, 0);
refShape.setScale(fontScale, fontScale, 1f);
refShape.validate(glp);
- pmv.glPushMatrix();
+ pmv.pushMv();
{
- refShape.setTransform(pmv);
+ refShape.setMvTransform(pmv);
as = new Set(pixPerMM, refShape.getPixelPerShapeUnit(pmv, viewport, new float[2]), refShape,
accel, velocity, ang_accel, ang_velo, allShapes, sourceBounds, lerp);
}
- pmv.glPopMatrix();
+ pmv.popMv();
}
animSets.add(as);
@@ -424,13 +424,13 @@ public class AnimGroup extends Group {
* The start-position is randomly chosen within given {@link AABBox} glyphBox.
* </p>
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * only, without a shape's {@link #setTransform(PMVMatrix)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * only, without a shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* </p>
* @param pixPerMM monitor pixel per millimeter for accurate animation
* @param glp used {@link GLProfile}
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* @param viewport the int[4] viewport
* @param renderModes used {@link GLRegion#create(GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence) region render-modes}
* @param font {@link Font} to be used for resulting {@link GlyphShape}s
@@ -448,7 +448,7 @@ public class AnimGroup extends Group {
* @return newly created and added {@link Set}
*/
public final Set addGlyphSetRandom01(final float pixPerMM,
- final GLProfile glp, final PMVMatrix pmv, final Recti viewport, final int renderModes,
+ final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes,
final Font font, final CharSequence text, final float fontScale, final Vec4f fgCol,
final float accel, final float velocity, final float ang_accel, final float ang_velo,
final AABBox animBox, final boolean z_only, final Random random, final LerpFunc lerp)
@@ -473,13 +473,13 @@ public class AnimGroup extends Group {
* Add a new {@link Set} with {@link ShapeData} for each {@link GlyphShape}, implementing<br/>
* horizontal continuous scrolling while repeating the given {@code text}.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * only, without a shape's {@link #setTransform(PMVMatrix)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * only, without a shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* </p>
* @param pixPerMM monitor pixel per millimeter for accurate animation
* @param glp used {@link GLProfile}
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
* @param viewport the int[4] viewport
* @param renderModes used {@link GLRegion#create(GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence) region render-modes}
* @param font {@link Font} to be used for resulting {@link GlyphShape}s
@@ -491,7 +491,7 @@ public class AnimGroup extends Group {
* @return newly created and added {@link Set}
*/
public final Set addGlyphSetHorizScroll01(final float pixPerMM,
- final GLProfile glp, final PMVMatrix pmv, final Recti viewport, final int renderModes,
+ final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes,
final Font font, final CharSequence text, final float fontScale, final Vec4f fgCol,
final float velocity, final AABBox animBox, final float y_offset)
{
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Container.java b/src/graphui/classes/com/jogamp/graph/ui/Container.java
index 845d41c0c..bc1e6d94f 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Container.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Container.java
@@ -32,10 +32,9 @@ import java.util.Comparator;
import java.util.List;
import com.jogamp.graph.ui.Shape.Visitor2;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.graph.ui.Shape.Visitor1;
-import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.PMVMatrix;
/**
* Container interface of UI {@link Shape}s
@@ -71,9 +70,9 @@ public interface Container {
boolean contains(Shape s);
- AABBox getBounds(final PMVMatrix pmv, Shape shape);
+ AABBox getBounds(final PMVMatrix4f pmv, Shape shape);
- /** Enable or disable {@link PMVMatrix#getFrustum()} culling per {@link Shape}. Default is disabled. */
+ /** Enable or disable {@link PMVMatrix4f#getFrustum()} culling per {@link Shape}. Default is disabled. */
void setFrustumCullingEnabled(final boolean v);
/** Return whether {@link #setFrustumCullingEnabled(boolean) frustum culling} is enabled. */
@@ -86,7 +85,7 @@ public interface Container {
* @param action
* @return true to signal operation complete, i.e. {@code shape} found, otherwise false
*/
- boolean forOne(final PMVMatrix pmv, final Shape shape, final Runnable action);
+ boolean forOne(final PMVMatrix4f pmv, final Shape shape, final Runnable action);
/**
* Traverses through the graph and apply {@link Visitor1#visit(Shape)} for each, stop if it returns true.
@@ -96,21 +95,21 @@ public interface Container {
boolean forAll(Visitor1 v);
/**
- * Traverses through the graph and apply {@link Visitor2#visit(Shape, PMVMatrix)} for each, stop if it returns true.
+ * Traverses through the graph and apply {@link Visitor2#visit(Shape, PMVMatrix4f)} for each, stop if it returns true.
* @param pmv
* @param v
- * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false
+ * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix4f)} returned true, otherwise false
*/
- boolean forAll(final PMVMatrix pmv, Visitor2 v);
+ boolean forAll(final PMVMatrix4f pmv, Visitor2 v);
/**
- * Traverses through the graph and apply {@link Visitor#visit(Shape, PMVMatrix)} for each, stop if it returns true.
+ * Traverses through the graph and apply {@link Visitor#visit(Shape, PMVMatrix4f)} for each, stop if it returns true.
*
* Each {@link Container} level is sorted using {@code sortComp}
* @param sortComp
* @param pmv
* @param v
- * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false
+ * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix4f)} returned true, otherwise false
*/
- boolean forSortedAll(final Comparator<Shape> sortComp, final PMVMatrix pmv, final Visitor2 v);
+ boolean forSortedAll(final Comparator<Shape> sortComp, final PMVMatrix4f pmv, final Visitor2 v);
} \ No newline at end of file
diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
index 46f2d0a5b..971136ec8 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
@@ -35,10 +35,10 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.ui.layout.Padding;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.Vec4f;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
import com.jogamp.opengl.util.texture.TextureSequence;
/**
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index 6ddfa9700..8a50d19f3 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -37,12 +37,12 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.ui.layout.Padding;
import com.jogamp.graph.ui.shapes.Rectangle;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.Vec4f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
-import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.PMVMatrix;
import jogamp.graph.ui.TreeTool;
@@ -64,14 +64,14 @@ public class Group extends Shape implements Container {
* According to the implemented layout, method
* - may scale the {@Link Shape}s
* - may move the {@Link Shape}s
- * - may reuse the given {@link PMVMatrix} `pmv`
+ * - may reuse the given {@link PMVMatrix4f} `pmv`
* - must update the given {@link AABBox} `box`
* </p>
* @param g the {@link Group} to layout
* @param box the bounding box of {@link Group} to be updated by this method.
- * @param pmv a {@link PMVMatrix} which can be reused.
+ * @param pmv a {@link PMVMatrix4f} which can be reused.
*/
- void layout(final Group g, final AABBox box, final PMVMatrix pmv);
+ void layout(final Group g, final AABBox box, final PMVMatrix4f pmv);
}
private final List<Shape> shapes = new CopyOnWriteArrayList<Shape>();
@@ -207,7 +207,7 @@ public class Group extends Shape implements Container {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected final void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount, final Vec4f rgba) {
- final PMVMatrix pmv = renderer.getMatrix();
+ final PMVMatrix4f pmv = renderer.getMatrix();
final Object[] shapesS = shapes.toArray();
Arrays.sort(shapesS, (Comparator)Shape.ZAscendingComparator);
@@ -215,8 +215,8 @@ public class Group extends Shape implements Container {
for(int i=0; i<shapeCount; i++) {
final Shape shape = (Shape) shapesS[i];
if( shape.isEnabled() ) {
- pmv.glPushMatrix();
- shape.setTransform(pmv);
+ pmv.pushMv();
+ shape.setMvTransform(pmv);
if( !doFrustumCulling || !pmv.getFrustum().isAABBoxOutside( shape.getBounds() ) ) {
if( null == rgba ) {
@@ -225,7 +225,7 @@ public class Group extends Shape implements Container {
shape.draw(gl, renderer, sampleCount);
}
}
- pmv.glPopMatrix();
+ pmv.popMv();
}
}
if( null != border ) {
@@ -257,7 +257,7 @@ public class Group extends Shape implements Container {
GraphShape firstGS = null;
// box has been reset
- final PMVMatrix pmv = new PMVMatrix();
+ final PMVMatrix4f pmv = new PMVMatrix4f();
if( null != layouter ) {
for(final Shape s : shapes) {
if( needsRMs && null == firstGS && s instanceof GraphShape ) {
@@ -282,10 +282,10 @@ public class Group extends Shape implements Container {
} else {
s.validate(glp);
}
- pmv.glPushMatrix();
- s.setTransform(pmv);
- s.getBounds().transformMv(pmv, tsbox);
- pmv.glPopMatrix();
+ pmv.pushMv();
+ s.setMvTransform(pmv);
+ s.getBounds().transform(pmv.getMv(), tsbox);
+ pmv.popMv();
box.resize(tsbox);
}
}
@@ -329,15 +329,15 @@ public class Group extends Shape implements Container {
}
@Override
- public AABBox getBounds(final PMVMatrix pmv, final Shape shape) {
+ public AABBox getBounds(final PMVMatrix4f pmv, final Shape shape) {
pmv.reset();
- setTransform(pmv);
+ setMvTransform(pmv);
final AABBox res = new AABBox();
if( null == shape ) {
return res;
}
forOne(pmv, shape, () -> {
- shape.getBounds().transformMv(pmv, res);
+ shape.getBounds().transform(pmv.getMv(), res);
});
return res;
}
@@ -348,7 +348,7 @@ public class Group extends Shape implements Container {
}
@Override
- public boolean forOne(final PMVMatrix pmv, final Shape shape, final Runnable action) {
+ public boolean forOne(final PMVMatrix4f pmv, final Shape shape, final Runnable action) {
return TreeTool.forOne(shapes, pmv, shape, action);
}
@@ -358,12 +358,12 @@ public class Group extends Shape implements Container {
}
@Override
- public boolean forAll(final PMVMatrix pmv, final Visitor2 v) {
+ public boolean forAll(final PMVMatrix4f pmv, final Visitor2 v) {
return TreeTool.forAll(shapes, pmv, v);
}
@Override
- public boolean forSortedAll(final Comparator<Shape> sortComp, final PMVMatrix pmv, final Visitor2 v) {
+ public boolean forSortedAll(final Comparator<Shape> sortComp, final PMVMatrix4f pmv, final Visitor2 v) {
return TreeTool.forSortedAll(sortComp, shapes, pmv, v);
}
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index c9b28b78a..53ee7537e 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -52,7 +52,13 @@ import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.ui.Shape.Visitor2;
-import com.jogamp.graph.ui.Scene.PMVMatrixSetup;
+import com.jogamp.math.FloatUtil;
+import com.jogamp.math.Ray;
+import com.jogamp.math.Recti;
+import com.jogamp.math.Vec2f;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.graph.ui.Shape.Visitor1;
import com.jogamp.newt.event.GestureHandler;
import com.jogamp.newt.event.InputEvent;
@@ -61,15 +67,8 @@ import com.jogamp.newt.event.MouseListener;
import com.jogamp.newt.event.PinchToZoomGesture;
import com.jogamp.newt.event.GestureHandler.GestureEvent;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.Ray;
-import com.jogamp.opengl.math.Recti;
-import com.jogamp.opengl.math.Vec2f;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.GLPixelStorageModes;
import com.jogamp.opengl.util.GLReadBufferUtil;
-import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.texture.TextureSequence;
import jogamp.graph.ui.TreeTool;
@@ -93,7 +92,7 @@ import jogamp.graph.ui.TreeTool;
* - {@link GLEventListener#dispose(GLAutoDrawable)}
* </p>
* <p>
- * {@link #setPMVMatrixSetup(PMVMatrixSetup)} maybe used to provide a custom {@link PMVMatrix} setup.
+ * {@link #setPMVMatrixSetup(PMVMatrixSetup)} maybe used to provide a custom {@link PMVMatrix4f} setup.
* </p>
* @see Shape
*/
@@ -141,7 +140,7 @@ public final class Scene implements Container, GLEventListener {
private final int[] sampleCount = new int[1];
- /** Describing the bounding box in shape's object model-coordinates of the near-plane parallel at its scene-distance, post {@link #translate(PMVMatrix)} */
+ /** Describing the bounding box in shape's object model-coordinates of the near-plane parallel at its scene-distance, post {@link #translate(PMVMatrix4f)} */
private final AABBox planeBox = new AABBox(0f, 0f, 0f, 0f, 0f, 0f);
private volatile Shape activeShape = null;
@@ -395,13 +394,13 @@ public final class Scene implements Container, GLEventListener {
}
/**
- * Reshape scene using {@link #setupMatrix(PMVMatrix, int, int, int, int)} using {@link PMVMatrixSetup}.
+ * Reshape scene using {@link #setupMatrix(PMVMatrix4f, int, int, int, int)} using {@link PMVMatrixSetup}.
* <p>
* {@inheritDoc}
* </p>
* @see PMVMatrixSetup
* @see #setPMVMatrixSetup(PMVMatrixSetup)
- * @see #setupMatrix(PMVMatrix, int, int, int, int)
+ * @see #setupMatrix(PMVMatrix4f, int, int, int, int)
* @see #getBounds()
* @see #getBoundsCenter()
*/
@@ -440,8 +439,7 @@ public final class Scene implements Container, GLEventListener {
sampleCount0 = sampleCount;
}
- final PMVMatrix pmv = renderer.getMatrix();
- pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ final PMVMatrix4f pmv = renderer.getMatrix();
if( glSelect ) {
renderer.enable(gl, true, RegionRenderer.defaultBlendDisable, RegionRenderer.defaultBlendDisable);
@@ -456,8 +454,8 @@ public final class Scene implements Container, GLEventListener {
final Shape shape = (Shape)shapes[i];
// System.err.println("Id "+i+": "+uiShape);
if( shape.isEnabled() ) {
- pmv.glPushMatrix();
- shape.setTransform(pmv);
+ pmv.pushMv();
+ shape.setMvTransform(pmv);
if( !doFrustumCulling || !pmv.getFrustum().isAABBoxOutside( shape.getBounds() ) ) {
if( glSelect ) {
@@ -470,7 +468,7 @@ public final class Scene implements Container, GLEventListener {
shape.draw(gl, renderer, sampleCount0);
}
}
- pmv.glPopMatrix();
+ pmv.popMv();
}
}
if( glSelect ) {
@@ -537,8 +535,8 @@ public final class Scene implements Container, GLEventListener {
* <p>
* Method performs on current thread and returns after probing every {@link Shape}.
* </p>
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link Shape#setTransform(PMVMatrix) shape-transformed} and can be reused by the caller and runnable.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link Shape#setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller and runnable.
* @param glWinX window X coordinate, bottom-left origin
* @param glWinY window Y coordinate, bottom-left origin
* @param objPos storage for found object position in model-space of found {@link Shape}
@@ -546,7 +544,7 @@ public final class Scene implements Container, GLEventListener {
* @param runnable the action to perform if {@link Shape} was found
* @return picked Shape if any or null as stored in {@code shape}
*/
- public Shape pickShape(final PMVMatrix pmv, final int glWinX, final int glWinY, final Vec3f objPos, final Shape[] shape, final Runnable runnable) {
+ public Shape pickShape(final PMVMatrix4f pmv, final int glWinX, final int glWinY, final Vec3f objPos, final Shape[] shape, final Runnable runnable) {
setupMatrix(pmv);
final float winZ0 = 0f;
@@ -560,8 +558,8 @@ public final class Scene implements Container, GLEventListener {
final Ray ray = new Ray();
shape[0] = null;
- forSortedAll(Shape.ZAscendingComparator, pmv, (final Shape s, final PMVMatrix pmv2) -> {
- final boolean ok = s.isInteractive() && pmv.gluUnProjectRay(glWinX, glWinY, winZ0, winZ1, viewport, ray);
+ forSortedAll(Shape.ZAscendingComparator, pmv, (final Shape s, final PMVMatrix4f pmv2) -> {
+ final boolean ok = s.isInteractive() && pmv.mapWinToRay(glWinX, glWinY, winZ0, winZ1, viewport, ray);
if( ok ) {
final AABBox sbox = s.getBounds();
if( sbox.intersectsRay(ray) ) {
@@ -604,11 +602,11 @@ public final class Scene implements Container, GLEventListener {
final Shape s = pickShapeGLImpl(drawable, glWinX, glWinY);
shape[0] = s;
if( null != s ) {
- final PMVMatrix pmv = renderer.getMatrix();
- pmv.glPushMatrix();
- s.setTransform(pmv);
+ final PMVMatrix4f pmv = renderer.getMatrix();
+ pmv.pushMv();
+ s.setMvTransform(pmv);
final boolean ok = null != shape[0].winToShapeCoord(getMatrix(), getViewport(), glWinX, glWinY, objPos);
- pmv.glPopMatrix();
+ pmv.popMv();
if( ok ) {
runnable.run();
}
@@ -661,12 +659,12 @@ public final class Scene implements Container, GLEventListener {
* @param shape
* @param glWinX in GL window coordinates, origin bottom-left
* @param glWinY in GL window coordinates, origin bottom-left
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link Shape#setTransform(PMVMatrix) shape-transformed} and can be reused by the caller and runnable.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link Shape#setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller and runnable.
* @param objPos resulting object position
* @param runnable action
*/
- public void winToShapeCoord(final Shape shape, final int glWinX, final int glWinY, final PMVMatrix pmv, final Vec3f objPos, final Runnable runnable) {
+ public void winToShapeCoord(final Shape shape, final int glWinX, final int glWinY, final PMVMatrix4f pmv, final Vec3f objPos, final Runnable runnable) {
if( null == shape ) {
return;
}
@@ -680,38 +678,38 @@ public final class Scene implements Container, GLEventListener {
}
@Override
- public AABBox getBounds(final PMVMatrix pmv, final Shape shape) {
+ public AABBox getBounds(final PMVMatrix4f pmv, final Shape shape) {
final AABBox res = new AABBox();
if( null == shape ) {
return res;
}
setupMatrix(pmv);
forOne(pmv, shape, () -> {
- shape.getBounds().transformMv(pmv, res);
+ shape.getBounds().transform(pmv.getMv(), res);
});
return res;
}
/**
* Traverses through the graph up until {@code shape} and apply {@code action} on it.
- * @param pmv {@link PMVMatrix}, which shall be properly initialized, e.g. via {@link Scene#setupMatrix(PMVMatrix)}
+ * @param pmv {@link PMVMatrix4f}, which shall be properly initialized, e.g. via {@link Scene#setupMatrix(PMVMatrix4f)}
* @param shape
* @param action
* @return true to signal operation complete, i.e. {@code shape} found, otherwise false
*/
@Override
- public boolean forOne(final PMVMatrix pmv, final Shape shape, final Runnable action) {
+ public boolean forOne(final PMVMatrix4f pmv, final Shape shape, final Runnable action) {
return TreeTool.forOne(shapes, pmv, shape, action);
}
/**
- * Traverses through the graph and apply {@link Visitor2#visit(Shape, PMVMatrix)} for each, stop if it returns true.
- * @param pmv {@link PMVMatrix}, which shall be properly initialized, e.g. via {@link Scene#setupMatrix(PMVMatrix)}
+ * Traverses through the graph and apply {@link Visitor2#visit(Shape, PMVMatrix4f)} for each, stop if it returns true.
+ * @param pmv {@link PMVMatrix4f}, which shall be properly initialized, e.g. via {@link Scene#setupMatrix(PMVMatrix4f)}
* @param v
- * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false
+ * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix4f)} returned true, otherwise false
*/
@Override
- public boolean forAll(final PMVMatrix pmv, final Visitor2 v) {
+ public boolean forAll(final PMVMatrix4f pmv, final Visitor2 v) {
return TreeTool.forAll(shapes, pmv, v);
}
@@ -726,27 +724,27 @@ public final class Scene implements Container, GLEventListener {
}
/**
- * Traverses through the graph and apply {@link Visitor#visit(Shape, PMVMatrix)} for each, stop if it returns true.
+ * Traverses through the graph and apply {@link Visitor#visit(Shape, PMVMatrix4f)} for each, stop if it returns true.
*
* Each {@link Container} level is sorted using {@code sortComp}
* @param sortComp
* @param pmv
* @param v
- * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false
+ * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix4f)} returned true, otherwise false
*/
@Override
- public boolean forSortedAll(final Comparator<Shape> sortComp, final PMVMatrix pmv, final Visitor2 v) {
+ public boolean forSortedAll(final Comparator<Shape> sortComp, final PMVMatrix4f pmv, final Visitor2 v) {
return TreeTool.forSortedAll(sortComp, shapes, pmv, v);
}
/**
- * Interface providing {@link #set(PMVMatrix, Recti) a method} to
- * setup {@link PMVMatrix}'s {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}.
+ * Interface providing {@link #set(PMVMatrix4f, Recti) a method} to
+ * setup {@link PMVMatrix4f}'s {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}.
* <p>
* At the end of operations, the {@link GLMatrixFunc#GL_MODELVIEW} matrix has to be selected.
* </p>
* <p>
- * Implementation is being called by {@link Scene#setupMatrix(PMVMatrix, int, int, int, int)}
+ * Implementation is being called by {@link Scene#setupMatrix(PMVMatrix4f, int, int, int, int)}
* and hence {@link Scene#reshape(GLAutoDrawable, int, int, int, int)}.
* </p>
* <p>
@@ -768,28 +766,28 @@ public final class Scene implements Container, GLEventListener {
float getZFar();
/**
- * Setup {@link PMVMatrix}'s {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}.
+ * Setup {@link PMVMatrix4f}'s {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}.
* <p>
* See {@link PMVMatrixSetup} for details.
* </p>
* <p>
* At the end of operations, the {@link GLMatrixFunc#GL_MODELVIEW} matrix is selected.
* </p>
- * @param pmv the {@link PMVMatrix} to setup
+ * @param pmv the {@link PMVMatrix4f} to setup
* @param viewport Rect4i viewport
*/
- void set(PMVMatrix pmv, Recti viewport);
+ void set(PMVMatrix4f pmv, Recti viewport);
/**
* Optional method to set the {@link Scene#getBounds()} {@link AABBox}, maybe a {@code nop} if not desired.
* <p>
- * Will be called by {@link Scene#reshape(GLAutoDrawable, int, int, int, int)} after {@link #set(PMVMatrix, Recti)}.
+ * Will be called by {@link Scene#reshape(GLAutoDrawable, int, int, int, int)} after {@link #set(PMVMatrix4f, Recti)}.
* </p>
* @param planeBox the {@link AABBox} to define
- * @param pmv the {@link PMVMatrix}, already setup via {@link #set(PMVMatrix, Recti)}.
+ * @param pmv the {@link PMVMatrix4f}, already setup via {@link #set(PMVMatrix4f, Recti)}.
* @param viewport Rect4i viewport
*/
- void setPlaneBox(final AABBox planeBox, final PMVMatrix pmv, Recti viewport);
+ void setPlaneBox(final AABBox planeBox, final PMVMatrix4f pmv, Recti viewport);
}
/** Return the default or {@link #setPMVMatrixSetup(PMVMatrixSetup)} {@link PMVMatrixSetup}. */
@@ -799,21 +797,21 @@ public final class Scene implements Container, GLEventListener {
public final void setPMVMatrixSetup(final PMVMatrixSetup setup) { pmvMatrixSetup = setup; }
/**
- * Setup {@link PMVMatrix} {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}
- * by calling {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#set(PMVMatrix, Recti)}.
- * @param pmv the {@link PMVMatrix} to setup
+ * Setup {@link PMVMatrix4f} {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}
+ * by calling {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
+ * @param pmv the {@link PMVMatrix4f} to setup
* @param Recti viewport
*/
- public void setupMatrix(final PMVMatrix pmv, final Recti viewport) {
+ public void setupMatrix(final PMVMatrix4f pmv, final Recti viewport) {
pmvMatrixSetup.set(pmv, viewport);
}
/**
- * Setup {@link PMVMatrix} {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}
- * using implicit {@link #getViewport()} surface dimension by calling {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#set(PMVMatrix, Recti)}.
- * @param pmv the {@link PMVMatrix} to setup
+ * Setup {@link PMVMatrix4f} {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}
+ * using implicit {@link #getViewport()} surface dimension by calling {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#set(PMVMatrix4f, Recti)}.
+ * @param pmv the {@link PMVMatrix4f} to setup
*/
- public void setupMatrix(final PMVMatrix pmv) {
+ public void setupMatrix(final PMVMatrix4f pmv) {
final Recti viewport = renderer.getViewport();
setupMatrix(pmv, viewport);
}
@@ -829,8 +827,8 @@ public final class Scene implements Container, GLEventListener {
/** Returns the {@link #getViewport()}'s height, set after initial {@link #reshape(GLAutoDrawable, int, int, int, int)}. */
public int getHeight() { return renderer.getHeight(); }
- /** Borrow the current {@link PMVMatrix}. */
- public PMVMatrix getMatrix() { return renderer.getMatrix(); }
+ /** Borrow the current {@link PMVMatrix4f}. */
+ public PMVMatrix4f getMatrix() { return renderer.getMatrix(); }
/**
* Describing the scene's object model-dimensions of the plane at scene-distance covering the visible viewport rectangle.
@@ -841,7 +839,7 @@ public final class Scene implements Container, GLEventListener {
* {@link AABBox#getWidth()} and {@link AABBox#getHeight()} define scene's dimension covered by surface size.
* </p>
* <p>
- * {@link AABBox} is setup via {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#setPlaneBox(AABBox, PMVMatrix, Recti)}.
+ * {@link AABBox} is setup via {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#setPlaneBox(AABBox, PMVMatrix4f, Recti)}.
* </p>
* <p>
* The default {@link PMVMatrixSetup} implementation scales to normalized plane dimensions, 1 for the greater of width and height.
@@ -870,12 +868,12 @@ public final class Scene implements Container, GLEventListener {
* @param objPos float[3] storage for object coord result
* @param winZ
*/
- public static void winToPlaneCoord(final PMVMatrix pmv, final Recti viewport,
+ public static void winToPlaneCoord(final PMVMatrix4f pmv, final Recti viewport,
final float zNear, final float zFar,
final float winX, final float winY, final float objOrthoZ,
final Vec3f objPos) {
final float winZ = FloatUtil.getOrthoWinZ(objOrthoZ, zNear, zFar);
- pmv.gluUnProject(winX, winY, winZ, viewport, objPos);
+ pmv.mapWinToObj(winX, winY, winZ, viewport, objPos);
}
/**
@@ -888,7 +886,7 @@ public final class Scene implements Container, GLEventListener {
* @param objSceneSize Vec2f storage for object surface size result
*/
public void surfaceToPlaneSize(final Recti viewport, final float zNear, final float zFar, final float objOrthoDist, final Vec2f objSceneSize) {
- final PMVMatrix pmv = new PMVMatrix();
+ final PMVMatrix4f pmv = new PMVMatrix4f();
setupMatrix(pmv, viewport);
{
final Vec3f obj00Coord = new Vec3f();
@@ -935,7 +933,7 @@ public final class Scene implements Container, GLEventListener {
// flip to GL window coordinates
final int glWinX = e.getX();
final int glWinY = getHeight() - e.getY() - 1;
- final PMVMatrix pmv = new PMVMatrix();
+ final PMVMatrix4f pmv = new PMVMatrix4f();
final Vec3f objPos = new Vec3f();
winToShapeCoord(shape, glWinX, glWinY, pmv, objPos, () -> {
shape.dispatchGestureEvent(gh, glWinX, glWinY, pmv, renderer.getViewport(), objPos);
@@ -966,7 +964,7 @@ public final class Scene implements Container, GLEventListener {
* @param glWinY in GL window coordinates, origin bottom-left
*/
final void dispatchMouseEventPickShape(final MouseEvent e, final int glWinX, final int glWinY) {
- final PMVMatrix pmv = new PMVMatrix();
+ final PMVMatrix4f pmv = new PMVMatrix4f();
final Vec3f objPos = new Vec3f();
final Shape[] shape = { null };
if( null == pickShape(pmv, glWinX, glWinY, objPos, shape, () -> {
@@ -985,7 +983,7 @@ public final class Scene implements Container, GLEventListener {
* @param glWinY in GL window coordinates, origin bottom-left
*/
final void dispatchMouseEventForShape(final Shape shape, final MouseEvent e, final int glWinX, final int glWinY) {
- final PMVMatrix pmv = new PMVMatrix();
+ final PMVMatrix4f pmv = new PMVMatrix4f();
final Vec3f objPos = new Vec3f();
winToShapeCoord(shape, glWinX, glWinY, pmv, objPos, () -> { shape.dispatchMouseEvent(e, glWinX, glWinY, objPos); });
}
@@ -1199,7 +1197,7 @@ public final class Scene implements Container, GLEventListener {
/**
* Default implementation of {@link Scene.PMVMatrixSetup},
- * implementing {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti)} as follows:
+ * implementing {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)} as follows:
* <ul>
* <li>{@link GLMatrixFunc#GL_PROJECTION} Matrix
* <ul>
@@ -1279,19 +1277,17 @@ public final class Scene implements Container, GLEventListener {
}
@Override
- public void set(final PMVMatrix pmv, final Recti viewport) {
+ public void set(final PMVMatrix4f pmv, final Recti viewport) {
final float ratio = (float) viewport.width() / (float) viewport.height();
- pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmv.glLoadIdentity();
- pmv.gluPerspective(angle, ratio, zNear, zFar);
- pmv.glTranslatef(0f, 0f, scene_dist);
+ pmv.loadPIdentity();
+ pmv.perspectiveP(angle, ratio, zNear, zFar);
+ pmv.translateMv(0f, 0f, scene_dist);
- pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
+ pmv.loadMvIdentity();
}
@Override
- public void setPlaneBox(final AABBox planeBox, final PMVMatrix pmv, final Recti viewport) {
+ public void setPlaneBox(final AABBox planeBox, final PMVMatrix4f pmv, final Recti viewport) {
final float orthoDist = -scene_dist;
final Vec3f obj00Coord = new Vec3f();
final Vec3f obj11Coord = new Vec3f();
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
index 843c73384..cdec75019 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
@@ -36,6 +36,15 @@ import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.ui.layout.Padding;
+import com.jogamp.math.FloatUtil;
+import com.jogamp.math.Matrix4f;
+import com.jogamp.math.Quaternion;
+import com.jogamp.math.Recti;
+import com.jogamp.math.Vec2f;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.Vec4f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.newt.event.GestureHandler.GestureEvent;
import com.jogamp.newt.event.GestureHandler.GestureListener;
import com.jogamp.newt.event.MouseAdapter;
@@ -43,15 +52,6 @@ import com.jogamp.newt.event.NEWTEvent;
import com.jogamp.newt.event.PinchToZoomGesture;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.MouseListener;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.Matrix4f;
-import com.jogamp.opengl.math.Quaternion;
-import com.jogamp.opengl.math.Recti;
-import com.jogamp.opengl.math.Vec2f;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
-import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.PMVMatrix;
/**
* Generic Shape, potentially using a Graph via {@link GraphShape} or other means of representing content.
@@ -101,10 +101,10 @@ public abstract class Shape {
/**
* Visitor method
* @param s the {@link Shape} to process
- * @param pmv the {@link PMVMatrix} setup from the {@link Scene} down to the {@link Shape}
+ * @param pmv the {@link PMVMatrix4f} setup from the {@link Scene} down to the {@link Shape}
* @return true to signal operation complete and to stop traversal, otherwise false
*/
- boolean visit(Shape s, final PMVMatrix pmv);
+ boolean visit(Shape s, final PMVMatrix4f pmv);
}
/**
@@ -283,7 +283,7 @@ public abstract class Shape {
public final void onToggle(final Listener l) { onToggleListener = l; }
public final void onClicked(final Listener l) { onClickedListener = l; }
- /** Move to scaled position. Position ends up in PMVMatrix unmodified. */
+ /** Move to scaled position. Position ends up in PMVMatrix4f unmodified. */
public final Shape moveTo(final float tx, final float ty, final float tz) {
position.set(tx, ty, tz);
if( null != onMoveListener ) {
@@ -292,7 +292,7 @@ public abstract class Shape {
return this;
}
- /** Move to scaled position. Position ends up in PMVMatrix unmodified. */
+ /** Move to scaled position. Position ends up in PMVMatrix4f unmodified. */
public final Shape moveTo(final Vec3f t) {
position.set(t);
if( null != onMoveListener ) {
@@ -301,7 +301,7 @@ public abstract class Shape {
return this;
}
- /** Move about scaled distance. Position ends up in PMVMatrix unmodified. */
+ /** Move about scaled distance. Position ends up in PMVMatrix4f unmodified. */
public final Shape move(final float dtx, final float dty, final float dtz) {
position.add(dtx, dty, dtz);
if( null != onMoveListener ) {
@@ -310,7 +310,7 @@ public abstract class Shape {
return this;
}
- /** Move about scaled distance. Position ends up in PMVMatrix unmodified. */
+ /** Move about scaled distance. Position ends up in PMVMatrix4f unmodified. */
public final Shape move(final Vec3f dt) {
position.add(dt);
if( null != onMoveListener ) {
@@ -501,7 +501,7 @@ public abstract class Shape {
/**
* Renders the shape.
* <p>
- * {@link #setTransform(PMVMatrix)} is expected to be completed beforehand.
+ * {@link #setMvTransform(PMVMatrix4f)} is expected to be completed beforehand.
* </p>
* @param gl the current GL object
* @param renderer {@link RegionRenderer} which might be used for Graph Curve Rendering, also source of {@link RegionRenderer#getMatrix()} and {@link RegionRenderer#getViewport()}.
@@ -586,7 +586,7 @@ public abstract class Shape {
}
/**
- * Setup the pre-selected {@link GLMatrixFunc#GL_MODELVIEW} {@link PMVMatrix} for this object.
+ * Setup the {@link PMVMatrix4f#getMv() modelview matrix} of the given {@link PMVMatrix4f} for this object.
* - Scale shape from its center position
* - Rotate shape around optional scaled pivot, see {@link #setRotationPivot(float[])}), otherwise rotate around its scaled center (default)
* <p>
@@ -598,98 +598,98 @@ public abstract class Shape {
* @see #moveTo(float, float, float)
* @see #setScale(float, float, float)
*/
- public void setTransform(final PMVMatrix pmv) {
+ public void setMvTransform(final PMVMatrix4f pmv) {
final boolean hasScale = !scale.isEqual(Vec3f.ONE);
final boolean hasRotate = !rotation.isIdentity();
final boolean hasRotPivot = null != rotPivot;
final Vec3f ctr = box.getCenter();
final boolean sameScaleRotatePivot = hasScale && hasRotate && ( !hasRotPivot || rotPivot.isEqual(ctr) );
- pmv.glTranslatef(position.x(), position.y(), position.z()); // translate, scaled
+ pmv.translateMv(position.x(), position.y(), position.z()); // translate, scaled
if( sameScaleRotatePivot ) {
// Scale shape from its center position and rotate around its center
- pmv.glTranslatef(ctr.x()*scale.x(), ctr.y()*scale.y(), ctr.z()*scale.z()); // add-back center, scaled
- pmv.glRotate(rotation);
- pmv.glScalef(scale.x(), scale.y(), scale.z());
- pmv.glTranslatef(-ctr.x(), -ctr.y(), -ctr.z()); // move to center
+ pmv.translateMv(ctr.x()*scale.x(), ctr.y()*scale.y(), ctr.z()*scale.z()); // add-back center, scaled
+ pmv.rotateMv(rotation);
+ pmv.scaleMv(scale.x(), scale.y(), scale.z());
+ pmv.translateMv(-ctr.x(), -ctr.y(), -ctr.z()); // move to center
} else if( hasRotate || hasScale ) {
if( hasRotate ) {
if( hasRotPivot ) {
// Rotate shape around its scaled pivot
- pmv.glTranslatef(rotPivot.x()*scale.x(), rotPivot.y()*scale.y(), rotPivot.z()*scale.z()); // pivot back from rot-pivot, scaled
- pmv.glRotate(rotation);
- pmv.glTranslatef(-rotPivot.x()*scale.x(), -rotPivot.y()*scale.y(), -rotPivot.z()*scale.z()); // pivot to rot-pivot, scaled
+ pmv.translateMv(rotPivot.x()*scale.x(), rotPivot.y()*scale.y(), rotPivot.z()*scale.z()); // pivot back from rot-pivot, scaled
+ pmv.rotateMv(rotation);
+ pmv.translateMv(-rotPivot.x()*scale.x(), -rotPivot.y()*scale.y(), -rotPivot.z()*scale.z()); // pivot to rot-pivot, scaled
} else {
// Rotate shape around its scaled center
- pmv.glTranslatef(ctr.x()*scale.x(), ctr.y()*scale.y(), ctr.z()*scale.z()); // pivot back from center-pivot, scaled
- pmv.glRotate(rotation);
- pmv.glTranslatef(-ctr.x()*scale.x(), -ctr.y()*scale.y(), -ctr.z()*scale.z()); // pivot to center-pivot, scaled
+ pmv.translateMv(ctr.x()*scale.x(), ctr.y()*scale.y(), ctr.z()*scale.z()); // pivot back from center-pivot, scaled
+ pmv.rotateMv(rotation);
+ pmv.translateMv(-ctr.x()*scale.x(), -ctr.y()*scale.y(), -ctr.z()*scale.z()); // pivot to center-pivot, scaled
}
}
if( hasScale ) {
// Scale shape from its center position
- pmv.glTranslatef(ctr.x()*scale.x(), ctr.y()*scale.y(), ctr.z()*scale.z()); // add-back center, scaled
- pmv.glScalef(scale.x(), scale.y(), scale.z());
- pmv.glTranslatef(-ctr.x(), -ctr.y(), -ctr.z()); // move to center
+ pmv.translateMv(ctr.x()*scale.x(), ctr.y()*scale.y(), ctr.z()*scale.z()); // add-back center, scaled
+ pmv.scaleMv(scale.x(), scale.y(), scale.z());
+ pmv.translateMv(-ctr.x(), -ctr.y(), -ctr.z()); // move to center
}
}
}
/**
- * {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) Setup} the given {@link PMVMatrix}
- * and apply this shape's {@link #setTransform(PMVMatrix) transformation}.
+ * {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) Setup} the given {@link PMVMatrix4f}
+ * and apply this shape's {@link #setMvTransform(PMVMatrix4f) transformation}.
* </p>
- * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} given {@link PMVMatrix} {@code pmv}.
- * @param viewport used viewport for {@link PMVMatrix#gluProject(float, float, float, int[], float[])}
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
- * @return the given {@link PMVMatrix} for chaining
- * @see Scene.PMVMatrixSetup#set(PMVMatrix, Recti)
- * @see #setTransform(PMVMatrix)
- * @see #setPMVMatrix(Scene, PMVMatrix)
- */
- public PMVMatrix setPMVMatrix(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final PMVMatrix pmv) {
+ * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} given {@link PMVMatrix4f} {@code pmv}.
+ * @param viewport used viewport for {@link PMVMatrix4f#mapObjToWin(Vec3f, Recti, Vec3f)}
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
+ * @return the given {@link PMVMatrix4f} for chaining
+ * @see Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)
+ * @see #setMvTransform(PMVMatrix4f)
+ * @see #setPMVMatrix(Scene, PMVMatrix4f)
+ */
+ public PMVMatrix4f setPMVMatrix(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final PMVMatrix4f pmv) {
pmvMatrixSetup.set(pmv, viewport);
- setTransform(pmv);
+ setMvTransform(pmv);
return pmv;
}
/**
- * {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) Setup} the given {@link PMVMatrix}
- * and apply this shape's {@link #setTransform(PMVMatrix) transformation}.
+ * {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) Setup} the given {@link PMVMatrix4f}
+ * and apply this shape's {@link #setMvTransform(PMVMatrix4f) transformation}.
* </p>
* @param scene {@link Scene} to retrieve {@link Scene.PMVMatrixSetup} and the viewport.
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
- * @return the given {@link PMVMatrix} for chaining
- * @see Scene.PMVMatrixSetup#set(PMVMatrix, Recti)
- * @see #setTransform(PMVMatrix)
- * @see #setPMVMatrix(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix)
- */
- public PMVMatrix setPMVMatrix(final Scene scene, final PMVMatrix pmv) {
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
+ * @return the given {@link PMVMatrix4f} for chaining
+ * @see Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti)
+ * @see #setMvTransform(PMVMatrix4f)
+ * @see #setPMVMatrix(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix4f)
+ */
+ public PMVMatrix4f setPMVMatrix(final Scene scene, final PMVMatrix4f pmv) {
return setPMVMatrix(scene.getPMVMatrixSetup(), scene.getViewport(), pmv);
}
/**
* Retrieve surface (view) port of this shape, i.e. lower x/y position and size.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * including this shape's {@link #setTransform(PMVMatrix)}. See {@link #setPMVMatrix(Scene, PMVMatrix)}.
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link #setPMVMatrix(Scene, PMVMatrix4f)}.
* </p>
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix4f)}.
* @param viewport the int[4] viewport
* @param surfacePort Recti target surface port
- * @return given Recti {@code surfacePort} for successful gluProject(..) operation, otherwise {@code null}
+ * @return given Recti {@code surfacePort} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
*/
- public Recti getSurfacePort(final PMVMatrix pmv, final Recti viewport, final Recti surfacePort) {
+ public Recti getSurfacePort(final PMVMatrix4f pmv, final Recti viewport, final Recti surfacePort) {
final Vec3f winCoordHigh = new Vec3f();
final Vec3f winCoordLow = new Vec3f();
final Vec3f high = box.getHigh();
final Vec3f low = box.getLow();
- final Matrix4f matPMv = pmv.getPMvMat();
+ final Matrix4f matPMv = pmv.getPMv();
if( Matrix4f.mapObjToWin(high, matPMv, viewport, winCoordHigh) ) {
if( Matrix4f.mapObjToWin(low, matPMv, viewport, winCoordLow) ) {
surfacePort.setX( (int)Math.abs( winCoordLow.x() ) );
@@ -705,25 +705,25 @@ public abstract class Shape {
/**
* Retrieve surface (view) size in pixels of this shape.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * including this shape's {@link #setTransform(PMVMatrix)}. See {@link #setPMVMatrix(Scene, PMVMatrix)}.
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link #setPMVMatrix(Scene, PMVMatrix4f)}.
* </p>
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix4f)}.
* @param viewport the int[4] viewport
* @param surfaceSize int[2] target surface size
- * @return given int[2] {@code surfaceSize} in pixels for successful gluProject(..) operation, otherwise {@code null}
- * @see #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
- * @see #getSurfaceSize(Scene, PMVMatrix, int[])
+ * @return given int[2] {@code surfaceSize} in pixels for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
+ * @see #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix4f, int[])
+ * @see #getSurfaceSize(Scene, PMVMatrix4f, int[])
*/
- public int[/*2*/] getSurfaceSize(final PMVMatrix pmv, final Recti viewport, final int[/*2*/] surfaceSize) {
+ public int[/*2*/] getSurfaceSize(final PMVMatrix4f pmv, final Recti viewport, final int[/*2*/] surfaceSize) {
// System.err.println("Shape::getSurfaceSize.VP "+viewport[0]+"/"+viewport[1]+" "+viewport[2]+"x"+viewport[3]);
final Vec3f winCoordHigh = new Vec3f();
final Vec3f winCoordLow = new Vec3f();
final Vec3f high = box.getHigh();
final Vec3f low = box.getLow();
- final Matrix4f matPMv = pmv.getPMvMat();
+ final Matrix4f matPMv = pmv.getPMv();
if( Matrix4f.mapObjToWin(high, matPMv, viewport, winCoordHigh) ) {
if( Matrix4f.mapObjToWin(low, matPMv, viewport, winCoordLow) ) {
surfaceSize[0] = (int)Math.abs(winCoordHigh.x() - winCoordLow.x());
@@ -737,47 +737,47 @@ public abstract class Shape {
/**
* Retrieve surface (view) size in pixels of this shape.
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
- * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} given {@link PMVMatrix} {@code pmv}.
- * @param viewport used viewport for {@link PMVMatrix#gluProject(float, float, float, int[], float[])}
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} given {@link PMVMatrix4f} {@code pmv}.
+ * @param viewport used viewport for {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)}
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param surfaceSize int[2] target surface size
- * @return given int[2] {@code surfaceSize} in pixels for successful gluProject(..) operation, otherwise {@code null}
- * @see #getSurfaceSize(PMVMatrix, Recti, int[])
- * @see #getSurfaceSize(Scene, PMVMatrix, int[])
+ * @return given int[2] {@code surfaceSize} in pixels for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
+ * @see #getSurfaceSize(PMVMatrix4f, Recti, int[])
+ * @see #getSurfaceSize(Scene, PMVMatrix4f, int[])
*/
- public int[/*2*/] getSurfaceSize(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final PMVMatrix pmv, final int[/*2*/] surfaceSize) {
+ public int[/*2*/] getSurfaceSize(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final PMVMatrix4f pmv, final int[/*2*/] surfaceSize) {
return getSurfaceSize(setPMVMatrix(pmvMatrixSetup, viewport, pmv), viewport, surfaceSize);
}
/**
* Retrieve surface (view) size in pixels of this shape.
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
* @param scene {@link Scene} to retrieve {@link Scene.PMVMatrixSetup} and the viewport.
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param surfaceSize int[2] target surface size
- * @return given int[2] {@code surfaceSize} in pixels for successful gluProject(..) operation, otherwise {@code null}
- * @see #getSurfaceSize(PMVMatrix, Recti, int[])
- * @see #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
+ * @return given int[2] {@code surfaceSize} in pixels for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
+ * @see #getSurfaceSize(PMVMatrix4f, Recti, int[])
+ * @see #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix4f, int[])
*/
- public int[/*2*/] getSurfaceSize(final Scene scene, final PMVMatrix pmv, final int[/*2*/] surfaceSize) {
+ public int[/*2*/] getSurfaceSize(final Scene scene, final PMVMatrix4f pmv, final int[/*2*/] surfaceSize) {
return getSurfaceSize(scene.getPMVMatrixSetup(), scene.getViewport(), pmv, surfaceSize);
}
/**
* Retrieve pixel per scaled shape-coordinate unit, i.e. [px]/[obj].
- * @param shapeSizePx int[2] shape size in pixel as retrieved via e.g. {@link #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])}
+ * @param shapeSizePx int[2] shape size in pixel as retrieved via e.g. {@link #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix4f, int[])}
* @param pixPerShape float[2] pixel scaled per shape-coordinate unit result storage
* @return given float[2] {@code pixPerShape}
- * @see #getPixelPerShapeUnit(Scene, PMVMatrix, float[])
- * @see #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
+ * @see #getPixelPerShapeUnit(Scene, PMVMatrix4f, float[])
+ * @see #getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix4f, int[])
* @see #getScaledWidth()
* @see #getScaledHeight()
*/
@@ -790,20 +790,20 @@ public abstract class Shape {
/**
* Retrieve pixel per scaled shape-coordinate unit, i.e. [px]/[obj].
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * including this shape's {@link #setTransform(PMVMatrix)}. See {@link #setPMVMatrix(Scene, PMVMatrix)}.
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link #setPMVMatrix(Scene, PMVMatrix4f)}.
* </p>
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix4f)}.
* @param viewport the int[4] viewport
* @param pixPerShape float[2] pixel per scaled shape-coordinate unit result storage
- * @return given float[2] {@code pixPerShape} for successful gluProject(..) operation, otherwise {@code null}
+ * @return given float[2] {@code pixPerShape} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
* @see #getPixelPerShapeUnit(int[], float[])
- * @see #getSurfaceSize(Scene, PMVMatrix, int[])
+ * @see #getSurfaceSize(Scene, PMVMatrix4f, int[])
* @see #getScaledWidth()
* @see #getScaledHeight()
*/
- public float[] getPixelPerShapeUnit(final PMVMatrix pmv, final Recti viewport, final float[] pixPerShape) {
+ public float[] getPixelPerShapeUnit(final PMVMatrix4f pmv, final Recti viewport, final float[] pixPerShape) {
final int[] shapeSizePx = new int[2];
if( null != getSurfaceSize(pmv, viewport, shapeSizePx) ) {
return getPixelPerShapeUnit(shapeSizePx, pixPerShape);
@@ -815,20 +815,20 @@ public abstract class Shape {
/**
* Retrieve pixel per scaled shape-coordinate unit, i.e. [px]/[obj].
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
* @param scene {@link Scene} to retrieve {@link Scene.PMVMatrixSetup} and the viewport.
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param pixPerShape float[2] pixel per scaled shape-coordinate unit result storage
- * @return given float[2] {@code pixPerShape} for successful gluProject(..) operation, otherwise {@code null}
+ * @return given float[2] {@code pixPerShape} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
* @see #getPixelPerShapeUnit(int[], float[])
- * @see #getSurfaceSize(Scene, PMVMatrix, int[])
+ * @see #getSurfaceSize(Scene, PMVMatrix4f, int[])
* @see #getScaledWidth()
* @see #getScaledHeight()
*/
- public float[] getPixelPerShapeUnit(final Scene scene, final PMVMatrix pmv, final float[] pixPerShape) {
+ public float[] getPixelPerShapeUnit(final Scene scene, final PMVMatrix4f pmv, final float[] pixPerShape) {
final int[] shapeSizePx = new int[2];
if( null != getSurfaceSize(scene, pmv, shapeSizePx) ) {
return getPixelPerShapeUnit(shapeSizePx, pixPerShape);
@@ -840,23 +840,23 @@ public abstract class Shape {
/**
* Map given object coordinate relative to this shape to window coordinates.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * including this shape's {@link #setTransform(PMVMatrix)}. See {@link #setPMVMatrix(Scene, PMVMatrix)}.
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link #setPMVMatrix(Scene, PMVMatrix4f)}.
* </p>
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix4f)}.
* @param viewport the viewport
* @param objPos object position relative to this shape's center
* @param glWinPos int[2] target window position of objPos relative to this shape
- * @return given int[2] {@code glWinPos} for successful gluProject(..) operation, otherwise {@code null}
- * @see #shapeToWinCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, float[], PMVMatrix, int[])
- * @see #shapeToWinCoord(Scene, float[], PMVMatrix, int[])
+ * @return given int[2] {@code glWinPos} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
+ * @see #shapeToWinCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, float[], PMVMatrix4f, int[])
+ * @see #shapeToWinCoord(Scene, float[], PMVMatrix4f, int[])
*/
- public int[/*2*/] shapeToWinCoord(final PMVMatrix pmv, final Recti viewport, final Vec3f objPos, final int[/*2*/] glWinPos) {
+ public int[/*2*/] shapeToWinCoord(final PMVMatrix4f pmv, final Recti viewport, final Vec3f objPos, final int[/*2*/] glWinPos) {
// System.err.println("Shape::objToWinCoordgetSurfaceSize.VP "+viewport[0]+"/"+viewport[1]+" "+viewport[2]+"x"+viewport[3]);
final Vec3f winCoord = new Vec3f();
- if( pmv.gluProject(objPos, viewport, winCoord) ) {
+ if( pmv.mapObjToWin(objPos, viewport, winCoord) ) {
glWinPos[0] = (int)(winCoord.x());
glWinPos[1] = (int)(winCoord.y());
return glWinPos;
@@ -867,64 +867,66 @@ public abstract class Shape {
/**
* Map given object coordinate relative to this shape to window coordinates.
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
- * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} given {@link PMVMatrix} {@code pmv}.
- * @param viewport used viewport for {@link PMVMatrix#gluProject(Vec3f, Recti, Vec3f)}
+ * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} given {@link PMVMatrix4f} {@code pmv}.
+ * @param viewport used viewport for {@link PMVMatrix4f#mapObjToWin(Vec3f, Recti, Vec3f)}
* @param objPos object position relative to this shape's center
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param glWinPos int[2] target window position of objPos relative to this shape
- * @return given int[2] {@code glWinPos} for successful gluProject(..) operation, otherwise {@code null}
- * @see #shapeToWinCoord(PMVMatrix, Recti, float[], int[])
- * @see #shapeToWinCoord(Scene, float[], PMVMatrix, int[])
+ * @return given int[2] {@code glWinPos} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
+ * @see #shapeToWinCoord(PMVMatrix4f, Recti, float[], int[])
+ * @see #shapeToWinCoord(Scene, float[], PMVMatrix4f, int[])
*/
- public int[/*2*/] shapeToWinCoord(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final Vec3f objPos, final PMVMatrix pmv, final int[/*2*/] glWinPos) {
+ public int[/*2*/] shapeToWinCoord(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final Vec3f objPos, final PMVMatrix4f pmv, final int[/*2*/] glWinPos) {
return this.shapeToWinCoord(setPMVMatrix(pmvMatrixSetup, viewport, pmv), viewport, objPos, glWinPos);
}
/**
* Map given object coordinate relative to this shape to window coordinates.
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
* @param scene {@link Scene} to retrieve {@link Scene.PMVMatrixSetup} and the viewport.
* @param objPos object position relative to this shape's center
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param glWinPos int[2] target window position of objPos relative to this shape
- * @return given int[2] {@code glWinPos} for successful gluProject(..) operation, otherwise {@code null}
- * @see #shapeToWinCoord(PMVMatrix, Recti, float[], int[])
- * @see #shapeToWinCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, float[], PMVMatrix, int[])
+ * @return given int[2] {@code glWinPos} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)} operation, otherwise {@code null}
+ * @see #shapeToWinCoord(PMVMatrix4f, Recti, float[], int[])
+ * @see #shapeToWinCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, float[], PMVMatrix4f, int[])
*/
- public int[/*2*/] shapeToWinCoord(final Scene scene, final Vec3f objPos, final PMVMatrix pmv, final int[/*2*/] glWinPos) {
+ public int[/*2*/] shapeToWinCoord(final Scene scene, final Vec3f objPos, final PMVMatrix4f pmv, final int[/*2*/] glWinPos) {
return this.shapeToWinCoord(scene.getPMVMatrixSetup(), scene.getViewport(), objPos, pmv, glWinPos);
}
/**
* Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.
* <p>
- * The given {@link PMVMatrix} has to be setup properly for this object,
+ * The given {@link PMVMatrix4f} has to be setup properly for this object,
* i.e. its {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} for the surrounding scene
- * including this shape's {@link #setTransform(PMVMatrix)}. See {@link #setPMVMatrix(Scene, PMVMatrix)}.
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}. See {@link #setPMVMatrix(Scene, PMVMatrix4f)}.
* </p>
- * @param pmv well formed {@link PMVMatrix}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix)}.
+ * @param pmv well formed {@link PMVMatrix4f}, e.g. could have been setup via {@link Shape#setPMVMatrix(Scene, PMVMatrix4f)}.
* @param viewport the Rect4i viewport
* @param glWinX in GL window coordinates, origin bottom-left
* @param glWinY in GL window coordinates, origin bottom-left
* @param objPos target object position of glWinX/glWinY relative to this shape
- * @return given {@code objPos} for successful gluProject(..) and gluUnProject(..) operation, otherwise {@code null}
- * @see #winToShapeCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, int, int, PMVMatrix, float[])
- * @see #winToShapeCoord(Scene, int, int, PMVMatrix, float[])
+ * @return given {@code objPos} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)}
+ * and {@link Matrix4f#mapWinToObj(float, float, float, float, Matrix4f, Recti, Vec3f, Vec3f) gluUnProject(..)}
+ * operation, otherwise {@code null}
+ * @see #winToShapeCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, int, int, PMVMatrix4f, float[])
+ * @see #winToShapeCoord(Scene, int, int, PMVMatrix4f, float[])
*/
- public Vec3f winToShapeCoord(final PMVMatrix pmv, final Recti viewport, final int glWinX, final int glWinY, final Vec3f objPos) {
+ public Vec3f winToShapeCoord(final PMVMatrix4f pmv, final Recti viewport, final int glWinX, final int glWinY, final Vec3f objPos) {
final Vec3f ctr = box.getCenter();
- if( Matrix4f.mapObjToWin(ctr, pmv.getPMvMat(), viewport, objPos) ) {
+ if( Matrix4f.mapObjToWin(ctr, pmv.getPMv(), viewport, objPos) ) {
final float winZ = objPos.z();
- if( Matrix4f.mapWinToObj(glWinX, glWinY, winZ, pmv.getPMviMat(), viewport, objPos) ) {
+ if( Matrix4f.mapWinToObj(glWinX, glWinY, winZ, pmv.getPMvi(), viewport, objPos) ) {
return objPos;
}
}
@@ -934,41 +936,45 @@ public abstract class Shape {
/**
* Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
- * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} given {@link PMVMatrix} {@code pmv}.
- * @param viewport used viewport for {@link PMVMatrix#gluUnProject(float, float, float, Recti, Vec3f)}
+ * @param pmvMatrixSetup {@link Scene.PMVMatrixSetup} to {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} given {@link PMVMatrix4f} {@code pmv}.
+ * @param viewport used viewport for {@link PMVMatrix4f#mapWinToObj(float, float, float, Recti, Vec3f)}
* @param glWinX in GL window coordinates, origin bottom-left
* @param glWinY in GL window coordinates, origin bottom-left
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param objPos target object position of glWinX/glWinY relative to this shape
- * @return given {@code objPos} for successful gluProject(..) and gluUnProject(..) operation, otherwise {@code null}
- * @see #winToShapeCoord(PMVMatrix, Recti, int, int, float[])
- * @see #winToShapeCoord(Scene, int, int, PMVMatrix, float[])
+ * @return given {@code objPos} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)}
+ * and {@link Matrix4f#mapWinToObj(float, float, float, float, Matrix4f, Recti, Vec3f, Vec3f) gluUnProject(..)}
+ * operation, otherwise {@code null}
+ * @see #winToShapeCoord(PMVMatrix4f, Recti, int, int, float[])
+ * @see #winToShapeCoord(Scene, int, int, PMVMatrix4f, float[])
*/
- public Vec3f winToShapeCoord(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final int glWinX, final int glWinY, final PMVMatrix pmv, final Vec3f objPos) {
+ public Vec3f winToShapeCoord(final Scene.PMVMatrixSetup pmvMatrixSetup, final Recti viewport, final int glWinX, final int glWinY, final PMVMatrix4f pmv, final Vec3f objPos) {
return this.winToShapeCoord(setPMVMatrix(pmvMatrixSetup, viewport, pmv), viewport, glWinX, glWinY, objPos);
}
/**
* Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.
* <p>
- * The given {@link PMVMatrix} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) setup} properly for this shape
- * including this shape's {@link #setTransform(PMVMatrix)}.
+ * The given {@link PMVMatrix4f} will be {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) setup} properly for this shape
+ * including this shape's {@link #setMvTransform(PMVMatrix4f)}.
* </p>
* @param scene {@link Scene} to retrieve {@link Scene.PMVMatrixSetup} and the viewport.
* @param glWinX in GL window coordinates, origin bottom-left
* @param glWinY in GL window coordinates, origin bottom-left
- * @param pmv a new {@link PMVMatrix} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix, Recti) be setup},
- * {@link #setTransform(PMVMatrix) shape-transformed} and can be reused by the caller.
+ * @param pmv a new {@link PMVMatrix4f} which will {@link Scene.PMVMatrixSetup#set(PMVMatrix4f, Recti) be setup},
+ * {@link #setMvTransform(PMVMatrix4f) shape-transformed} and can be reused by the caller.
* @param objPos target object position of glWinX/glWinY relative to this shape
- * @return given {@code objPos} for successful gluProject(..) and gluUnProject(..) operation, otherwise {@code null}
- * @see #winToShapeCoord(PMVMatrix, Recti, int, int, float[])
- * @see #winToShapeCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, int, int, PMVMatrix, float[])
+ * @return given {@code objPos} for successful {@link Matrix4f#mapObjToWin(Vec3f, Matrix4f, Recti, Vec3f) gluProject(..)}
+ * and {@link Matrix4f#mapWinToObj(float, float, float, float, Matrix4f, Recti, Vec3f, Vec3f) gluUnProject(..)}
+ * operation, otherwise {@code null}
+ * @see #winToShapeCoord(PMVMatrix4f, Recti, int, int, float[])
+ * @see #winToShapeCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, int, int, PMVMatrix4f, float[])
*/
- public Vec3f winToShapeCoord(final Scene scene, final int glWinX, final int glWinY, final PMVMatrix pmv, final Vec3f objPos) {
+ public Vec3f winToShapeCoord(final Scene scene, final int glWinX, final int glWinY, final PMVMatrix4f pmv, final Vec3f objPos) {
return this.winToShapeCoord(scene.getPMVMatrixSetup(), scene.getViewport(), glWinX, glWinY, pmv, objPos);
}
@@ -1473,11 +1479,11 @@ public abstract class Shape {
* @param e original Newt {@link GestureEvent}
* @param glWinX x-position in OpenGL model space
* @param glWinY y-position in OpenGL model space
- * @param pmv well formed PMVMatrix for this shape
+ * @param pmv well formed PMVMatrix4f for this shape
* @param viewport the viewport
* @param objPos object position of mouse event relative to this shape
*/
- /* pp */ final void dispatchGestureEvent(final GestureEvent e, final int glWinX, final int glWinY, final PMVMatrix pmv, final Recti viewport, final Vec3f objPos) {
+ /* pp */ final void dispatchGestureEvent(final GestureEvent e, final int glWinX, final int glWinY, final PMVMatrix4f pmv, final Recti viewport, final Vec3f objPos) {
if( interactive && resizable && e instanceof PinchToZoomGesture.ZoomEvent ) {
final PinchToZoomGesture.ZoomEvent ze = (PinchToZoomGesture.ZoomEvent) e;
final float pixels = ze.getDelta() * ze.getScale(); //
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
index 05e3189ae..16e3441a3 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
@@ -31,11 +31,11 @@ import java.util.List;
import com.jogamp.graph.ui.Group;
import com.jogamp.graph.ui.Shape;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.Vec2f;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.math.FloatUtil;
+import com.jogamp.math.Vec2f;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.util.PMVMatrix4f;
/**
* GraphUI Stack {@link Group.Layout}.
@@ -171,7 +171,7 @@ public class BoxLayout implements Group.Layout {
}
@Override
- public void layout(final Group g, final AABBox box, final PMVMatrix pmv) {
+ public void layout(final Group g, final AABBox box, final PMVMatrix4f pmv) {
final boolean hasCellWidth = !FloatUtil.isZero(cellSize.x());
final boolean hasCellHeight = !FloatUtil.isZero(cellSize.y());
final boolean isCenteredHoriz = hasCellWidth && alignment.isSet(Alignment.Bit.CenterHoriz);
@@ -184,10 +184,10 @@ public class BoxLayout implements Group.Layout {
final Shape s = shapes.get(i);
// measure size
- pmv.glPushMatrix();
- s.setTransform(pmv);
- s.getBounds().transformMv(pmv, sbox);
- pmv.glPopMatrix();
+ pmv.pushMv();
+ s.setMvTransform(pmv);
+ s.getBounds().transform(pmv.getMv(), sbox);
+ pmv.popMv();
final int x = 0, y = 0;
if( TRACE_LAYOUT ) {
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java b/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java
index 61d93c03c..b29245ef0 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java
@@ -27,7 +27,7 @@
*/
package com.jogamp.graph.ui.layout;
-import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.math.FloatUtil;
/**
* GraphUI CSS property Gap, spacing between (grid) cells not belonging to the element.
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java
index 3afe093f3..aa5a24637 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java
@@ -31,11 +31,11 @@ import java.util.List;
import com.jogamp.graph.ui.Group;
import com.jogamp.graph.ui.Shape;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.Vec2f;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.math.FloatUtil;
+import com.jogamp.math.Vec2f;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.util.PMVMatrix4f;
/**
* GraphUI Grid {@link Group.Layout}.
@@ -159,9 +159,9 @@ public class GridLayout implements Group.Layout {
/** Returns given {@link Order}. */
public Order getOrder() { return order; }
- /** Returns column count after {@link #layout(Group, AABBox, PMVMatrix)}. */
+ /** Returns column count after {@link #layout(Group, AABBox, PMVMatrix4f)}. */
public int getColumnCount() { return col_count; }
- /** Returns row count after {@link #layout(Group, AABBox, PMVMatrix)}. */
+ /** Returns row count after {@link #layout(Group, AABBox, PMVMatrix4f)}. */
public int getRowCount() { return row_count; }
/** Returns the preset cell size */
public Vec2f getCellSize() { return cellSize; }
@@ -180,7 +180,7 @@ public class GridLayout implements Group.Layout {
}
@Override
- public void layout(final Group g, final AABBox box, final PMVMatrix pmv) {
+ public void layout(final Group g, final AABBox box, final PMVMatrix4f pmv) {
final boolean hasCellWidth = !FloatUtil.isZero(cellSize.x());
final boolean hasCellHeight = !FloatUtil.isZero(cellSize.y());
final boolean isCenteredHoriz = hasCellWidth && alignment.isSet(Alignment.Bit.CenterHoriz);
@@ -207,11 +207,11 @@ public class GridLayout implements Group.Layout {
for(int i=0; i < shapes.size(); ++i) {
final Shape s = shapes.get(i);
// measure size
- pmv.glPushMatrix();
- s.setTransform(pmv);
- final AABBox sbox = s.getBounds().transformMv(pmv, new AABBox());
+ pmv.pushMv();
+ s.setMvTransform(pmv);
+ final AABBox sbox = s.getBounds().transform(pmv.getMv(), new AABBox());
sboxes[i] = sbox;
- pmv.glPopMatrix();
+ pmv.popMv();
final float shapeWidthU = sbox.getWidth();
final float shapeHeightU = sbox.getHeight();
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java b/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java
index 72d366ae2..629d3bb7b 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java
@@ -27,7 +27,7 @@
*/
package com.jogamp.graph.ui.layout;
-import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.math.FloatUtil;
/**
* GraphUI CSS property Margin, space between or around elements and not included in the element's size.
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java b/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java
index 25caf57dc..f686e8498 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java
@@ -27,7 +27,7 @@
*/
package com.jogamp.graph.ui.layout;
-import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.math.FloatUtil;
/**
* GraphUI CSS property Padding, space belonging to the element and included in the element's size.
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
index 474cc0a6a..cdf6cb161 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
@@ -35,16 +35,16 @@ import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.TextRegionUtil;
import com.jogamp.graph.font.Font;
-import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.ui.GraphShape;
import com.jogamp.graph.ui.Scene;
import com.jogamp.graph.ui.Shape;
import com.jogamp.graph.ui.Scene.PMVMatrixSetup;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.Vec2f;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
-import com.jogamp.opengl.math.geom.AABBox;
+import com.jogamp.math.FloatUtil;
+import com.jogamp.math.Vec2f;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.Vec4f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.geom.plane.AffineTransform;
import com.jogamp.opengl.util.texture.TextureSequence;
import jogamp.graph.ui.shapes.Label0;
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
index ade147e50..4cdf4f613 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
@@ -34,12 +34,12 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.Font.Glyph;
-import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.math.Vec3f;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.geom.plane.AffineTransform;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.texture.TextureSequence;
/**
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
index 54105e85a..dbce45a6d 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
@@ -29,7 +29,6 @@ package com.jogamp.graph.ui.shapes;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.texture.TextureSequence;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
@@ -38,8 +37,9 @@ import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.TextRegionUtil;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.Font.Glyph;
-import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.math.geom.AABBox;
+import com.jogamp.math.geom.plane.AffineTransform;
/**
* A GraphUI text label {@link GraphShape}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java
index 7f9375fc6..02ecd406c 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Rectangle.java
@@ -32,9 +32,9 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.ui.GraphShape;
import com.jogamp.graph.ui.Shape;
+import com.jogamp.math.geom.AABBox;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.texture.TextureSequence;
/**