diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/graph/curve | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve')
8 files changed, 85 insertions, 84 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index b56a69b28..118c9b136 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -142,16 +142,16 @@ public class VBORegion2PMSAAES2 extends GLRegion { final int initialElementCount = 256; // Pass 1: - indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesBuffer = GLArrayDataServer.createData(3, GL.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); - gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); if( hasColorChannel() ) { - gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT, + gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); } else { gca_ColorsAttr = null; @@ -173,12 +173,12 @@ public class VBORegion2PMSAAES2 extends GLRegion { // Pass 2: gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, pass2TexUnit); - indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesFbo = GLArrayDataServer.createData(3, GL.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3); indicesFbo.seal(true); - gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(1); @@ -186,7 +186,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.seal(true); - gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); } @@ -234,7 +234,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { } @Override - protected final void pushIndex(int idx) { + protected final void pushIndex(final int idx) { indicesBuffer.puts((short)idx); } @@ -432,7 +432,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gca_FboTexCoordsAttr.enableBuffer(gl, true); indicesFbo.bindBuffer(gl, true); // keeps VBO binding - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); indicesFbo.bindBuffer(gl, false); gca_FboTexCoordsAttr.enableBuffer(gl, false); @@ -463,7 +463,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { ssink.reset(gl, fboWidth, fboHeight); // FIXME: shall not use bilinear (GL_LINEAR), due to MSAA ??? // ssink.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - ssink.attachTexture2D(gl, 0, true, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + ssink.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); if( !blendingEnabled ) { // no depth-buffer w/ blending ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24); @@ -489,7 +489,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gl.glViewport(0, 0, fboWidth, fboHeight); if( blendingEnabled ) { gl.glClearColor(0f, 0f, 0f, 0.0f); - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending + gl.glClear(GL.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending // For already pre-multiplied alpha values, use: // gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); @@ -500,7 +500,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gl.glDisable(GL.GL_DEPTH_TEST); } } else { - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); } renderRegion(gl); @@ -526,10 +526,10 @@ public class VBORegion2PMSAAES2 extends GLRegion { gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit()); gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); tex.disable(gl); // nop on core } else { - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); } indicesBuffer.bindBuffer(gl, false); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java index 861d889c1..8f75e7115 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java @@ -37,6 +37,7 @@ import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; import jogamp.opengl.Debug; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -79,7 +80,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { static { Debug.initSingleton(); final String key = "jogl.debug.graph.curve.vbaa.resizeLowerBoundary"; - RESIZE_BOUNDARY = Math.max(0, Debug.getIntProperty(key, true, 0)); + RESIZE_BOUNDARY = Math.max(0, PropertyAccess.getIntProperty(key, true, 0)); if( RESIZE_BOUNDARY > 0 ) { System.err.println("key: "+RESIZE_BOUNDARY); } @@ -178,15 +179,15 @@ public class VBORegion2PVBAAES2 extends GLRegion { final int initialElementCount = 256; // Pass 1: - indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesBuffer = GLArrayDataServer.createData(3, GL.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); - gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); if( hasColorChannel() ) { - gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT, + gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); } else { gca_ColorsAttr = null; @@ -209,12 +210,12 @@ public class VBORegion2PVBAAES2 extends GLRegion { gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, pass2TexUnit); gcu_FboTexSize = new GLUniformData(UniformNames.gcu_FboTexSize, 2, FloatBuffer.wrap(new float[2])); - indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesFbo = GLArrayDataServer.createData(3, GL.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3); indicesFbo.seal(true); - gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(1); @@ -222,7 +223,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.seal(true); - gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); } @@ -274,7 +275,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { } @Override - protected final void pushIndex(int idx) { + protected final void pushIndex(final int idx) { indicesBuffer.puts((short)idx); } @@ -549,7 +550,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { gca_FboTexCoordsAttr.enableBuffer(gl, true); indicesFbo.bindBuffer(gl, true); // keeps VBO binding - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); indicesFbo.bindBuffer(gl, false); gca_FboTexCoordsAttr.enableBuffer(gl, false); @@ -581,7 +582,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { // Shall not use bilinear (GL_LINEAR), due to own VBAA. Result is smooth w/o it now! // FIXME: FXAA requires bilinear filtering! // texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + texA = fbo.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); if( !blendingEnabled ) { // no depth-buffer w/ blending fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24); @@ -610,14 +611,14 @@ public class VBORegion2PVBAAES2 extends GLRegion { gl.glViewport(0, 0, fboWidth, fboHeight); if( blendingEnabled ) { gl.glClearColor(0f, 0f, 0f, 0.0f); - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending + gl.glClear(GL.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending // For already pre-multiplied alpha values, use: // gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); // Multiply RGB w/ Alpha, preserve alpha for renderFBO(..) gl.glBlendFuncSeparate(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); } else { - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); } renderRegion(gl); @@ -644,10 +645,10 @@ public class VBORegion2PVBAAES2 extends GLRegion { gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit()); gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); tex.disable(gl); // nop on core } else { - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); } indicesBuffer.bindBuffer(gl, false); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 8265b014a..46e991866 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -64,16 +64,16 @@ public class VBORegionSPES2 extends GLRegion { rsLocal = new RenderState.ProgramLocal(); final int initialElementCount = 256; - indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesBuffer = GLArrayDataServer.createData(3, GL.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); - gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); if( hasColorChannel() ) { - gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT, + gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); } else { gca_ColorsAttr = null; @@ -135,7 +135,7 @@ public class VBORegionSPES2 extends GLRegion { } @Override - protected final void pushIndex(int idx) { + protected final void pushIndex(final int idx) { indicesBuffer.puts((short)idx); } @@ -244,10 +244,10 @@ public class VBORegionSPES2 extends GLRegion { gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit()); gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); tex.disable(gl); // nop on core } else { - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); } indicesBuffer.bindBuffer(gl, false); diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index d2cfa42a1..4473d040f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -100,7 +100,7 @@ public class CDTriangulator2D implements Triangulator { } @Override - public final void generate(List<Triangle> sink) { + public final void generate(final List<Triangle> sink) { final int loopsSize = loops.size(); for(int i=0;i<loopsSize;i++) { final Loop loop = loops.get(i); @@ -219,7 +219,7 @@ public class CDTriangulator2D implements Triangulator { return innerOutline; } - private Loop getContainerLoop(Outline polyline) { + private Loop getContainerLoop(final Outline polyline) { final ArrayList<Vertex> vertices = polyline.getVertices(); for(int i=0; i < loops.size(); i++) { final Loop loop = loops.get(i); diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java index 2e8d4f58f..81e6efdad 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java @@ -44,9 +44,9 @@ public class GraphOutline { * the curve pieces can be identified by onCurve flag * of each cp the control polyline is open by default */ - public GraphOutline(Outline ol){ + public GraphOutline(final Outline ol){ this.outline = ol; - ArrayList<Vertex> vertices = this.outline.getVertices(); + final ArrayList<Vertex> vertices = this.outline.getVertices(); for(int i = 0; i< vertices.size(); i++){ this.controlpoints.add(new GraphVertex(vertices.get(i))); } @@ -64,7 +64,7 @@ public class GraphOutline { return outline.getVertices(); } - public void addVertex(GraphVertex v) { + public void addVertex(final GraphVertex v) { controlpoints.add(v); outline.addVertex(v.getPoint()); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java index 89ad3edf1..391e71011 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java @@ -36,7 +36,7 @@ public class GraphVertex { private ArrayList<HEdge> edges = null; private boolean boundaryContained = false; - public GraphVertex(Vertex point) { + public GraphVertex(final Vertex point) { this.point = point; } @@ -59,7 +59,7 @@ public class GraphVertex { return point.getCoord(); } - public void setPoint(Vertex point) { + public void setPoint(final Vertex point) { this.point = point; } @@ -67,17 +67,17 @@ public class GraphVertex { return edges; } - public void setEdges(ArrayList<HEdge> edges) { + public void setEdges(final ArrayList<HEdge> edges) { this.edges = edges; } - public void addEdge(HEdge edge){ + public void addEdge(final HEdge edge){ if(edges == null){ edges = new ArrayList<HEdge>(); } edges.add(edge); } - public void removeEdge(HEdge edge){ + public void removeEdge(final HEdge edge){ if(edges == null) return; edges.remove(edge); @@ -85,9 +85,9 @@ public class GraphVertex { edges = null; } } - public HEdge findNextEdge(GraphVertex nextVert){ + public HEdge findNextEdge(final GraphVertex nextVert){ for(int i=0; i<edges.size(); i++) { - HEdge e = edges.get(i); + final HEdge e = edges.get(i); if(e.getNext().getGraphPoint() == nextVert){ return e; } @@ -96,16 +96,16 @@ public class GraphVertex { } public HEdge findBoundEdge(){ for(int i=0; i<edges.size(); i++) { - HEdge e = edges.get(i); + final HEdge e = edges.get(i); if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){ return e; } } return null; } - public HEdge findPrevEdge(GraphVertex prevVert){ + public HEdge findPrevEdge(final GraphVertex prevVert){ for(int i=0; i<edges.size(); i++) { - HEdge e = edges.get(i); + final HEdge e = edges.get(i); if(e.getPrev().getGraphPoint() == prevVert){ return e; } @@ -117,7 +117,7 @@ public class GraphVertex { return boundaryContained; } - public void setBoundaryContained(boolean boundaryContained) { + public void setBoundaryContained(final boolean boundaryContained) { this.boundaryContained = boundaryContained; } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java index acaa3d708..3bdf54590 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java @@ -43,12 +43,12 @@ public class HEdge { private int type = BOUNDARY; private Triangle triangle = null; - public HEdge(GraphVertex vert, int type) { + public HEdge(final GraphVertex vert, final int type) { this.vert = vert; this.type = type; } - public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) { + public HEdge(final GraphVertex vert, final HEdge prev, final HEdge next, final HEdge sibling, final int type) { this.vert = vert; this.prev = prev; this.next = next; @@ -56,7 +56,7 @@ public class HEdge { this.type = type; } - public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) { + public HEdge(final GraphVertex vert, final HEdge prev, final HEdge next, final HEdge sibling, final int type, final Triangle triangle) { this.vert = vert; this.prev = prev; this.next = next; @@ -69,7 +69,7 @@ public class HEdge { return vert; } - public void setVert(GraphVertex vert) { + public void setVert(final GraphVertex vert) { this.vert = vert; } @@ -77,7 +77,7 @@ public class HEdge { return prev; } - public void setPrev(HEdge prev) { + public void setPrev(final HEdge prev) { this.prev = prev; } @@ -85,7 +85,7 @@ public class HEdge { return next; } - public void setNext(HEdge next) { + public void setNext(final HEdge next) { this.next = next; } @@ -93,7 +93,7 @@ public class HEdge { return sibling; } - public void setSibling(HEdge sibling) { + public void setSibling(final HEdge sibling) { this.sibling = sibling; } @@ -101,7 +101,7 @@ public class HEdge { return type; } - public void setType(int type) { + public void setType(final int type) { this.type = type; } @@ -109,16 +109,16 @@ public class HEdge { return triangle; } - public void setTriangle(Triangle triangle) { + public void setTriangle(final Triangle triangle) { this.triangle = triangle; } - public static <T extends Vertex> void connect(HEdge first, HEdge next){ + public static <T extends Vertex> void connect(final HEdge first, final HEdge next){ first.setNext(next); next.setPrev(first); } - public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){ + public static <T extends Vertex> void makeSiblings(final HEdge first, final HEdge second){ first.setSibling(second); second.setSibling(first); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index 1f038a930..6563219cc 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -40,7 +40,7 @@ public class Loop { private final AABBox box = new AABBox(); private GraphOutline initialOutline = null; - public Loop(GraphOutline polyline, VectorUtil.Winding winding){ + public Loop(final GraphOutline polyline, final VectorUtil.Winding winding){ initialOutline = polyline; this.root = initFromPolyline(initialOutline, winding); } @@ -67,7 +67,7 @@ public class Loop { final GraphVertex v2 = next1.getGraphPoint(); final GraphVertex v3 = next2.getGraphPoint(); - HEdge v3Edge = new HEdge(v3, HEdge.INNER); + final HEdge v3Edge = new HEdge(v3, HEdge.INNER); HEdge.connect(v3Edge, root); HEdge.connect(next1, v3Edge); @@ -94,8 +94,8 @@ public class Loop { * from the boundary profile * @param reqWinding requested winding of edges (CCW or CW) */ - private HEdge initFromPolyline(GraphOutline outline, VectorUtil.Winding reqWinding){ - ArrayList<GraphVertex> vertices = outline.getGraphPoint(); + private HEdge initFromPolyline(final GraphOutline outline, final VectorUtil.Winding reqWinding){ + final ArrayList<GraphVertex> vertices = outline.getGraphPoint(); if(vertices.size()<3) { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); @@ -124,10 +124,10 @@ public class Loop { } while(index != max){ - GraphVertex v1 = vertices.get(index); + final GraphVertex v1 = vertices.get(index); box.resize(v1.getX(), v1.getY(), v1.getZ()); - HEdge edge = new HEdge(v1, edgeType); + final HEdge edge = new HEdge(v1, edgeType); v1.addEdge(edge); if(lastEdge != null) { @@ -155,15 +155,15 @@ public class Loop { return firstEdge; } - public void addConstraintCurve(GraphOutline polyline) { + public void addConstraintCurve(final GraphOutline polyline) { // GraphOutline outline = new GraphOutline(polyline); /**needed to generate vertex references.*/ initFromPolyline(polyline, VectorUtil.Winding.CW); - GraphVertex v3 = locateClosestVertex(polyline); - HEdge v3Edge = v3.findBoundEdge(); - HEdge v3EdgeP = v3Edge.getPrev(); - HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); + final GraphVertex v3 = locateClosestVertex(polyline); + final HEdge v3Edge = v3.findBoundEdge(); + final HEdge v3EdgeP = v3Edge.getPrev(); + final HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); HEdge.connect(root.getPrev(), crossEdge); HEdge.connect(crossEdge, v3Edge); @@ -184,7 +184,7 @@ public class Loop { * to search for closestvertices * @return the vertex that is closest to the newly set root Hedge. */ - private GraphVertex locateClosestVertex(GraphOutline polyline) { + private GraphVertex locateClosestVertex(final GraphOutline polyline) { HEdge closestE = null; GraphVertex closestV = null; @@ -200,7 +200,7 @@ public class Loop { final GraphVertex cand = vertices.get(pos); final float distance = VectorUtil.distVec3(v.getCoord(), cand.getCoord()); if(distance < minDistance){ - for (GraphVertex vert:vertices){ + for (final GraphVertex vert:vertices){ if(vert == v || vert == nextV || vert == cand) continue; inValid = VectorUtil.isInCircleVec2(v.getPoint(), nextV.getPoint(), @@ -226,19 +226,19 @@ public class Loop { return closestV; } - private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) { - HEdge next = root.getNext(); + private HEdge findClosestValidNeighbor(final HEdge edge, final boolean delaunay) { + final HEdge next = root.getNext(); if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), edge.getGraphPoint().getPoint())){ return null; } - HEdge candEdge = edge; + final HEdge candEdge = edge; boolean inValid = false; if(delaunay){ - Vertex cand = candEdge.getGraphPoint().getPoint(); + final Vertex cand = candEdge.getGraphPoint().getPoint(); HEdge e = candEdge.getNext(); while (e != candEdge){ if(e.getGraphPoint() == root.getGraphPoint() @@ -269,7 +269,7 @@ public class Loop { * @param root and edge of this triangle * @return the triangle iff it satisfies, null otherwise */ - private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){ + private Triangle createTriangle(final Vertex v1, final Vertex v2, final Vertex v3, final HEdge rootT){ return new Triangle(v1, v2, v3, checkVerticesBoundary(rootT)); } @@ -287,7 +287,7 @@ public class Loop { return boundary; } - public boolean checkInside(Vertex v) { + public boolean checkInside(final Vertex v) { if(!box.contains(v.getX(), v.getY(), v.getZ())){ return false; } @@ -296,8 +296,8 @@ public class Loop { HEdge current = root; HEdge next = root.getNext(); do { - Vertex v2 = current.getGraphPoint().getPoint(); - Vertex v1 = next.getGraphPoint().getPoint(); + final Vertex v2 = current.getGraphPoint().getPoint(); + final Vertex v1 = next.getGraphPoint().getPoint(); if ( ((v1.getY() > v.getY()) != (v2.getY() > v.getY())) && (v.getX() < (v2.getX() - v1.getX()) * (v.getY() - v1.getY()) / (v2.getY() - v1.getY()) + v1.getX()) ){ |