diff options
Diffstat (limited to 'src/com/jogamp/graph/curve')
-rwxr-xr-x | src/com/jogamp/graph/curve/HwRegionRenderer.java | 14 | ||||
-rwxr-xr-x | src/com/jogamp/graph/curve/OutlineShape.java | 68 | ||||
-rwxr-xr-x | src/com/jogamp/graph/curve/Region.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/graph/curve/tess/CDTriangulator2D.java | 16 | ||||
-rw-r--r-- | src/com/jogamp/graph/curve/text/HwTextRenderer.java | 17 |
5 files changed, 60 insertions, 61 deletions
diff --git a/src/com/jogamp/graph/curve/HwRegionRenderer.java b/src/com/jogamp/graph/curve/HwRegionRenderer.java index 3c3142061..2caa6bb7e 100755 --- a/src/com/jogamp/graph/curve/HwRegionRenderer.java +++ b/src/com/jogamp/graph/curve/HwRegionRenderer.java @@ -40,7 +40,7 @@ import javax.media.opengl.GLUniformData; import javax.media.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.PointTex;
+import com.jogamp.graph.geom.Vertex;
import jogamp.opengl.Debug;
import com.jogamp.opengl.util.PMVMatrix;
@@ -71,7 +71,7 @@ public class HwRegionRenderer { /** Create a Hardware accelerated Region Renderer
* @param context OpenGL rendering context
- * @param factory optional Point.Factory for PointTex construction. Default is Vertex.Factory.
+ * @param factory optional Point.Factory for Vertex construction. Default is Vertex.Factory.
*/
public HwRegionRenderer(GLContext context) {
this.context = context;
@@ -248,8 +248,8 @@ public class HwRegionRenderer { outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
- ArrayList<Triangle<PointTex>> triangles = (ArrayList<Triangle<PointTex>>) outlineShape.triangulate(sharpness);
- ArrayList<PointTex> vertices = (ArrayList<PointTex>) outlineShape.getVertices();
+ ArrayList<Triangle<Vertex>> triangles = (ArrayList<Triangle<Vertex>>) outlineShape.triangulate(sharpness);
+ ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices();
region.addVertices(vertices);
region.addTriangles(triangles);
@@ -265,11 +265,11 @@ public class HwRegionRenderer { for(OutlineShape outlineShape:outlineShapes){
outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
- ArrayList<Triangle<PointTex>> triangles = outlineShape.triangulate(sharpness);
+ ArrayList<Triangle<Vertex>> triangles = outlineShape.triangulate(sharpness);
region.addTriangles(triangles);
- ArrayList<PointTex> vertices = outlineShape.getVertices();
- for(PointTex vert:vertices){
+ ArrayList<Vertex> vertices = outlineShape.getVertices();
+ for(Vertex vert:vertices){
vert.setId(numVertices++);
}
region.addVertices(vertices);
diff --git a/src/com/jogamp/graph/curve/OutlineShape.java b/src/com/jogamp/graph/curve/OutlineShape.java index d939d7427..b48804b4d 100755 --- a/src/com/jogamp/graph/curve/OutlineShape.java +++ b/src/com/jogamp/graph/curve/OutlineShape.java @@ -35,8 +35,8 @@ import jogamp.graph.math.VectorFloatUtil; import com.jogamp.graph.geom.Outline;
import com.jogamp.graph.geom.Line;
import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.Point;
-import com.jogamp.graph.geom.PointTex;
+import com.jogamp.graph.geom.Vertex;
+import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.curve.tess.CDTriangulator2D;
@@ -54,24 +54,24 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D; */
public class OutlineShape {
public static final int QUADRATIC_NURBS = 10;
- private final Point.Factory<? extends PointTex> pointFactory;
- private ArrayList<Outline<PointTex>> outlines = new ArrayList<Outline<PointTex>>(3);
+ private final Vertex.Factory<? extends Vertex> pointFactory;
+ private ArrayList<Outline<Vertex>> outlines = new ArrayList<Outline<Vertex>>(3);
/** Create a new Outline based Shape
*/
- public OutlineShape(Point.Factory<? extends PointTex> factory) {
+ public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
pointFactory = factory;
- outlines.add(new Outline<PointTex>());
+ outlines.add(new Outline<Vertex>());
}
- public final Point.Factory<? extends PointTex> pointFactory() { return pointFactory; }
+ public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; }
/** Add a new empty outline
* to the shape, this new outline will
* be placed at the end of the outline list.
*/
public void addEmptyOutline(){
- outlines.add(new Outline<PointTex>());
+ outlines.add(new Outline<Vertex>());
}
/** Adds an outline to the OutlineShape object
@@ -80,7 +80,7 @@ public class OutlineShape { * it will do nothing.
* @param outline an Outline object
*/
- public void addOutline(Outline<PointTex> outline){
+ public void addOutline(Outline<Vertex> outline){
if(outline.isEmpty()){
return;
}
@@ -94,7 +94,7 @@ public class OutlineShape { * shape
* @param point
*/
- public final void addVertex(PointTex point){
+ public final void addVertex(Vertex point){
getLastOutline().addVertex(point);
}
@@ -123,7 +123,7 @@ public class OutlineShape { * of outlines that define the shape
* @return the last outline
*/
- public final Outline<PointTex> getLastOutline(){
+ public final Outline<Vertex> getLastOutline(){
return outlines.get(outlines.size()-1);
}
/** Make sure that the outlines represent
@@ -138,19 +138,19 @@ public class OutlineShape { }
private void transformOutlinesQuadratic(){
- ArrayList<Outline<PointTex>> newOutlines = new ArrayList<Outline<PointTex>>(3);
+ ArrayList<Outline<Vertex>> newOutlines = new ArrayList<Outline<Vertex>>(3);
/**loop over the outlines and make sure no
* adj off-curve vertices
*/
- for(Outline<PointTex> outline:outlines){
- Outline<PointTex> newOutline = new Outline<PointTex>();
+ for(Outline<Vertex> outline:outlines){
+ Outline<Vertex> newOutline = new Outline<Vertex>();
- ArrayList<PointTex> vertices = outline.getVertices();
+ ArrayList<Vertex> vertices = outline.getVertices();
int size =vertices.size()-1;
for(int i=0;i<size;i++){
- PointTex currentVertex = vertices.get(i);
- PointTex nextVertex = vertices.get((i+1)%size);
+ Vertex currentVertex = vertices.get(i);
+ Vertex nextVertex = vertices.get((i+1)%size);
if(!(currentVertex.isOnCurve()) && !(nextVertex.isOnCurve())) {
newOutline.addVertex(currentVertex);
@@ -168,9 +168,9 @@ public class OutlineShape { private void generateVertexIds(){
int maxVertexId = 0;
- for(Outline<PointTex> outline:outlines){
- ArrayList<PointTex> vertices = outline.getVertices();
- for(PointTex vert:vertices){
+ for(Outline<Vertex> outline:outlines){
+ ArrayList<Vertex> vertices = outline.getVertices();
+ for(Vertex vert:vertices){
vert.setId(maxVertexId);
maxVertexId++;
}
@@ -180,9 +180,9 @@ public class OutlineShape { /** @return the list of vertices associated with the
* {@code Outline} list of this object
*/
- public ArrayList<PointTex> getVertices(){
- ArrayList<PointTex> vertices = new ArrayList<PointTex>();
- for(Outline<PointTex> polyline:outlines){
+ public ArrayList<Vertex> getVertices(){
+ ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+ for(Outline<Vertex> polyline:outlines){
vertices.addAll(polyline.getVertices());
}
return vertices;
@@ -193,17 +193,17 @@ public class OutlineShape { * parts of this graph
* @return arraylist of lines
*/
- public ArrayList<Line<PointTex>> getLines(){
- ArrayList<Line<PointTex>> lines = new ArrayList<Line<PointTex>>();
- for(Outline<PointTex> outline:outlines){
- ArrayList<PointTex> outVertices = outline.getVertices();
+ public ArrayList<Line<Vertex>> getLines(){
+ ArrayList<Line<Vertex>> lines = new ArrayList<Line<Vertex>>();
+ for(Outline<Vertex> outline:outlines){
+ ArrayList<Vertex> outVertices = outline.getVertices();
int size = outVertices.size();
for(int i=0; i < size; i++) {
- PointTex currentVertex = outVertices.get(i);
+ Vertex currentVertex = outVertices.get(i);
if(currentVertex.isOnCurve()) {
- PointTex v2 = outVertices.get((i+1)%size);
+ Vertex v2 = outVertices.get((i+1)%size);
if(v2.isOnCurve()){
- lines.add(new Line<PointTex>(currentVertex, v2));
+ lines.add(new Line<Vertex>(currentVertex, v2));
}
}
}
@@ -214,21 +214,21 @@ public class OutlineShape { /** Triangluate the graph object
* @param sharpness sharpness of the curved regions default = 0.5
*/
- public ArrayList<Triangle<PointTex>> triangulate(float sharpness){
+ public ArrayList<Triangle<Vertex>> triangulate(float sharpness){
if(outlines.size() == 0){
return null;
}
sortOutlines();
generateVertexIds();
- CDTriangulator2D<PointTex> triangulator2d = new CDTriangulator2D<PointTex>(sharpness);
+ CDTriangulator2D<Vertex> triangulator2d = new CDTriangulator2D<Vertex>(sharpness);
for(int index = 0; index< outlines.size();index++){
- Outline<PointTex> outline = outlines.get(index);
+ Outline<Vertex> outline = outlines.get(index);
triangulator2d.addCurve(outline);
}
- ArrayList<Triangle<PointTex>> triangles = triangulator2d.generateTriangulation();
+ ArrayList<Triangle<Vertex>> triangles = triangulator2d.generateTriangulation();
triangulator2d.reset();
return triangles;
diff --git a/src/com/jogamp/graph/curve/Region.java b/src/com/jogamp/graph/curve/Region.java index 44f426313..f3a87bb7f 100755 --- a/src/com/jogamp/graph/curve/Region.java +++ b/src/com/jogamp/graph/curve/Region.java @@ -30,7 +30,7 @@ package com.jogamp.graph.curve; import java.util.ArrayList;
import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.PointTex;
+import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
/** A Region is the OGL binding of one or more OutlineShapes
@@ -80,7 +80,7 @@ public interface Region { *
* @see update()
*/
- public void addTriangles(ArrayList<Triangle<PointTex>> tris);
+ public void addTriangles(ArrayList<Triangle<Vertex>> tris);
/** Get the current number of vertices associated
* with this region. This number is not necessary equal to
@@ -98,7 +98,7 @@ public interface Region { *
* @see update()
*/
- public void addVertices(ArrayList<PointTex> verts);
+ public void addVertices(ArrayList<Vertex> verts);
/** Check if this region is dirty. A region is marked dirty
* when new Vertices, Triangles, and or Lines are added after a
diff --git a/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java index 936965f0c..00c97d463 100644 --- a/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -31,13 +31,13 @@ package com.jogamp.graph.curve.tess; import java.util.ArrayList; import jogamp.graph.curve.tess.GraphOutline; -import jogamp.graph.curve.tess.GraphPoint; +import jogamp.graph.curve.tess.GraphVertex; import jogamp.graph.curve.tess.Loop; import jogamp.graph.math.VectorFloatUtil; import com.jogamp.graph.geom.Outline; import com.jogamp.graph.geom.Triangle; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import jogamp.opengl.Debug; /** Constrained Delaunay Triangulation @@ -45,7 +45,7 @@ import jogamp.opengl.Debug; * Closed Regions with optional n holes. * */ -public class CDTriangulator2D <T extends PointTex> { +public class CDTriangulator2D <T extends Vertex> { protected static final boolean DEBUG = Debug.debug("Triangulation"); @@ -149,13 +149,13 @@ public class CDTriangulator2D <T extends PointTex> { @SuppressWarnings("unchecked") private GraphOutline<T> extractBoundaryTriangles(GraphOutline<T> outline, boolean hole){ GraphOutline<T> innerOutline = new GraphOutline<T>(); - ArrayList<GraphPoint<T>> outVertices = outline.getGraphPoint(); + ArrayList<GraphVertex<T>> outVertices = outline.getGraphPoint(); int size = outVertices.size(); for(int i=0; i < size; i++) { - GraphPoint<T> currentVertex = outVertices.get(i); - GraphPoint<T> gv0 = outVertices.get((i+size-1)%size); - GraphPoint<T> gv2 = outVertices.get((i+1)%size); - GraphPoint<T> gv1 = currentVertex; + GraphVertex<T> currentVertex = outVertices.get(i); + GraphVertex<T> gv0 = outVertices.get((i+size-1)%size); + GraphVertex<T> gv2 = outVertices.get((i+1)%size); + GraphVertex<T> gv1 = currentVertex; if(!currentVertex.getPoint().isOnCurve()) { T v0 = (T) gv0.getPoint().clone(); diff --git a/src/com/jogamp/graph/curve/text/HwTextRenderer.java b/src/com/jogamp/graph/curve/text/HwTextRenderer.java index 61d8309c7..bbe62f158 100644 --- a/src/com/jogamp/graph/curve/text/HwTextRenderer.java +++ b/src/com/jogamp/graph/curve/text/HwTextRenderer.java @@ -48,9 +48,8 @@ import com.jogamp.common.util.ReflectionUtil; import com.jogamp.graph.curve.Region; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; -import com.jogamp.graph.geom.opengl.Vertex; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.opengl.SVertex; import jogamp.opengl.Debug; import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderCode; @@ -100,28 +99,28 @@ public class HwTextRenderer { private GLContext context; private FloatBuffer color = FloatBuffer.allocate(3); private HashMap<String, GlyphString> strings = new HashMap<String, GlyphString>(); - private final Point.Factory<? extends PointTex> pointFactory; + private final Vertex.Factory<? extends Vertex> pointFactory; int win_width = 0; int win_height = 0; /** Create a Hardware accelerated Text Renderer * @param context OpenGL rendering context - * @param factory optional Point.Factory for PointTex construction. Default is Vertex.Factory. + * @param factory optional Point.Factory for Vertex construction. Default is Vertex.Factory. */ - public HwTextRenderer(GLContext context, Point.Factory<? extends PointTex> factory, int type) { - this.pointFactory = (null != factory) ? factory : Vertex.factory(); + public HwTextRenderer(GLContext context, Vertex.Factory<? extends Vertex> factory, int type) { + this.pointFactory = (null != factory) ? factory : SVertex.factory(); this.context = context; this.regionType = type; init(context, 0.5f); } - public Font createFont(Point.Factory<? extends PointTex> factory, String name, int size) { + public Font createFont(Vertex.Factory<? extends Vertex> factory, String name, int size) { return fontFactory.createFont(factory, name, size); } - public Font createFont(Point.Factory<? extends PointTex> factory, + public Font createFont(Vertex.Factory<? extends Vertex> factory, String[] families, String style, String variant, |