diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rwxr-xr-x | src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java | 31 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 4 |
2 files changed, 27 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java index c995b3749..d0413b1e4 100755 --- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java +++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java @@ -35,6 +35,7 @@ import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.math.VectorUtil;
+import com.jogamp.graph.curve.OutlineShape.VerticesState;
import com.jogamp.graph.curve.tess.CDTriangulator2D;
/** A Generic shape objects which is defined by a list of Outlines.
@@ -53,7 +54,7 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D; addVertex(...)
addVertex(...)
addVertex(...)
- addEnptyOutline()
+ addEmptyOutline()
addVertex(...)
addVertex(...)
addVertex(...)
@@ -91,9 +92,21 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D; * @see Region
*/
public class OutlineShape {
+ /**
+ * Outline has original user state (vertices) until transformed.
+ */
+ public enum VerticesState {
+ ORIGINAL(0), QUADRATIC_NURBS(1);
- public static final int QUADRATIC_NURBS = 10;
+ public final int state;
+
+ VerticesState(int state){
+ this.state = state;
+ }
+ }
+
private final Vertex.Factory<? extends Vertex> vertexFactory;
+ private VerticesState outlineState;
/** The list of {@link Outline}s that are part of this
* outline shape.
@@ -105,6 +118,7 @@ public class OutlineShape { public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
vertexFactory = factory;
outlines.add(new Outline());
+ outlineState = VerticesState.ORIGINAL;
}
/** Returns the associated vertex factory of this outline shape
@@ -205,11 +219,15 @@ public class OutlineShape { /** Make sure that the outlines represent
* the specified destinationType, if not
* transform outlines to destination type.
- * @param destinationType The curve type needed
+ * @param destinationType TODO
*/
- public void transformOutlines(int destinationType){
- if(destinationType == QUADRATIC_NURBS){
- transformOutlinesQuadratic();
+ public void transformOutlines(VerticesState destinationType){
+ if(outlineState != destinationType){
+ if(destinationType == VerticesState.QUADRATIC_NURBS){
+ transformOutlinesQuadratic();
+ } else {
+ throw new IllegalStateException("destinationType "+destinationType.name()+" not supported (currently "+outlineState.name()+")");
+ }
}
}
@@ -240,6 +258,7 @@ public class OutlineShape { newOutlines.add(newOutline);
}
outlines = newOutlines;
+ outlineState = VerticesState.QUADRATIC_NURBS;
}
private void generateVertexIds(){
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 03a696f35..2d614d279 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -113,7 +113,7 @@ public abstract class RegionRenderer extends Renderer { protected Region createRegion(GL2ES2 gl, OutlineShape outlineShape) { Region region = RegionFactory.create(rs, renderType); - outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS); + outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS); ArrayList<Triangle> triangles = (ArrayList<Triangle>) outlineShape.triangulate(); ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices(); region.addVertices(vertices); @@ -133,7 +133,7 @@ public abstract class RegionRenderer extends Renderer { int numVertices = region.getNumVertices(); for(OutlineShape outlineShape:outlineShapes){ - outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS); + outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS); ArrayList<Triangle> triangles = outlineShape.triangulate(); region.addTriangles(triangles); |