diff options
author | Sven Gothel <[email protected]> | 2023-04-18 05:15:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-18 05:15:16 +0200 |
commit | c65c750e032118f229050ff8e834961264ed0591 (patch) | |
tree | 8500286ca6086eb21a9b275ccd586185090b1500 /src/demos | |
parent | cd845589eea6c7773007e013bd5f2f37242cbe1a (diff) |
Graph + GraphUI: Consolidate Vertex: Drop SVertex and factory, use Vec[234]f instead of float[] and remove unused VectorUtil methods
After Matrix4f consolidation and proving same or better performance on non array types,
this enhances code readability, simplifies API, reduces bugs and may improve performance.
GraphUI:
- Have RoundButton as a functional class to make a round or rectangular backdrop,
i.e. impl. addShapeToRegion() via reused addRoundShapeToRegion()
Diffstat (limited to 'src/demos')
11 files changed, 15 insertions, 14 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java index 089731e40..6cb19101c 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java @@ -33,7 +33,7 @@ import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; - +import com.jogamp.opengl.math.Vec4f; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RenderState; @@ -92,7 +92,7 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 { outlineShape.closeLastOutline(true); region = GLRegion.create(glp, getRenderModes(), null); - region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new float[4]) : null); + region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new Vec4f()) : null); } @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java index bc7aebdec..404e502cf 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java @@ -32,7 +32,7 @@ import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; - +import com.jogamp.opengl.math.Vec4f; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RenderState; @@ -273,7 +273,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { break; } region = GLRegion.create(gl.getGLProfile(), getRenderModes(), null); - region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new float[4]) : null); + region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new Vec4f()) : null); } @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java index e65f74e57..5e2ac39ca 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java @@ -32,8 +32,6 @@ import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.util.MiscUtils; import com.jogamp.graph.curve.Region; -import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.WindowAdapter; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java index 5dd5afc35..4cd5cd49b 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java @@ -53,6 +53,7 @@ import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.graph.FontSetDemos; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.demos.util.MiscUtils; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.Animator; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java index 8e2c45431..fa2af1ea0 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java @@ -46,6 +46,7 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.Recti; import com.jogamp.opengl.math.Vec3f; +import com.jogamp.opengl.math.Vec4f; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; @@ -296,7 +297,7 @@ public class UIShapeDemo01 implements GLEventListener { pmv.glPushMatrix(); pmv.glScalef(txt_scale, txt_scale, 1f); pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new float[] { 0, 0, 0, 1 }, sampleCount, tempT1, tempT2); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new Vec4f( 0, 0, 0, 1 ), sampleCount, tempT1, tempT2); if( once ) { final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java index ed96112cd..6fe7e1791 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java @@ -70,6 +70,7 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.Recti; import com.jogamp.opengl.math.Vec3f; +import com.jogamp.opengl.math.Vec4f; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLReadBufferUtil; @@ -158,7 +159,7 @@ public class UITypeDemo01 implements GLEventListener { animator.start(); } - private final float[] fg_color = new float[] { 0, 0, 0, 1 }; + private final Vec4f fg_color = new Vec4f( 0, 0, 0, 1 ); private final Font font; private final String text; private final int glyph_id; @@ -332,7 +333,7 @@ public class UITypeDemo01 implements GLEventListener { pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); if( null != glyph.getShape() ) { final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null); - region.addOutlineShape(glyph.getShape(), null, region.hasColorChannel() ? fg_color : null); + region.addOutlineShape(glyph.getShape(), null, fg_color); region.draw(gl, renderer, sampleCount); region.destroy(gl); } diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java index 69f1fff71..1272a3a94 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java @@ -45,7 +45,7 @@ public class Glyph01UbuntuLight_o extends GraphShape { @SuppressWarnings("unused") @Override protected void addShapeToRegion() { - final OutlineShape shape = new OutlineShape(vertexFactory); + final OutlineShape shape = new OutlineShape(); // Ubuntu-Light, lower case 'o' // Start TTF Shape for Glyph 82 diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java index 020b950eb..e4604bf45 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java @@ -44,7 +44,7 @@ public class Glyph02UbuntuLight_ae extends GraphShape { @SuppressWarnings("unused") @Override protected void addShapeToRegion() { - final OutlineShape shape = new OutlineShape(vertexFactory); + final OutlineShape shape = new OutlineShape(); // Ubuntu-Light, lower case 'æ' diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java index 518718cff..877a72648 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java @@ -44,7 +44,7 @@ public class Glyph03FreeMonoRegular_M extends GraphShape { @SuppressWarnings("unused") @Override protected void addShapeToRegion() { - final OutlineShape shape = new OutlineShape(vertexFactory); + final OutlineShape shape = new OutlineShape(); if( false ) { // Start TTF Shape for Glyph 48 diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java index f5341cefd..13273488e 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java @@ -43,7 +43,7 @@ public class Glyph04FreeSans_0 extends GraphShape { @Override protected void addShapeToRegion() { - final OutlineShape shape = new OutlineShape(vertexFactory); + final OutlineShape shape = new OutlineShape(); // Start TTF Shape for Glyph 19 // 000: B0a: move-to p0 diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java index 6daf665e7..8e858be16 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java @@ -43,7 +43,7 @@ public class Glyph05FreeSerifBoldItalic_ae extends GraphShape { @Override protected void addShapeToRegion() { - final OutlineShape shape = new OutlineShape(vertexFactory); + final OutlineShape shape = new OutlineShape(); // Start TTF Shape for Glyph 168 // 000: B0a: move-to p0 |