aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-21 09:33:06 +0100
committerSven Gothel <[email protected]>2023-03-21 09:33:06 +0100
commit59a7fdeb4ed36f0014ba1fdcc0ec144c04aaa2d5 (patch)
treeecd36c5dc7e3af7aa6c42795566640c9d49d11ab /src/jogl/classes/com/jogamp/graph/curve
parent8abe939c5132e4a58c4b9a6b31f0b1fd10734516 (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/jogl/classes/com/jogamp/graph/curve')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java14
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java41
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java9
3 files changed, 21 insertions, 43 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index fc8d41660..7b487347a 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -34,6 +34,7 @@ import java.util.Comparator;
import com.jogamp.graph.curve.tess.Triangulation;
import com.jogamp.graph.curve.tess.Triangulator;
import com.jogamp.graph.geom.Outline;
+import com.jogamp.graph.geom.SVertex;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.plane.AffineTransform;
@@ -187,7 +188,18 @@ public final class OutlineShape implements Comparable<OutlineShape> {
private final float[] tmpV2 = new float[3];
private final float[] tmpV3 = new float[3];
- /** Create a new Outline based Shape
+ /** Returns the default Vertex.Factory. */
+ public static Vertex.Factory<? extends Vertex> getDefaultVertexFactory() { return SVertex.factory(); }
+
+ /**
+ * Create a new Outline based Shape using {@link #getDefaultVertexFactory()}
+ */
+ public OutlineShape() {
+ this(getDefaultVertexFactory());
+ }
+
+ /**
+ * Create a new Outline based Shape
*/
public OutlineShape(final Vertex.Factory<? extends Vertex> factory) {
this.vertexFactory = factory;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 28be06eee..b24cc3230 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -47,8 +47,6 @@ import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.graph.geom.Vertex;
/**
* OpenGL {@link Region} renderer
@@ -164,7 +162,7 @@ public final class RegionRenderer {
* @see #enable(GL2ES2, boolean)
*/
public static RegionRenderer create(final GLCallback enableCallback, final GLCallback disableCallback) {
- return new RegionRenderer(null, enableCallback, disableCallback);
+ return new RegionRenderer(enableCallback, disableCallback);
}
/**
@@ -175,30 +173,6 @@ public final class RegionRenderer {
* For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable}
* can be utilized to enable and disable {@link GL#GL_BLEND}.
* </p>
- * @param pointFactory optional {@link Vertex.Factory} to be used for the {@link RenderState} composition,
- * If null, SVertex.factory() will be used.
- * @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
- * {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}.
- * @param disableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
- * {@link #enable(GL2ES2, boolean) enable(gl, false)}.
- * @return an instance of Region Renderer
- * @see #enable(GL2ES2, boolean)
- */
- public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory,
- final GLCallback enableCallback, final GLCallback disableCallback) {
- return new RegionRenderer(pointFactory, enableCallback, disableCallback);
- }
-
- /**
- * Create a hardware accelerated RegionRenderer including its {@link RenderState} composition.
- * <p>
- * The optional {@link GLCallback}s <code>enableCallback</code> and <code>disableCallback</code>
- * maybe used to issue certain tasks at {@link #enable(GL2ES2, boolean)}.<br/>
- * For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable}
- * can be utilized to enable and disable {@link GL#GL_BLEND}.
- * </p>
- * @param pointFactory optional {@link Vertex.Factory} to be used for the {@link RenderState} composition.
- * If null, SVertex.factory() will be used.
* @param sharedPMVMatrix optional shared {@link PMVMatrix} to be used for the {@link RenderState} composition.
* @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
* {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}.
@@ -207,9 +181,9 @@ public final class RegionRenderer {
* @return an instance of Region Renderer
* @see #enable(GL2ES2, boolean)
*/
- public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix sharedPMVMatrix,
+ public static RegionRenderer create(final PMVMatrix sharedPMVMatrix,
final GLCallback enableCallback, final GLCallback disableCallback) {
- return new RegionRenderer(pointFactory, sharedPMVMatrix, enableCallback, disableCallback);
+ return new RegionRenderer(sharedPMVMatrix, enableCallback, disableCallback);
}
private final RenderState rs;
@@ -242,18 +216,17 @@ public final class RegionRenderer {
//////////////////////////////////////
- protected RegionRenderer(final Vertex.Factory<? extends Vertex> pointFactory,
- final GLCallback enableCallback, final GLCallback disableCallback)
+ protected RegionRenderer(final GLCallback enableCallback, final GLCallback disableCallback)
{
- this.rs = new RenderState(pointFactory, null);
+ this.rs = new RenderState(null);
this.enableCallback = enableCallback;
this.disableCallback = disableCallback;
}
- protected RegionRenderer(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix sharedPMVMatrix,
+ protected RegionRenderer(final PMVMatrix sharedPMVMatrix,
final GLCallback enableCallback, final GLCallback disableCallback)
{
- this.rs = new RenderState(pointFactory, sharedPMVMatrix);
+ this.rs = new RenderState(sharedPMVMatrix);
this.enableCallback = enableCallback;
this.disableCallback = disableCallback;
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 6e1886c73..9dc72f617 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -38,8 +38,6 @@ import jogamp.common.os.PlatformPropsImpl;
import jogamp.graph.curve.opengl.shader.UniformNames;
import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderProgram;
@@ -92,7 +90,6 @@ public class RenderState {
return (RenderState) gl.getContext().getAttachedObject(thisKey);
}
- private final Vertex.Factory<? extends Vertex> vertexFactory;
private final PMVMatrix pmvMatrix;
private final float[] weight;
private final FloatBuffer weightBuffer;
@@ -187,13 +184,11 @@ public class RenderState {
/**
* Create a RenderState, a composition of RegionRenderer
- * @param vertexFactory used Vertex.Factory, if null SVertex.factory() will be used.
* @param sharedPMVMatrix optional shared PMVMatrix, if null using a local instance
*/
- /* pp */ RenderState(final Vertex.Factory<? extends Vertex> vertexFactory, final PMVMatrix sharedPMVMatrix) {
+ /* pp */ RenderState(final PMVMatrix sharedPMVMatrix) {
this.id = getNextID();
this.sp = null;
- this.vertexFactory = null != vertexFactory ? vertexFactory : SVertex.factory();
this.pmvMatrix = null != sharedPMVMatrix ? sharedPMVMatrix : new PMVMatrix();
this.weight = new float[1];
this.weightBuffer = FloatBuffer.wrap(weight);
@@ -233,8 +228,6 @@ public class RenderState {
return true;
}
- public final Vertex.Factory<? extends Vertex> getVertexFactory() { return vertexFactory; }
-
public final PMVMatrix getMatrix() { return pmvMatrix; }
public static boolean isWeightValid(final float v) {