diff options
author | Sven Gothel <[email protected]> | 2014-03-22 06:23:50 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-22 06:23:50 +0100 |
commit | b4817d053d7af20dae33774e430bf79a3d3c6fcd (patch) | |
tree | 1e7cd3d713e3c1f8442f00be8d161a63de34f601 /src/jogl/classes/com/jogamp/graph | |
parent | 523d1dae2431fdd56d39d3ea06220cfed412a0b5 (diff) |
Bug 801: Revise Graph VBAA (Add border dropping MSAA; Test diff. AA modes incl. FXAA2) ; Test exp. LineAA ; Misc Changes
- Revise VBAA
- Add border to FBO dropping MSAA
- This automatically gives AA for edges on FBO boundary
- Correcting ceil-diff, use object-diff instead of win-diff (diff := ceil(a)-a, w/ float a)
- Reorg shader - using includes to test diff. AA modes:
- [poles, wholeedge] * [equalweight, propweight]
- fxaa2
- Exp. LineAA (disabled)
- Test ROESSLER-2012-OGLES for detected rectangles only
- Test boundary line detection
See screenshots: <http://jogamp.org/files/screenshots/graphui/20140322/>
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
5 files changed, 49 insertions, 27 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index bb0ed09d1..15a0d6bff 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -48,7 +48,7 @@ public abstract class Region { /** Debug flag for region impl (graph.curve) */ public static final boolean DEBUG = Debug.debug("graph.curve"); - public static final boolean DEBUG_INSTANCE = Debug.debug("graph.curve.instance"); + public static final boolean DEBUG_INSTANCE = Debug.debug("graph.curve.Instance"); /** * Rendering-Mode bit for {@link Region#getRenderModes() Region} and {@link com.jogamp.graph.curve.opengl.RegionRenderer#getRenderModes() RegionRenderer}. 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 bc9052dbe..8233d4262 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -121,20 +121,22 @@ public abstract class RegionRenderer { return new jogamp.graph.curve.opengl.RegionRendererImpl01(rs, renderModes, enableCallback, disableCallback); } - protected final int renderModes; - protected final RenderState rs; + private final int renderModes; + private final RenderState rs; - protected final GLCallback enableCallback; - protected final GLCallback disableCallback; + private final GLCallback enableCallback; + private final GLCallback disableCallback; - protected int vp_width; - protected int vp_height; - protected boolean initialized; + private int vp_width; + private int vp_height; + private boolean initialized; private boolean vboSupported = false; public final boolean isInitialized() { return initialized; } + /** Return width of current viewport */ public final int getWidth() { return vp_width; } + /** Return height of current viewport */ public final int getHeight() { return vp_height; } public final float getWeight() { return rs.getWeight().floatValue(); } diff --git a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java index beac908d4..d13607d71 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java +++ b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java @@ -36,9 +36,9 @@ import com.jogamp.opengl.math.VectorUtil; */ public class SVertex implements Vertex { private int id; - protected final float[] coord = new float[3]; protected boolean onCurve; - private final float[] texCoord = new float[2]; + protected final float[] coord = new float[3]; + private final float[] texCoord = new float[3]; static final Factory factory = new Factory(); @@ -78,13 +78,13 @@ public class SVertex implements Vertex { this.id = src.getId(); System.arraycopy(src.getCoord(), 0, coord, 0, 3); setOnCurve(src.isOnCurve()); - System.arraycopy(src.getTexCoord(), 0, texCoord, 0, 2); + System.arraycopy(src.getTexCoord(), 0, texCoord, 0, 3); } public SVertex(final int id, final boolean onCurve, final float[] texCoordsBuffer) { this.id = id; this.onCurve = onCurve; - System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 2); + System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 3); } public SVertex(final float x, final float y, final float z, final boolean onCurve) { @@ -102,7 +102,7 @@ public class SVertex implements Vertex { public SVertex(float[] coordsBuffer, float[] texCoordsBuffer, boolean onCurve) { this.id = Integer.MAX_VALUE; System.arraycopy(coordsBuffer, 0, coord, 0, 3); - System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 2); + System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 3); setOnCurve(onCurve); } @@ -189,7 +189,7 @@ public class SVertex implements Vertex { final Vertex v = (Vertex) obj; return this == v || isOnCurve() == v.isOnCurve() && - VectorUtil.isVec2Equal(getTexCoord(), 0, v.getTexCoord(), 0, FloatUtil.EPSILON) && + VectorUtil.isVec3Equal(getTexCoord(), 0, v.getTexCoord(), 0, FloatUtil.EPSILON) && VectorUtil.isVec3Equal(getCoord(), 0, v.getCoord(), 0, FloatUtil.EPSILON) ; } @@ -199,9 +199,10 @@ public class SVertex implements Vertex { } @Override - public final void setTexCoord(float s, float t) { + public final void setTexCoord(float s, float t, float p) { texCoord[0] = s; texCoord[1] = t; + texCoord[2] = p; } @Override @@ -221,6 +222,6 @@ public class SVertex implements Vertex { public String toString() { return "[ID: " + id + ", onCurve: " + onCurve + ": p " + coord[0] + ", " + coord[1] + ", " + coord[2] + - ", t " + texCoord[0] + ", " + texCoord[1] + "]"; + ", t " + texCoord[0] + ", " + texCoord[1] + ", " + texCoord[2] + "]"; } } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java index de629dfc4..33e53f3ed 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java @@ -27,6 +27,8 @@ */ package com.jogamp.graph.geom; +import com.jogamp.opengl.math.VectorUtil; + import jogamp.graph.geom.plane.AffineTransform; public class Triangle { @@ -35,31 +37,29 @@ public class Triangle { private boolean[] boundaryVertices = null; private int id; - public Triangle(Vertex v1, Vertex v2, Vertex v3) { + public Triangle(final Vertex v1, final Vertex v2, final Vertex v3, final boolean[] boundaryVertices) { id = Integer.MAX_VALUE; vertices[0] = v1; vertices[1] = v2; vertices[2] = v3; + this.boundaryVertices = boundaryVertices; } - public Triangle(Triangle src) { + public Triangle(final Triangle src) { id = src.id; vertices[0] = src.vertices[0].clone(); vertices[1] = src.vertices[1].clone(); vertices[2] = src.vertices[2].clone(); System.arraycopy(src.boundaryEdges, 0, boundaryEdges, 0, 3); - boundaryVertices = src.boundaryVertices; + boundaryVertices = new boolean[3]; + System.arraycopy(src.boundaryVertices, 0, boundaryVertices, 0, 3); } private Triangle(final int id, final boolean[] boundaryEdges, final boolean[] boundaryVertices){ this.id = id; System.arraycopy(boundaryEdges, 0, this.boundaryEdges, 0, 3); - this.boundaryVertices = boundaryVertices; - /** - if( null != boundaryVertices ) { - this.boundaryVertices = new boolean[3]; - System.arraycopy(boundaryVertices, 0, this.boundaryVertices, 0, 3); - } */ + this.boundaryVertices = new boolean[3]; + System.arraycopy(boundaryVertices, 0, this.boundaryVertices, 0, 3); } /** @@ -73,6 +73,22 @@ public class Triangle { return tri; } + /** + * Returns true if all vertices are on-curve, otherwise false. + */ + public final boolean isOnCurve() { + return vertices[0].isOnCurve() && vertices[1].isOnCurve() && vertices[2].isOnCurve(); + } + + /** + * Returns true if all vertices are lines, i.e. zero tex-coord, otherwise false. + */ + public final boolean isLine() { + return VectorUtil.isVec2Zero(vertices[0].getTexCoord(), 0) && + VectorUtil.isVec2Zero(vertices[1].getTexCoord(), 0) && + VectorUtil.isVec2Zero(vertices[2].getTexCoord(), 0) ; + } + public int getId() { return id; } @@ -108,6 +124,9 @@ public class Triangle { @Override public String toString() { - return "Tri ID: " + id + "\n\t" + vertices[0] + "\n\t" + vertices[1] + "\n\t" + vertices[2]; + return "Tri ID: " + id + ", onCurve "+isOnCurve()+"\n\t" + + vertices[0] + ", bound "+boundaryVertices[0]+"\n\t" + + vertices[1] + ", bound "+boundaryVertices[1]+"\n\t" + + vertices[2] + ", bound "+boundaryVertices[2]; } } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java index fc9590ae7..e9c8dd193 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java @@ -69,7 +69,7 @@ public interface Vertex extends Vert3fImmutable, Cloneable { float[] getTexCoord(); - void setTexCoord(float s, float t); + void setTexCoord(float s, float t, float p); /** * @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException |