diff options
author | Sven Gothel <[email protected]> | 2023-03-21 09:33:06 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-21 09:33:06 +0100 |
commit | 59a7fdeb4ed36f0014ba1fdcc0ec144c04aaa2d5 (patch) | |
tree | ecd36c5dc7e3af7aa6c42795566640c9d49d11ab /src/graphui | |
parent | 8abe939c5132e4a58c4b9a6b31f0b1fd10734516 (diff) |
Graph: Cleanup Vertex.Factory referencing: Only bind to OutlineShape and use its default. GraphUI: Always use default.
Graph RegionRenderer, its RenderState as well as GraphUI's Scene don't need to have knowledge of Vertex.Factory,
which is only used within OutlineShape and its 'inner geom workings'.
Diffstat (limited to 'src/graphui')
11 files changed, 36 insertions, 66 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java index 16e5c736f..24df8c80a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java @@ -46,8 +46,6 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.graph.geom.Vertex; import com.jogamp.newt.event.GestureHandler; import com.jogamp.newt.event.InputEvent; import com.jogamp.newt.event.MouseEvent; @@ -117,11 +115,8 @@ public final class Scene implements GLEventListener { private GLAutoDrawable cDrawable = null; - /** Returns the default Vertex.Factory. */ - public static Vertex.Factory<? extends Vertex> getDefaultVertexFactory() { return SVertex.factory(); } - private static RegionRenderer createRenderer() { - return RegionRenderer.create(getDefaultVertexFactory(), RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + return RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); } /** @@ -150,9 +145,6 @@ public final class Scene implements GLEventListener { /** Returns the associated RegionRenderer's RenderState. */ public RenderState getRenderState() { return renderer.getRenderState(); } - /** Returns the used Vertex.Factory, as used by Region and RegionRenderer. */ - public final Vertex.Factory<? extends Vertex> getVertexFactory() { return renderer.getRenderState().getVertexFactory(); } - /** * Sets the clear parameter for {@link GL#glClearColor(float, float, float, float) glClearColor(..)} and {@link GL#glClear(int) glClear(..)} * to be issued at {@link #display(GLAutoDrawable)}. diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java index 1876b8057..52a17f49a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java @@ -121,8 +121,8 @@ public abstract class Shape { private Listener onMoveListener = null; - public Shape(final Factory<? extends Vertex> factory, final int renderModes) { - this.vertexFactory = factory; + public Shape(final int renderModes) { + this.vertexFactory = OutlineShape.getDefaultVertexFactory(); this.renderModes = renderModes; this.box = new AABBox(); } @@ -132,8 +132,6 @@ public abstract class Shape { /** Return the optional symbolic name for this shape. */ public final int getName() { return this.name; } - public final Vertex.Factory<? extends Vertex> getVertexFactory() { return vertexFactory; } - /** Returns true if this shape is enabled and hence visible, otherwise false. */ public final boolean isEnabled() { return enabled; } /** Enable or disable this shape, i.e. its visibility. */ diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java index fb81522ad..3774b7b1f 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java @@ -33,8 +33,6 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.math.geom.AABBox; import jogamp.graph.ui.shapes.Label0; @@ -62,10 +60,10 @@ public class Button extends RoundButton { private float spacingX = DEFAULT_SPACING_X; private float spacingY = DEFAULT_SPACING_Y; - public Button(final Factory<? extends Vertex> factory, final int renderModes, - final Font labelFont, final String labelText, - final float width, final float height) { - super(factory, renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height); + public Button(final int renderModes, final Font labelFont, + final String labelText, final float width, + final float height) { + super(renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height); this.label = new Label0(labelFont, labelText, new float[] { 1.33f, 1.33f, 1.33f, 1.0f }); // 0.75 * 1.33 = 1.0 setColor(0.75f, 0.75f, 0.75f, 1.0f); setPressedColorMod(0.9f, 0.9f, 0.9f, 0.7f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java index 1d2df261e..ac09ea395 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java @@ -27,11 +27,7 @@ */ package com.jogamp.graph.ui.gl.shapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -43,8 +39,8 @@ import com.jogamp.graph.ui.gl.Shape; public class CrossHair extends Shape { private float width, height, lineWidth; - public CrossHair(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final float linewidth) { - super(factory, renderModes); + public CrossHair(final int renderModes, final float width, final float height, final float linewidth) { + super(renderModes); this.width = width; this.height = height; this.lineWidth = linewidth; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java index 8b81eb4f2..0d51ff09b 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java @@ -37,8 +37,6 @@ import com.jogamp.opengl.GLDrawableFactory; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLOffscreenAutoDrawable; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.FBObject; import com.jogamp.opengl.util.texture.ImageSequence; import com.jogamp.opengl.util.texture.Texture; @@ -64,10 +62,9 @@ public class GLButton extends TexSeqButton { private volatile GLOffscreenAutoDrawable.FBO fboGLAD = null; private boolean animateGLEL = false; - public GLButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, final int textureUnit, - final GLEventListener glel, final boolean useAlpha) { - super(factory, renderModes, width, height, new ImageSequence(textureUnit, true)); + public GLButton(final int renderModes, final float width, final float height, + final int textureUnit, final GLEventListener glel, final boolean useAlpha) { + super(renderModes, width, height, new ImageSequence(textureUnit, true)); this.glel = glel; this.useAlpha = useAlpha; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java index 957d7141f..bbc4975bf 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java @@ -29,8 +29,6 @@ package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.util.texture.ImageSequence; /** @@ -45,9 +43,9 @@ import com.jogamp.opengl.util.texture.ImageSequence; */ public class ImageButton extends TexSeqButton { - public ImageButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, final ImageSequence texSeq) { - super(factory, renderModes, width, height, texSeq); + public ImageButton(final int renderModes, final float width, + final float height, final ImageSequence texSeq) { + super(renderModes, width, height, texSeq); setColor(0.95f, 0.95f, 0.95f, 1.0f); setPressedColorMod(1f, 1f, 1f, 0.9f); setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java index ac337924a..7db220537 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java @@ -34,8 +34,6 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.graph.ui.gl.Shape; @@ -52,14 +50,13 @@ public class Label extends Shape { /** * Label ctor - * @param factory Vertex factory * @param renderModes region renderModes * @param font the font * @param fontScale font-scale factor, by which the em-sized type glyphs shall be scaled * @param text the text to render */ - public Label(final Factory<? extends Vertex> factory, final int renderModes, final Font font, final float fontScale, final String text) { - super(factory, renderModes); + public Label(final int renderModes, final Font font, final float fontScale, final String text) { + super(renderModes); this.font = font; this.fontScale = fontScale; this.text = text; @@ -166,7 +163,15 @@ public class Label extends Shape { @Override public void visit(final OutlineShape shape, final AffineTransform t) { shape.setSharpness(shapesSharpness); - region.addOutlineShape(shape, t, rgbaColor); + try { + region.addOutlineShape(shape, t, rgbaColor); + } catch ( final Exception ex ) { + ex.printStackTrace(); + System.err.println("Ex from "+Label.this); + System.err.println("Ex from "+region.toString()); + region.printBufferStats(System.err); + System.exit(-1); + } } }; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java index e858093ab..8f9ccda3e 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java @@ -30,8 +30,6 @@ package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.util.av.GLMediaPlayer; import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener; import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException; @@ -51,17 +49,15 @@ public class MediaButton extends TexSeqButton { private boolean verbose = false; /** - * @param factory * @param renderModes * @param width * @param height * @param mPlayer * @param mPlayerListener */ - public MediaButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, - final GLMediaPlayer mPlayer) { - super(factory, renderModes, width, height, mPlayer); + public MediaButton(final int renderModes, final float width, + final float height, final GLMediaPlayer mPlayer) { + super(renderModes, width, height, mPlayer); setColor(0.8f, 0.8f, 0.8f, 1.0f); setPressedColorMod(1.1f, 1.1f, 1.1f, 0.7f); setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java index 391390bea..ced2a2849 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java @@ -27,11 +27,7 @@ */ package com.jogamp.graph.ui.gl.shapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -43,8 +39,8 @@ import com.jogamp.graph.ui.gl.Shape; public class Rectangle extends Shape { private float width, height, lineWidth; - public Rectangle(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final float linewidth) { - super(factory, renderModes); + public Rectangle(final int renderModes, final float width, final float height, final float linewidth) { + super(renderModes); this.width = width; this.height = height; this.lineWidth = linewidth; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java index aa8aabbdb..8dde441d9 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java @@ -27,11 +27,7 @@ */ package com.jogamp.graph.ui.gl.shapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -52,8 +48,8 @@ public abstract class RoundButton extends Shape { protected float height; protected float corner = DEFAULT_CORNER; - protected RoundButton(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height) { - super(factory, renderModes); + protected RoundButton(final int renderModes, final float width, final float height) { + super(renderModes); this.width = width; this.height = height; } diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java index 365fa8e66..41dd196e0 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java @@ -31,8 +31,6 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.opengl.util.texture.TextureSequence; @@ -49,9 +47,9 @@ import com.jogamp.opengl.util.texture.TextureSequence; public abstract class TexSeqButton extends RoundButton { protected final TextureSequence texSeq; - public TexSeqButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, final TextureSequence texSeq) { - super(factory, renderModes | Region.COLORTEXTURE_RENDERING_BIT, width, height); + public TexSeqButton(final int renderModes, final float width, + final float height, final TextureSequence texSeq) { + super(renderModes | Region.COLORTEXTURE_RENDERING_BIT, width, height); this.texSeq = texSeq; } |