diff options
author | Sven Gothel <[email protected]> | 2011-04-08 21:35:34 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-08 21:35:34 +0200 |
commit | 324b85b0cc688f85a91e84b0b6d6a0378a79bea3 (patch) | |
tree | a5acbe1630d879e80ec66c6c3a72623431c57632 /src/jogl/classes/jogamp | |
parent | e104e42ba9ecda8c4094bf4b183105a6ab719da5 (diff) |
Fix TAB: Replace all TAB with 4 spaces
Diffstat (limited to 'src/jogl/classes/jogamp')
61 files changed, 1813 insertions, 1813 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java index 34b46a8b5..683a72d96 100755 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java @@ -43,10 +43,10 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class RegionRendererImpl01 extends RegionRenderer {
- /**Sharpness is equivalent to the value of t value of texture coord
- * on the off-curve vertex. The high value of sharpness will
- * result in high curvature.
- */
+ /**Sharpness is equivalent to the value of t value of texture coord
+ * on the off-curve vertex. The high value of sharpness will
+ * result in high curvature.
+ */
private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
@@ -174,35 +174,35 @@ public class RegionRendererImpl01 extends RegionRenderer { }
}
-
- @Override
+
+ @Override
public void renderOutlineShape(GL2ES2 gl, OutlineShape outlineShape, float[] position, int texSize) {
- if(!isInitialized()){
- throw new GLException("RegionRendererImpl01: not initialized!");
- }
- int hashCode = getHashCode(outlineShape);
- Region region = regions.get(hashCode);
-
- if(null == region) {
- region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());
- regions.put(hashCode, region);
- }
- region.render(pmvMatrix, vp_width, vp_height, texSize);
- }
-
- @Override
+ if(!isInitialized()){
+ throw new GLException("RegionRendererImpl01: not initialized!");
+ }
+ int hashCode = getHashCode(outlineShape);
+ Region region = regions.get(hashCode);
+
+ if(null == region) {
+ region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());
+ regions.put(hashCode, region);
+ }
+ region.render(pmvMatrix, vp_width, vp_height, texSize);
+ }
+
+ @Override
public void renderOutlineShapes(GL2ES2 gl, OutlineShape[] outlineShapes, float[] position, int texSize) {
if(!isInitialized()){
throw new GLException("RegionRendererImpl01: not initialized!");
}
-
- int hashCode = getHashCode(outlineShapes);
- Region region = regions.get(hashCode);
-
- if(null == region) {
+
+ int hashCode = getHashCode(outlineShapes);
+ Region region = regions.get(hashCode);
+
+ if(null == region) {
region = createRegion(gl, outlineShapes, mgl_sharpness.floatValue());
- regions.put(hashCode, region);
- }
+ regions.put(hashCode, region);
+ }
region.render(pmvMatrix, vp_width, vp_height, texSize);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java index 69a8e470b..bc94ab180 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java @@ -44,39 +44,39 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; public class TextRendererImpl01 extends TextRenderer { - /**Sharpness is equivalent to the value of t value of texture coord - * on the off-curve vertex. The high value of sharpness will - * result in high curvature. - */ + /**Sharpness is equivalent to the value of t value of texture coord + * on the off-curve vertex. The high value of sharpness will + * result in high curvature. + */ private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f); GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f); private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3)); private GLUniformData mgl_strength = new GLUniformData("a_strength", 1.8f); - - public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) { - super(factory, type); - } + + public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) { + super(factory, type); + } - @Override + @Override protected boolean initImpl(GL2ES2 gl){ - boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") && - gl.isFunctionAvailable("glBindBuffer") && - gl.isFunctionAvailable("glBufferData") && - gl.isFunctionAvailable("glDrawElements") && - gl.isFunctionAvailable("glVertexAttribPointer") && - gl.isFunctionAvailable("glDeleteBuffers"); - - if(DEBUG) { - System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported); - } - - if(!VBOsupported){ - return false; - } - - gl.glEnable(GL2ES2.GL_BLEND); - gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA); - + boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") && + gl.isFunctionAvailable("glBindBuffer") && + gl.isFunctionAvailable("glBufferData") && + gl.isFunctionAvailable("glDrawElements") && + gl.isFunctionAvailable("glVertexAttribPointer") && + gl.isFunctionAvailable("glDeleteBuffers"); + + if(DEBUG) { + System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported); + } + + if(!VBOsupported){ + return false; + } + + gl.glEnable(GL2ES2.GL_BLEND); + gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA); + ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, TextRendererImpl01.class, "shader", "shader/bin", "curverenderer01"); ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, TextRendererImpl01.class, @@ -95,62 +95,62 @@ public class TextRendererImpl01 extends TextRenderer { } st.attachShaderProgram(gl, sp); - - st.glUseProgram(gl, true); + + st.glUseProgram(gl, true); - pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); - pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); - pmvMatrix.glLoadIdentity(); - - pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); - pmvMatrix.glLoadIdentity(); - resetModelview(null); - - mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); - if(!st.glUniform(gl, mgl_PMVMatrix)) { - if(DEBUG){ - System.err.println("Error setting PMVMatrix in shader: "+st); - } - return false; - } - - if(!st.glUniform(gl, mgl_sharpness)) { - if(DEBUG){ - System.err.println("Error setting sharpness in shader: "+st); - } - return false; - } - - if(!st.glUniform(gl, mgl_alpha)) { - if(DEBUG){ - System.err.println("Error setting global alpha in shader: "+st); - } - return false; - } - - if(!st.glUniform(gl, mgl_color)) { - if(DEBUG){ - System.err.println("Error setting global color in shader: "+st); - } - return false; - } - - if(!st.glUniform(gl, mgl_strength)) { - System.err.println("Error setting antialias strength in shader: "+st); - } - - if(DEBUG) { - System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st); - } - return true; - } - - @Override + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); + pmvMatrix.glLoadIdentity(); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); + pmvMatrix.glLoadIdentity(); + + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); + pmvMatrix.glLoadIdentity(); + resetModelview(null); + + mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + if(!st.glUniform(gl, mgl_PMVMatrix)) { + if(DEBUG){ + System.err.println("Error setting PMVMatrix in shader: "+st); + } + return false; + } + + if(!st.glUniform(gl, mgl_sharpness)) { + if(DEBUG){ + System.err.println("Error setting sharpness in shader: "+st); + } + return false; + } + + if(!st.glUniform(gl, mgl_alpha)) { + if(DEBUG){ + System.err.println("Error setting global alpha in shader: "+st); + } + return false; + } + + if(!st.glUniform(gl, mgl_color)) { + if(DEBUG){ + System.err.println("Error setting global color in shader: "+st); + } + return false; + } + + if(!st.glUniform(gl, mgl_strength)) { + System.err.println("Error setting antialias strength in shader: "+st); + } + + if(DEBUG) { + System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st); + } + return true; + } + + @Override protected void disposeImpl(GL2ES2 gl) { - super.disposeImpl(gl); - } - + super.disposeImpl(gl); + } + @Override public float getAlpha() { return mgl_alpha.floatValue(); @@ -163,30 +163,30 @@ public class TextRendererImpl01 extends TextRenderer { st.glUniform(gl, mgl_alpha); } } - - @Override + + @Override public void setColor(GL2ES2 gl, float r, float g, float b){ - FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer(); - fb.put(0, r); - fb.put(1, r); - fb.put(2, r); - if(null != gl && st.inUse()) { - st.glUniform(gl, mgl_color); - } - } - - @Override + FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer(); + fb.put(0, r); + fb.put(1, r); + fb.put(2, r); + if(null != gl && st.inUse()) { + st.glUniform(gl, mgl_color); + } + } + + @Override public void renderString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int texSize) { - if(!isInitialized()){ - throw new GLException("TextRendererImpl01: not initialized!"); - } - GlyphString glyphString = getCachedGlyphString(font, str, fontSize); - if(null == glyphString) { - glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue()); - addCachedGlyphString(font, str, fontSize, glyphString); - } - - glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize); - } - + if(!isInitialized()){ + throw new GLException("TextRendererImpl01: not initialized!"); + } + GlyphString glyphString = getCachedGlyphString(font, str, fontSize); + if(null == glyphString) { + glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue()); + addCachedGlyphString(font, str, fontSize, glyphString); + } + + glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize); + } + } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java index 81d9d1858..05814965e 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -49,35 +49,35 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class VBORegion2PES2 implements Region { private int numVertices = 0; - private ArrayList<Triangle> triangles = new ArrayList<Triangle>(); - private ArrayList<Vertex> vertices = new ArrayList<Vertex>(); - private GLArrayDataServer verticeTxtAttr = null; - private GLArrayDataServer texCoordTxtAttr = null; - private GLArrayDataServer indicesTxt = null; + private ArrayList<Triangle> triangles = new ArrayList<Triangle>(); + private ArrayList<Vertex> vertices = new ArrayList<Vertex>(); + private GLArrayDataServer verticeTxtAttr = null; + private GLArrayDataServer texCoordTxtAttr = null; + private GLArrayDataServer indicesTxt = null; private GLArrayDataServer verticeFboAttr = null; private GLArrayDataServer texCoordFboAttr = null; private GLArrayDataServer indicesFbo = null; - - private GLContext context; - - private boolean flipped = false; - - private boolean dirty = false; - - private AABBox box = null; - private FBObject fbo = null; + + private GLContext context; + + private boolean flipped = false; + + private boolean dirty = false; + + private AABBox box = null; + private FBObject fbo = null; - private int tex_width_c = 0; - private int tex_height_c = 0; - - private ShaderState st; - - public VBORegion2PES2(GLContext context, ShaderState st){ - this.context =context; - this.st = st; - - GL2ES2 gl = context.getGL().getGL2ES2(); - + private int tex_width_c = 0; + private int tex_height_c = 0; + + private ShaderState st; + + public VBORegion2PES2(GLContext context, ShaderState st){ + this.context =context; + this.st = st; + + GL2ES2 gl = context.getGL().getGL2ES2(); + indicesFbo = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); @@ -108,132 +108,132 @@ public class VBORegion2PES2 implements Region { if(DEBUG) { System.err.println("VBORegion2PES2 Create: " + this); } - } - - public void update(){ - GL2ES2 gl = context.getGL().getGL2ES2(); - + } + + public void update(){ + GL2ES2 gl = context.getGL().getGL2ES2(); + destroyTxtAttr(gl); box = new AABBox(); indicesTxt = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false, triangles.size(), GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - for(Triangle t:triangles){ - if(t.getVertices()[0].getId() == Integer.MAX_VALUE){ - t.getVertices()[0].setId(numVertices++); - t.getVertices()[1].setId(numVertices++); - t.getVertices()[2].setId(numVertices++); - - vertices.add(t.getVertices()[0]); - vertices.add(t.getVertices()[1]); - vertices.add(t.getVertices()[2]); - - indicesTxt.puts((short) t.getVertices()[0].getId()); - indicesTxt.puts((short) t.getVertices()[1].getId()); - indicesTxt.puts((short) t.getVertices()[2].getId()); - } - else{ - Vertex v1 = t.getVertices()[0]; - Vertex v2 = t.getVertices()[1]; - Vertex v3 = t.getVertices()[2]; - - indicesTxt.puts((short) v1.getId()); - indicesTxt.puts((short) v2.getId()); - indicesTxt.puts((short) v3.getId()); - } - } + for(Triangle t:triangles){ + if(t.getVertices()[0].getId() == Integer.MAX_VALUE){ + t.getVertices()[0].setId(numVertices++); + t.getVertices()[1].setId(numVertices++); + t.getVertices()[2].setId(numVertices++); + + vertices.add(t.getVertices()[0]); + vertices.add(t.getVertices()[1]); + vertices.add(t.getVertices()[2]); + + indicesTxt.puts((short) t.getVertices()[0].getId()); + indicesTxt.puts((short) t.getVertices()[1].getId()); + indicesTxt.puts((short) t.getVertices()[2].getId()); + } + else{ + Vertex v1 = t.getVertices()[0]; + Vertex v2 = t.getVertices()[1]; + Vertex v3 = t.getVertices()[2]; + + indicesTxt.puts((short) v1.getId()); + indicesTxt.puts((short) v2.getId()); + indicesTxt.puts((short) v3.getId()); + } + } indicesTxt.seal(gl, true); verticeTxtAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false, vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); verticeTxtAttr.setLocation(Region.VERTEX_ATTR_IDX); - for(Vertex v:vertices){ - verticeTxtAttr.putf(v.getX()); - if(flipped){ - verticeTxtAttr.putf(-1*v.getY()); - } else { - verticeTxtAttr.putf(v.getY()); - } - verticeTxtAttr.putf(v.getZ()); - if(flipped){ - box.resize(v.getX(), -1*v.getY(), v.getZ()); - } else { - box.resize(v.getX(), v.getY(), v.getZ()); - } - } + for(Vertex v:vertices){ + verticeTxtAttr.putf(v.getX()); + if(flipped){ + verticeTxtAttr.putf(-1*v.getY()); + } else { + verticeTxtAttr.putf(v.getY()); + } + verticeTxtAttr.putf(v.getZ()); + if(flipped){ + box.resize(v.getX(), -1*v.getY(), v.getZ()); + } else { + box.resize(v.getX(), v.getY(), v.getZ()); + } + } verticeTxtAttr.seal(gl, true); - + texCoordTxtAttr = GLArrayDataServer.createGLSL(gl, Region.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); texCoordTxtAttr.setLocation(Region.TEXCOORD_ATTR_IDX); - for(Vertex v:vertices){ - float[] tex = v.getTexCoord(); - texCoordTxtAttr.putf(tex[0]); - texCoordTxtAttr.putf(tex[1]); - } + for(Vertex v:vertices){ + float[] tex = v.getTexCoord(); + texCoordTxtAttr.putf(tex[0]); + texCoordTxtAttr.putf(tex[1]); + } texCoordTxtAttr.seal(gl, true); // leave the buffers enabled for subsequent render call - dirty = false; - } - - public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){ + dirty = false; + } + + public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){ GL2ES2 gl = context.getGL().getGL2ES2(); - if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){ - renderRegion(gl); - } else { - if(width != tex_width_c){ + if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){ + renderRegion(gl); + } else { + if(width != tex_width_c){ renderRegion2FBO(gl, matrix, width); setupBBox2FboAttr(gl); - } -// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3)); - renderFBO(gl, matrix, vp_width, vp_height); - } - } - - private void renderFBO(GL2ES2 gl, PMVMatrix matrix, int width, int hight) { - gl.glViewport(0, 0, width, hight); - if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){ - System.out.println("Cnt set tex based mat"); - } - gl.glEnable(GL2ES2.GL_TEXTURE_2D); - gl.glActiveTexture(GL2ES2.GL_TEXTURE0); - fbo.use(gl); - - st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName())); - int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture"); - gl.glUniform1i(loc, 0); - - + } +// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3)); + renderFBO(gl, matrix, vp_width, vp_height); + } + } + + private void renderFBO(GL2ES2 gl, PMVMatrix matrix, int width, int hight) { + gl.glViewport(0, 0, width, hight); + if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){ + System.out.println("Cnt set tex based mat"); + } + gl.glEnable(GL2ES2.GL_TEXTURE_2D); + gl.glActiveTexture(GL2ES2.GL_TEXTURE0); + fbo.use(gl); + + st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName())); + int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture"); + gl.glUniform1i(loc, 0); + + verticeFboAttr.enableBuffer(gl, true); texCoordFboAttr.enableBuffer(gl, true); indicesFbo.enableBuffer(gl, true); gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementNumber() * indicesFbo.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0); - + verticeFboAttr.enableBuffer(gl, false); texCoordFboAttr.enableBuffer(gl, false); indicesFbo.enableBuffer(gl, false); - } - - private void setupBBox2FboAttr(GL2ES2 gl){ + } + + private void setupBBox2FboAttr(GL2ES2 gl){ verticeFboAttr.seal(gl, false); verticeFboAttr.rewind(); - verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); - + verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.seal(gl, true); - } - - private void renderRegion2FBO(GL2ES2 gl, PMVMatrix m, int tex_width){ - tex_width_c = tex_width; - tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth()); - + } + + private void renderRegion2FBO(GL2ES2 gl, PMVMatrix m, int tex_width){ + tex_width_c = tex_width; + tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth()); + // System.out.println("FBO Size: "+tex_width+" -> "+tex_height_c+"x"+tex_width_c); // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5)); @@ -245,79 +245,79 @@ public class VBORegion2PES2 implements Region { if(null == fbo) { fbo = new FBObject(tex_width_c, tex_height_c); // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth - fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ? + fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ? } else { fbo.bind(gl); } - - //render texture - PMVMatrix tex_matrix = new PMVMatrix(); - gl.glViewport(0, 0, tex_width_c, tex_height_c); - tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); - tex_matrix.glLoadIdentity(); - tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1); - - if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){ - System.out.println("Cnt set tex based mat"); - } - - gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); - renderRegion(gl); + + //render texture + PMVMatrix tex_matrix = new PMVMatrix(); + gl.glViewport(0, 0, tex_width_c, tex_height_c); + tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); + tex_matrix.glLoadIdentity(); + tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1); + + if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){ + System.out.println("Cnt set tex based mat"); + } + + gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); + renderRegion(gl); - fbo.unbind(gl); - } - - private void renderRegion(GL2ES2 gl) { + fbo.unbind(gl); + } + + private void renderRegion(GL2ES2 gl) { verticeTxtAttr.enableBuffer(gl, true); texCoordTxtAttr.enableBuffer(gl, true); indicesTxt.enableBuffer(gl, true); - - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0); - + + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0); + verticeTxtAttr.enableBuffer(gl, false); texCoordTxtAttr.enableBuffer(gl, false); indicesTxt.enableBuffer(gl, false); - } - - public void addTriangles(ArrayList<Triangle> tris) { - triangles.addAll(tris); - dirty = true; - } - - public int getNumVertices(){ - return numVertices; - } - - public void addVertices(ArrayList<Vertex> verts){ - vertices.addAll(verts); - numVertices = vertices.size(); - dirty = true; - } - - public boolean isDirty(){ - return dirty; - } - - public void destroy() { - if(DEBUG) { - System.err.println("VBORegion2PES2 Destroy: " + this); - } - GL2ES2 gl = context.getGL().getGL2ES2(); - destroyFbo(gl); + } + + public void addTriangles(ArrayList<Triangle> tris) { + triangles.addAll(tris); + dirty = true; + } + + public int getNumVertices(){ + return numVertices; + } + + public void addVertices(ArrayList<Vertex> verts){ + vertices.addAll(verts); + numVertices = vertices.size(); + dirty = true; + } + + public boolean isDirty(){ + return dirty; + } + + public void destroy() { + if(DEBUG) { + System.err.println("VBORegion2PES2 Destroy: " + this); + } + GL2ES2 gl = context.getGL().getGL2ES2(); + destroyFbo(gl); destroyTxtAttr(gl); destroyFboAttr(gl); triangles.clear(); vertices.clear(); - } - final void destroyFbo(GL2ES2 gl) { + } + final void destroyFbo(GL2ES2 gl) { if(null != fbo) { fbo.destroy(gl); fbo = null; - } - } + } + } final void destroyTxtAttr(GL2ES2 gl) { if(null != verticeTxtAttr) { verticeTxtAttr.destroy(gl); @@ -331,7 +331,7 @@ public class VBORegion2PES2 implements Region { indicesTxt.destroy(gl); indicesTxt = null; } - } + } final void destroyFboAttr(GL2ES2 gl) { if(null != verticeFboAttr) { verticeFboAttr.destroy(gl); @@ -347,15 +347,15 @@ public class VBORegion2PES2 implements Region { } } - public boolean isFlipped() { - return flipped; - } + public boolean isFlipped() { + return flipped; + } - public void setFlipped(boolean flipped) { - this.flipped = flipped; - } - - public AABBox getBounds(){ - return box; - } + public void setFlipped(boolean flipped) { + this.flipped = flipped; + } + + public AABBox getBounds(){ + return box; + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 0d68be8ce..83cd6b80d 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -41,143 +41,143 @@ import com.jogamp.opengl.util.GLArrayDataServer; import com.jogamp.opengl.util.PMVMatrix; public class VBORegionSPES2 implements Region { - private int numVertices = 0; - - private ArrayList<Triangle> triangles = new ArrayList<Triangle>(); - private ArrayList<Vertex> vertices = new ArrayList<Vertex>(); - private GLArrayDataServer verticeAttr = null; - private GLArrayDataServer texCoordAttr = null; - private GLArrayDataServer indices = null; - - private GLContext context; - - private boolean flipped = false; - private boolean dirty = false; - - private AABBox box = null; - - public VBORegionSPES2(GLContext context){ - this.context =context; - } - - public void update(){ - box = new AABBox(); - GL2ES2 gl = context.getGL().getGL2ES2(); - + private int numVertices = 0; + + private ArrayList<Triangle> triangles = new ArrayList<Triangle>(); + private ArrayList<Vertex> vertices = new ArrayList<Vertex>(); + private GLArrayDataServer verticeAttr = null; + private GLArrayDataServer texCoordAttr = null; + private GLArrayDataServer indices = null; + + private GLContext context; + + private boolean flipped = false; + private boolean dirty = false; + + private AABBox box = null; + + public VBORegionSPES2(GLContext context){ + this.context =context; + } + + public void update(){ + box = new AABBox(); + GL2ES2 gl = context.getGL().getGL2ES2(); + destroy(gl); indices = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false, triangles.size(), GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - for(Triangle t:triangles){ - final Vertex[] t_vertices = t.getVertices(); - - if(t_vertices[0].getId() == Integer.MAX_VALUE){ - t_vertices[0].setId(numVertices++); - t_vertices[1].setId(numVertices++); - t_vertices[2].setId(numVertices++); - - vertices.add(t.getVertices()[0]); - vertices.add(t.getVertices()[1]); - vertices.add(t.getVertices()[2]); + for(Triangle t:triangles){ + final Vertex[] t_vertices = t.getVertices(); + + if(t_vertices[0].getId() == Integer.MAX_VALUE){ + t_vertices[0].setId(numVertices++); + t_vertices[1].setId(numVertices++); + t_vertices[2].setId(numVertices++); + + vertices.add(t.getVertices()[0]); + vertices.add(t.getVertices()[1]); + vertices.add(t.getVertices()[2]); - indices.puts((short) t.getVertices()[0].getId()); - indices.puts((short) t.getVertices()[1].getId()); - indices.puts((short) t.getVertices()[2].getId()); - } - else{ - Vertex v1 = t_vertices[0]; - Vertex v2 = t_vertices[1]; - Vertex v3 = t_vertices[2]; - - indices.puts((short) v1.getId()); - indices.puts((short) v2.getId()); - indices.puts((short) v3.getId()); - } - } + indices.puts((short) t.getVertices()[0].getId()); + indices.puts((short) t.getVertices()[1].getId()); + indices.puts((short) t.getVertices()[2].getId()); + } + else{ + Vertex v1 = t_vertices[0]; + Vertex v2 = t_vertices[1]; + Vertex v3 = t_vertices[2]; + + indices.puts((short) v1.getId()); + indices.puts((short) v2.getId()); + indices.puts((short) v3.getId()); + } + } indices.seal(gl, true); - - verticeAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false, - vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); - verticeAttr.setLocation(Region.VERTEX_ATTR_IDX); - for(Vertex v:vertices){ - - if(flipped){ - verticeAttr.putf(v.getX()); - verticeAttr.putf(-1*v.getY()); - verticeAttr.putf(v.getZ()); - - box.resize(v.getX(),-1*v.getY(),v.getZ()); - } - else{ - verticeAttr.putf(v.getX()); - verticeAttr.putf(v.getY()); - verticeAttr.putf(v.getZ()); - - box.resize(v.getX(),v.getY(),v.getZ()); - } - } - verticeAttr.seal(gl, true); + + verticeAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false, + vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); + verticeAttr.setLocation(Region.VERTEX_ATTR_IDX); + for(Vertex v:vertices){ + + if(flipped){ + verticeAttr.putf(v.getX()); + verticeAttr.putf(-1*v.getY()); + verticeAttr.putf(v.getZ()); + + box.resize(v.getX(),-1*v.getY(),v.getZ()); + } + else{ + verticeAttr.putf(v.getX()); + verticeAttr.putf(v.getY()); + verticeAttr.putf(v.getZ()); + + box.resize(v.getX(),v.getY(),v.getZ()); + } + } + verticeAttr.seal(gl, true); texCoordAttr = GLArrayDataServer.createGLSL(gl, Region.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); texCoordAttr.setLocation(Region.TEXCOORD_ATTR_IDX); - for(Vertex v:vertices){ - float[] tex = v.getTexCoord(); - texCoordAttr.putf(tex[0]); - texCoordAttr.putf(tex[1]); - } - texCoordAttr.seal(gl, true); + for(Vertex v:vertices){ + float[] tex = v.getTexCoord(); + texCoordAttr.putf(tex[0]); + texCoordAttr.putf(tex[1]); + } + texCoordAttr.seal(gl, true); verticeAttr.enableBuffer(gl, false); texCoordAttr.enableBuffer(gl, false); indices.enableBuffer(gl, false); - dirty = false; - } - - private void render() { - GL2ES2 gl = context.getGL().getGL2ES2(); + dirty = false; + } + + private void render() { + GL2ES2 gl = context.getGL().getGL2ES2(); verticeAttr.enableBuffer(gl, true); texCoordAttr.enableBuffer(gl, true); indices.enableBuffer(gl, true); - - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0); - + + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0); + verticeAttr.enableBuffer(gl, false); texCoordAttr.enableBuffer(gl, false); indices.enableBuffer(gl, false); - } - - public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){ - render(); - } - - public void addTriangles(ArrayList<Triangle> tris) { - triangles.addAll(tris); - dirty = true; - } - - public int getNumVertices(){ - return numVertices; - } - - public void addVertices(ArrayList<Vertex> verts){ - vertices.addAll(verts); - numVertices = vertices.size(); - dirty = true; - } - - public boolean isDirty(){ - return dirty; - } - - public void destroy() { - GL2ES2 gl = context.getGL().getGL2ES2(); - destroy(gl); - } - - final void destroy(GL2ES2 gl) { + } + + public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){ + render(); + } + + public void addTriangles(ArrayList<Triangle> tris) { + triangles.addAll(tris); + dirty = true; + } + + public int getNumVertices(){ + return numVertices; + } + + public void addVertices(ArrayList<Vertex> verts){ + vertices.addAll(verts); + numVertices = vertices.size(); + dirty = true; + } + + public boolean isDirty(){ + return dirty; + } + + public void destroy() { + GL2ES2 gl = context.getGL().getGL2ES2(); + destroy(gl); + } + + final void destroy(GL2ES2 gl) { if(null != verticeAttr) { verticeAttr.destroy(gl); verticeAttr = null; @@ -190,16 +190,16 @@ public class VBORegionSPES2 implements Region { indices.destroy(gl); indices = null; } - } - - public boolean isFlipped() { - return flipped; - } + } + + public boolean isFlipped() { + return flipped; + } - public void setFlipped(boolean flipped) { - this.flipped = flipped; - } - public AABBox getBounds(){ - return box; - } + public void setFlipped(boolean flipped) { + this.flipped = flipped; + } + public AABBox getBounds(){ + return box; + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp index 3a1ef5157..166937f7f 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp @@ -15,81 +15,81 @@ vec4 weights = vec4(0.075, 0.06, 0.045, 0.025); void main (void) { - vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y)); - vec3 c = g_color; - - float alpha = 0.0; - - if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){ - alpha = g_alpha; - } - else if((v_texCoord.x >= 5.0)){ - vec2 dfx = dFdx(v_texCoord); - vec2 dfy = dFdy(v_texCoord); - - vec2 size = 1.0/textureSize(texture,0); //version 130 - rtex -= 5.0; - vec4 t = texture2D(texture, rtex)* 0.18; + vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y)); + vec3 c = g_color; + + float alpha = 0.0; + + if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){ + alpha = g_alpha; + } + else if((v_texCoord.x >= 5.0)){ + vec2 dfx = dFdx(v_texCoord); + vec2 dfy = dFdy(v_texCoord); + + vec2 size = 1.0/textureSize(texture,0); //version 130 + rtex -= 5.0; + vec4 t = texture2D(texture, rtex)* 0.18; - t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x; - t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x; - t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x; - t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x; - - t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y; - t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y; - t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y; - t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y; - - t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z; - t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z; - t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z; - t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z; - - t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w; - t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w; - t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w; - t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w; - - if(t.w == 0.0){ - discard; - } - - c = t.xyz; - alpha = g_alpha* t.w; - } - /////////////////////////////////////////////////////////// - else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){ - vec2 dtx = dFdx(rtex); - vec2 dty = dFdy(rtex); - - rtex.y -= 0.1; - - if(rtex.y < 0.0) { - if(v_texCoord.y < 0.0) - discard; - else{ - rtex.y = 0.0; - } - } - - vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); - float position = rtex.y - (rtex.x * (1.0 - rtex.x)); - float d = position/(length(f)); + t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x; + t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x; + t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x; + t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x; + + t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y; + t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y; + t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y; + t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y; + + t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z; + t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z; + t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z; + t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z; + + t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w; + t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w; + t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w; + t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w; + + if(t.w == 0.0){ + discard; + } + + c = t.xyz; + alpha = g_alpha* t.w; + } + /////////////////////////////////////////////////////////// + else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){ + vec2 dtx = dFdx(rtex); + vec2 dty = dFdy(rtex); + + rtex.y -= 0.1; + + if(rtex.y < 0.0) { + if(v_texCoord.y < 0.0) + discard; + else{ + rtex.y = 0.0; + } + } + + vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); + float position = rtex.y - (rtex.x * (1.0 - rtex.x)); + float d = position/(length(f)); - float a = (0.5 - d * sign(v_texCoord.y)); - - if (a >= 1.0) { - alpha = g_alpha; - } - else if (a <= 0.0) { - alpha = 0.0;//discard; - } - else { - alpha = g_alpha*a; - mix(b_color,g_color, a); - } - } - + float a = (0.5 - d * sign(v_texCoord.y)); + + if (a >= 1.0) { + alpha = g_alpha; + } + else if (a <= 0.0) { + alpha = 0.0;//discard; + } + else { + alpha = g_alpha*a; + mix(b_color,g_color, a); + } + } + gl_FragColor = vec4(c, alpha); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java index 5dae296e5..a0d1923a9 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java @@ -33,49 +33,49 @@ import com.jogamp.graph.geom.Outline; import com.jogamp.graph.geom.Vertex; public class GraphOutline { - final private Outline outline; - final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3); - - public GraphOutline(){ - this.outline = new Outline(); - } - - /**Create a control polyline of control vertices - * the curve pieces can be identified by onCurve flag - * of each cp the control polyline is open by default - */ - public GraphOutline(Outline ol){ - this.outline = ol; - ArrayList<Vertex> vertices = this.outline.getVertices(); - for(Vertex v:vertices){ - this.controlpoints.add(new GraphVertex(v)); - } - } + final private Outline outline; + final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3); + + public GraphOutline(){ + this.outline = new Outline(); + } + + /**Create a control polyline of control vertices + * the curve pieces can be identified by onCurve flag + * of each cp the control polyline is open by default + */ + public GraphOutline(Outline ol){ + this.outline = ol; + ArrayList<Vertex> vertices = this.outline.getVertices(); + for(Vertex v:vertices){ + this.controlpoints.add(new GraphVertex(v)); + } + } - public Outline getOutline() { - return outline; - } + public Outline getOutline() { + return outline; + } - /*public void setOutline(Outline<T> outline) { - this.outline = outline; - }*/ - + /*public void setOutline(Outline<T> outline) { + this.outline = outline; + }*/ + - public ArrayList<GraphVertex> getGraphPoint() { - return controlpoints; - } - - public ArrayList<Vertex> getPoints() { - return outline.getVertices(); - } + public ArrayList<GraphVertex> getGraphPoint() { + return controlpoints; + } + + public ArrayList<Vertex> getPoints() { + return outline.getVertices(); + } - /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) { - this.controlpoints = controlpoints; - }*/ + /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) { + this.controlpoints = controlpoints; + }*/ - public void addVertex(GraphVertex v) { - controlpoints.add(v); - outline.addVertex(v.getPoint()); - } - + public void addVertex(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 b9f95a0e7..5efe57c28 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java @@ -32,89 +32,89 @@ import java.util.ArrayList; import com.jogamp.graph.geom.Vertex; public class GraphVertex { - private Vertex point; - private ArrayList<HEdge> edges = null; - private boolean boundaryContained = false; - - public GraphVertex(Vertex point) { - this.point = point; - } + private Vertex point; + private ArrayList<HEdge> edges = null; + private boolean boundaryContained = false; + + public GraphVertex(Vertex point) { + this.point = point; + } - public Vertex getPoint() { - return point; - } - - public float getX(){ - return point.getX(); - } - - public float getY(){ - return point.getY(); - } - - public float getZ(){ - return point.getZ(); - } - public float[] getCoord() { - return point.getCoord(); - } + public Vertex getPoint() { + return point; + } + + public float getX(){ + return point.getX(); + } + + public float getY(){ + return point.getY(); + } + + public float getZ(){ + return point.getZ(); + } + public float[] getCoord() { + return point.getCoord(); + } - public void setPoint(Vertex point) { - this.point = point; - } + public void setPoint(Vertex point) { + this.point = point; + } - public ArrayList<HEdge> getEdges() { - return edges; - } + public ArrayList<HEdge> getEdges() { + return edges; + } - public void setEdges(ArrayList<HEdge> edges) { - this.edges = edges; - } - - public void addEdge(HEdge edge){ - if(edges == null){ - edges = new ArrayList<HEdge>(); - } - edges.add(edge); - } - public void removeEdge(HEdge edge){ - if(edges == null) - return; - edges.remove(edge); - if(edges.size() == 0){ - edges = null; - } - } - public HEdge findNextEdge(GraphVertex nextVert){ - for(HEdge e:edges){ - if(e.getNext().getGraphPoint() == nextVert){ - return e; - } - } - return null; - } - public HEdge findBoundEdge(){ - for(HEdge e:edges){ - if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){ - return e; - } - } - return null; - } - public HEdge findPrevEdge(GraphVertex prevVert){ - for(HEdge e:edges){ - if(e.getPrev().getGraphPoint() == prevVert){ - return e; - } - } - return null; - } - - public boolean isBoundaryContained() { - return boundaryContained; - } + public void setEdges(ArrayList<HEdge> edges) { + this.edges = edges; + } + + public void addEdge(HEdge edge){ + if(edges == null){ + edges = new ArrayList<HEdge>(); + } + edges.add(edge); + } + public void removeEdge(HEdge edge){ + if(edges == null) + return; + edges.remove(edge); + if(edges.size() == 0){ + edges = null; + } + } + public HEdge findNextEdge(GraphVertex nextVert){ + for(HEdge e:edges){ + if(e.getNext().getGraphPoint() == nextVert){ + return e; + } + } + return null; + } + public HEdge findBoundEdge(){ + for(HEdge e:edges){ + if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){ + return e; + } + } + return null; + } + public HEdge findPrevEdge(GraphVertex prevVert){ + for(HEdge e:edges){ + if(e.getPrev().getGraphPoint() == prevVert){ + return e; + } + } + return null; + } + + public boolean isBoundaryContained() { + return boundaryContained; + } - public void setBoundaryContained(boolean boundaryContained) { - this.boundaryContained = boundaryContained; - } + public void setBoundaryContained(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 d1bcc6e17..4d29a81f3 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java @@ -32,99 +32,99 @@ import com.jogamp.graph.geom.Triangle; public class HEdge { - public static int BOUNDARY = 3; - public static int INNER = 1; - public static int HOLE = 2; - - private GraphVertex vert; - private HEdge prev = null; - private HEdge next = null; - private HEdge sibling = null; - private int type = BOUNDARY; - private Triangle triangle = null; - - public HEdge(GraphVertex vert, int type) { - this.vert = vert; - this.type = type; - } - - public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) { - this.vert = vert; - this.prev = prev; - this.next = next; - this.sibling = sibling; - this.type = type; - } - - public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) { - this.vert = vert; - this.prev = prev; - this.next = next; - this.sibling = sibling; - this.type = type; - this.triangle = triangle; - } - - public GraphVertex getGraphPoint() { - return vert; - } - - public void setVert(GraphVertex vert) { - this.vert = vert; - } - - public HEdge getPrev() { - return prev; - } - - public void setPrev(HEdge prev) { - this.prev = prev; - } - - public HEdge getNext() { - return next; - } - - public void setNext(HEdge next) { - this.next = next; - } - - public HEdge getSibling() { - return sibling; - } - - public void setSibling(HEdge sibling) { - this.sibling = sibling; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public Triangle getTriangle() { - return triangle; - } - - public void setTriangle(Triangle triangle) { - this.triangle = triangle; - } - - public static <T extends Vertex> void connect(HEdge first, HEdge next){ - first.setNext(next); - next.setPrev(first); - } - - public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){ - first.setSibling(second); - second.setSibling(first); - } - - public boolean vertexOnCurveVertex(){ - return vert.getPoint().isOnCurve(); - } - + public static int BOUNDARY = 3; + public static int INNER = 1; + public static int HOLE = 2; + + private GraphVertex vert; + private HEdge prev = null; + private HEdge next = null; + private HEdge sibling = null; + private int type = BOUNDARY; + private Triangle triangle = null; + + public HEdge(GraphVertex vert, int type) { + this.vert = vert; + this.type = type; + } + + public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) { + this.vert = vert; + this.prev = prev; + this.next = next; + this.sibling = sibling; + this.type = type; + } + + public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) { + this.vert = vert; + this.prev = prev; + this.next = next; + this.sibling = sibling; + this.type = type; + this.triangle = triangle; + } + + public GraphVertex getGraphPoint() { + return vert; + } + + public void setVert(GraphVertex vert) { + this.vert = vert; + } + + public HEdge getPrev() { + return prev; + } + + public void setPrev(HEdge prev) { + this.prev = prev; + } + + public HEdge getNext() { + return next; + } + + public void setNext(HEdge next) { + this.next = next; + } + + public HEdge getSibling() { + return sibling; + } + + public void setSibling(HEdge sibling) { + this.sibling = sibling; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public Triangle getTriangle() { + return triangle; + } + + public void setTriangle(Triangle triangle) { + this.triangle = triangle; + } + + public static <T extends Vertex> void connect(HEdge first, HEdge next){ + first.setNext(next); + next.setPrev(first); + } + + public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){ + first.setSibling(second); + second.setSibling(first); + } + + public boolean vertexOnCurveVertex(){ + return vert.getPoint().isOnCurve(); + } + } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index fd7736a20..9e29d3973 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -36,338 +36,338 @@ import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.math.VectorUtil; public class Loop { - private HEdge root = null; - private AABBox box = new AABBox(); - private GraphOutline initialOutline = null; - - public Loop(GraphOutline polyline, int direction){ - initialOutline = polyline; - this.root = initFromPolyline(initialOutline, direction); - } - - public HEdge getHEdge(){ - return root; - } - - public Triangle cut(boolean delaunay){ - if(isSimplex()){ - Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), - root.getNext().getNext().getGraphPoint().getPoint()); - t.setVerticesBoundary(checkVerticesBoundary(root)); - return t; - } - HEdge prev = root.getPrev(); - HEdge next1 = root.getNext(); - - HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay); - if(next2 == null){ - root = root.getNext(); - return null; - } - - GraphVertex v1 = root.getGraphPoint(); - GraphVertex v2 = next1.getGraphPoint(); - GraphVertex v3 = next2.getGraphPoint(); - - HEdge v3Edge = new HEdge(v3, HEdge.INNER); - - HEdge.connect(v3Edge, root); - HEdge.connect(next1, v3Edge); - - HEdge v3EdgeSib = v3Edge.getSibling(); - if(v3EdgeSib == null){ - v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER); - HEdge.makeSiblings(v3Edge, v3EdgeSib); - } - - HEdge.connect(prev, v3EdgeSib); - HEdge.connect(v3EdgeSib, next2); - - Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root); - this.root = next2; - return t; - } - - public boolean isSimplex(){ - return (root.getNext().getNext().getNext() == root); - } - - /**Create a connected list of half edges (loop) - * from the boundary profile - * @param direction requested winding of edges (CCW or CW) - */ - private HEdge initFromPolyline(GraphOutline outline, int direction){ - ArrayList<GraphVertex> vertices = outline.getGraphPoint(); - - if(vertices.size()<3) { - throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); - } - boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(), - vertices.get(2).getPoint()); - boolean invert = isCCW && (direction == VectorUtil.CW); - - HEdge firstEdge = null; - HEdge lastEdge = null; - int index =0; - int max = vertices.size(); - - int edgeType = HEdge.BOUNDARY; - if(invert){ - index = vertices.size() -1; - max = -1; - edgeType = HEdge.HOLE; - } - - while(index != max){ - GraphVertex v1 = vertices.get(index); - box.resize(v1.getX(), v1.getY(), v1.getZ()); - - HEdge edge = new HEdge(v1, edgeType); - - v1.addEdge(edge); - if(lastEdge != null){ - lastEdge.setNext(edge); - edge.setPrev(lastEdge); - } - else{ - firstEdge = edge; - } - - if(!invert){ - if(index == vertices.size()-1){ - edge.setNext(firstEdge); - firstEdge.setPrev(edge); - } - } - else if (index == 0){ - edge.setNext(firstEdge); - firstEdge.setPrev(edge); - } - - lastEdge = edge; - - if(!invert){ - index++; - } - else{ - index--; - } - } - return firstEdge; - } - - public void addConstraintCurve(GraphOutline polyline) { - // GraphOutline outline = new GraphOutline(polyline); - /**needed to generate vertex references.*/ - initFromPolyline(polyline, VectorUtil.CW); - - GraphVertex v3 = locateClosestVertex(polyline); - HEdge v3Edge = v3.findBoundEdge(); - HEdge v3EdgeP = v3Edge.getPrev(); - HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); - - HEdge.connect(root.getPrev(), crossEdge); - HEdge.connect(crossEdge, v3Edge); - - HEdge crossEdgeSib = crossEdge.getSibling(); - if(crossEdgeSib == null) { - crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER); - HEdge.makeSiblings(crossEdge, crossEdgeSib); - } - - HEdge.connect(v3EdgeP, crossEdgeSib); - HEdge.connect(crossEdgeSib, root); - } - - /** Locates the vertex and update the loops root - * to have (root + vertex) as closest pair - * @param polyline the control polyline - * to search for closestvertices - * @return the vertex that is closest to the newly set root Hedge. - */ - private GraphVertex locateClosestVertex(GraphOutline polyline) { - HEdge closestE = null; - GraphVertex closestV = null; - - float minDistance = Float.MAX_VALUE; - boolean inValid = false; - ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint(); - ArrayList<GraphVertex> vertices = polyline.getGraphPoint(); - - for(int i=0; i< initVertices.size()-1; i++){ - GraphVertex v = initVertices.get(i); - GraphVertex nextV = initVertices.get(i+1); - for(GraphVertex cand:vertices){ - float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord()); - if(distance < minDistance){ - for (GraphVertex vert:vertices){ - if(vert == v || vert == nextV || vert == cand) - continue; - inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), - cand.getPoint(), vert.getPoint()); - if(inValid){ - break; - } - } - if(!inValid){ - closestV = cand; - minDistance = distance; - closestE = v.findBoundEdge(); - } - } - - } - } - - if(closestE != null){ - root = closestE; - } - - return closestV; - } - - private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) { - HEdge next = root.getNext(); - - if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), - edge.getGraphPoint().getPoint())){ - return null; - } - - HEdge candEdge = edge; - boolean inValid = false; - - if(delaunay){ - Vertex cand = candEdge.getGraphPoint().getPoint(); - HEdge e = candEdge.getNext(); - while (e != candEdge){ - if(e.getGraphPoint() == root.getGraphPoint() - || e.getGraphPoint() == next.getGraphPoint() - || e.getGraphPoint().getPoint() == cand){ - e = e.getNext(); - continue; - } - inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), - cand, e.getGraphPoint().getPoint()); - if(inValid){ - break; - } - e = e.getNext(); - } - } - if(!inValid){ - return candEdge; - } - return null; - } - - /** Create a triangle from the param vertices only if - * the triangle is valid. IE not outside region. - * @param v1 vertex 1 - * @param v2 vertex 2 - * @param v3 vertex 3 - * @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){ - Triangle t = new Triangle(v1, v2, v3); - t.setVerticesBoundary(checkVerticesBoundary(rootT)); - return t; - } - - private boolean[] checkVerticesBoundary(HEdge rootT) { - boolean[] boundary = new boolean[3]; - HEdge e1 = rootT; - HEdge e2 = rootT.getNext(); - HEdge e3 = rootT.getNext().getNext(); - - if(e1.getGraphPoint().isBoundaryContained()){ - boundary[0] = true; - } - if(e2.getGraphPoint().isBoundaryContained()){ - boundary[1] = true; - } - if(e3.getGraphPoint().isBoundaryContained()){ - boundary[2] = true; - } - return boundary; - } - - - /** Check if vertex inside the Loop - * @param vertex the Vertex - * @return true if the vertex is inside, false otherwise - */ - public boolean checkInside(Vertex vertex) { - if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){ - return false; - } - - float[] center = box.getCenter(); - - int hits = 0; - HEdge current = root; - HEdge next = root.getNext(); - while(next!= root){ - if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){ - current = next; - next = current.getNext(); - continue; - } - Vertex vert1 = current.getGraphPoint().getPoint(); - Vertex vert2 = next.getGraphPoint().getPoint(); - - /** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0. - * The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1. - * perp(x,y) = (y,-x). - * if Dot(perp(D1),D0) is not zero, - * s = Dot(perp(D1),P1-P0)/Dot(perp(D1),D0) - * t = Dot(perp(D0),P1-P0)/Dot(perp(D1),D0) - */ - - float[] d0 = new float[]{center[0] - vertex.getX(), center[1]-vertex.getY(), - center[2]-vertex.getZ()}; - float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(), - vert2.getZ() - vert1.getZ()}; - - float[] prep_d1 = {d1[1],-1*d1[0], d1[2]}; - float[] prep_d0 = {d0[1],-1*d0[0], d0[2]}; - - float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(), - vert1.getZ() - vertex.getZ()}; - - float dotD1D0 = VectorUtil.dot(prep_d1, d0); - if(dotD1D0 == 0){ - /** ray parallel to segment */ - current = next; - next = current.getNext(); - continue; - } - - float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0; - float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0; - - if(s >= 0 && t >= 0 && t<= 1){ - hits++; - } - current = next; - next = current.getNext(); - } - - if(hits % 2 != 0){ - /** check if hit count is even */ - return true; - } - return false; - } - - public int computeLoopSize(){ - int size = 0; - HEdge e = root; - do{ - size++; - e = e.getNext(); - }while(e != root); - return size; - } + private HEdge root = null; + private AABBox box = new AABBox(); + private GraphOutline initialOutline = null; + + public Loop(GraphOutline polyline, int direction){ + initialOutline = polyline; + this.root = initFromPolyline(initialOutline, direction); + } + + public HEdge getHEdge(){ + return root; + } + + public Triangle cut(boolean delaunay){ + if(isSimplex()){ + Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), + root.getNext().getNext().getGraphPoint().getPoint()); + t.setVerticesBoundary(checkVerticesBoundary(root)); + return t; + } + HEdge prev = root.getPrev(); + HEdge next1 = root.getNext(); + + HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay); + if(next2 == null){ + root = root.getNext(); + return null; + } + + GraphVertex v1 = root.getGraphPoint(); + GraphVertex v2 = next1.getGraphPoint(); + GraphVertex v3 = next2.getGraphPoint(); + + HEdge v3Edge = new HEdge(v3, HEdge.INNER); + + HEdge.connect(v3Edge, root); + HEdge.connect(next1, v3Edge); + + HEdge v3EdgeSib = v3Edge.getSibling(); + if(v3EdgeSib == null){ + v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER); + HEdge.makeSiblings(v3Edge, v3EdgeSib); + } + + HEdge.connect(prev, v3EdgeSib); + HEdge.connect(v3EdgeSib, next2); + + Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root); + this.root = next2; + return t; + } + + public boolean isSimplex(){ + return (root.getNext().getNext().getNext() == root); + } + + /**Create a connected list of half edges (loop) + * from the boundary profile + * @param direction requested winding of edges (CCW or CW) + */ + private HEdge initFromPolyline(GraphOutline outline, int direction){ + ArrayList<GraphVertex> vertices = outline.getGraphPoint(); + + if(vertices.size()<3) { + throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); + } + boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(), + vertices.get(2).getPoint()); + boolean invert = isCCW && (direction == VectorUtil.CW); + + HEdge firstEdge = null; + HEdge lastEdge = null; + int index =0; + int max = vertices.size(); + + int edgeType = HEdge.BOUNDARY; + if(invert){ + index = vertices.size() -1; + max = -1; + edgeType = HEdge.HOLE; + } + + while(index != max){ + GraphVertex v1 = vertices.get(index); + box.resize(v1.getX(), v1.getY(), v1.getZ()); + + HEdge edge = new HEdge(v1, edgeType); + + v1.addEdge(edge); + if(lastEdge != null){ + lastEdge.setNext(edge); + edge.setPrev(lastEdge); + } + else{ + firstEdge = edge; + } + + if(!invert){ + if(index == vertices.size()-1){ + edge.setNext(firstEdge); + firstEdge.setPrev(edge); + } + } + else if (index == 0){ + edge.setNext(firstEdge); + firstEdge.setPrev(edge); + } + + lastEdge = edge; + + if(!invert){ + index++; + } + else{ + index--; + } + } + return firstEdge; + } + + public void addConstraintCurve(GraphOutline polyline) { + // GraphOutline outline = new GraphOutline(polyline); + /**needed to generate vertex references.*/ + initFromPolyline(polyline, VectorUtil.CW); + + GraphVertex v3 = locateClosestVertex(polyline); + HEdge v3Edge = v3.findBoundEdge(); + HEdge v3EdgeP = v3Edge.getPrev(); + HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); + + HEdge.connect(root.getPrev(), crossEdge); + HEdge.connect(crossEdge, v3Edge); + + HEdge crossEdgeSib = crossEdge.getSibling(); + if(crossEdgeSib == null) { + crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER); + HEdge.makeSiblings(crossEdge, crossEdgeSib); + } + + HEdge.connect(v3EdgeP, crossEdgeSib); + HEdge.connect(crossEdgeSib, root); + } + + /** Locates the vertex and update the loops root + * to have (root + vertex) as closest pair + * @param polyline the control polyline + * to search for closestvertices + * @return the vertex that is closest to the newly set root Hedge. + */ + private GraphVertex locateClosestVertex(GraphOutline polyline) { + HEdge closestE = null; + GraphVertex closestV = null; + + float minDistance = Float.MAX_VALUE; + boolean inValid = false; + ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint(); + ArrayList<GraphVertex> vertices = polyline.getGraphPoint(); + + for(int i=0; i< initVertices.size()-1; i++){ + GraphVertex v = initVertices.get(i); + GraphVertex nextV = initVertices.get(i+1); + for(GraphVertex cand:vertices){ + float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord()); + if(distance < minDistance){ + for (GraphVertex vert:vertices){ + if(vert == v || vert == nextV || vert == cand) + continue; + inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), + cand.getPoint(), vert.getPoint()); + if(inValid){ + break; + } + } + if(!inValid){ + closestV = cand; + minDistance = distance; + closestE = v.findBoundEdge(); + } + } + + } + } + + if(closestE != null){ + root = closestE; + } + + return closestV; + } + + private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) { + HEdge next = root.getNext(); + + if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), + edge.getGraphPoint().getPoint())){ + return null; + } + + HEdge candEdge = edge; + boolean inValid = false; + + if(delaunay){ + Vertex cand = candEdge.getGraphPoint().getPoint(); + HEdge e = candEdge.getNext(); + while (e != candEdge){ + if(e.getGraphPoint() == root.getGraphPoint() + || e.getGraphPoint() == next.getGraphPoint() + || e.getGraphPoint().getPoint() == cand){ + e = e.getNext(); + continue; + } + inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), + cand, e.getGraphPoint().getPoint()); + if(inValid){ + break; + } + e = e.getNext(); + } + } + if(!inValid){ + return candEdge; + } + return null; + } + + /** Create a triangle from the param vertices only if + * the triangle is valid. IE not outside region. + * @param v1 vertex 1 + * @param v2 vertex 2 + * @param v3 vertex 3 + * @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){ + Triangle t = new Triangle(v1, v2, v3); + t.setVerticesBoundary(checkVerticesBoundary(rootT)); + return t; + } + + private boolean[] checkVerticesBoundary(HEdge rootT) { + boolean[] boundary = new boolean[3]; + HEdge e1 = rootT; + HEdge e2 = rootT.getNext(); + HEdge e3 = rootT.getNext().getNext(); + + if(e1.getGraphPoint().isBoundaryContained()){ + boundary[0] = true; + } + if(e2.getGraphPoint().isBoundaryContained()){ + boundary[1] = true; + } + if(e3.getGraphPoint().isBoundaryContained()){ + boundary[2] = true; + } + return boundary; + } + + + /** Check if vertex inside the Loop + * @param vertex the Vertex + * @return true if the vertex is inside, false otherwise + */ + public boolean checkInside(Vertex vertex) { + if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){ + return false; + } + + float[] center = box.getCenter(); + + int hits = 0; + HEdge current = root; + HEdge next = root.getNext(); + while(next!= root){ + if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){ + current = next; + next = current.getNext(); + continue; + } + Vertex vert1 = current.getGraphPoint().getPoint(); + Vertex vert2 = next.getGraphPoint().getPoint(); + + /** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0. + * The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1. + * perp(x,y) = (y,-x). + * if Dot(perp(D1),D0) is not zero, + * s = Dot(perp(D1),P1-P0)/Dot(perp(D1),D0) + * t = Dot(perp(D0),P1-P0)/Dot(perp(D1),D0) + */ + + float[] d0 = new float[]{center[0] - vertex.getX(), center[1]-vertex.getY(), + center[2]-vertex.getZ()}; + float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(), + vert2.getZ() - vert1.getZ()}; + + float[] prep_d1 = {d1[1],-1*d1[0], d1[2]}; + float[] prep_d0 = {d0[1],-1*d0[0], d0[2]}; + + float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(), + vert1.getZ() - vertex.getZ()}; + + float dotD1D0 = VectorUtil.dot(prep_d1, d0); + if(dotD1D0 == 0){ + /** ray parallel to segment */ + current = next; + next = current.getNext(); + continue; + } + + float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0; + float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0; + + if(s >= 0 && t >= 0 && t<= 1){ + hits++; + } + current = next; + next = current.getNext(); + } + + if(hits % 2 != 0){ + /** check if hit count is even */ + return true; + } + return false; + } + + public int computeLoopSize(){ + int size = 0; + HEdge e = root; + do{ + size++; + e = e.getNext(); + }while(e != root); + return size; + } } diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java index 36ba57244..4d1880064 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java @@ -38,124 +38,124 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.math.Quaternion; public class GlyphShape { - - private Quaternion quat= null; - private int numVertices = 0; - private OutlineShape shape = null; - - /** Create a new Glyph shape - * based on Parametric curve control polyline - */ - public GlyphShape(Vertex.Factory<? extends Vertex> factory){ - shape = new OutlineShape(factory); - } - - /** Create a GlyphShape from a font Path Iterator - * @param pathIterator the path iterator - * - * @see PathIterator - */ - public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){ - this(factory); - - if(null != pathIterator){ - while(!pathIterator.isDone()){ - float[] coords = new float[6]; - int segmentType = pathIterator.currentSegment(coords); - addOutlineVerticesFromGlyphVector(coords, segmentType); + + private Quaternion quat= null; + private int numVertices = 0; + private OutlineShape shape = null; + + /** Create a new Glyph shape + * based on Parametric curve control polyline + */ + public GlyphShape(Vertex.Factory<? extends Vertex> factory){ + shape = new OutlineShape(factory); + } + + /** Create a GlyphShape from a font Path Iterator + * @param pathIterator the path iterator + * + * @see PathIterator + */ + public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){ + this(factory); + + if(null != pathIterator){ + while(!pathIterator.isDone()){ + float[] coords = new float[6]; + int segmentType = pathIterator.currentSegment(coords); + addOutlineVerticesFromGlyphVector(coords, segmentType); - pathIterator.next(); - } - } - shape.transformOutlines(OutlineShape.QUADRATIC_NURBS); - } - - public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); } - - private void addVertexToLastOutline(Vertex vertex){ - shape.addVertex(vertex); - } - - private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){ - if(segmentType == PathIterator.SEG_MOVETO){ - if(!shape.getLastOutline().isEmpty()){ - shape.addEmptyOutline(); - } - Vertex vert = vertexFactory().create(coords[0],coords[1]); - vert.setOnCurve(true); - addVertexToLastOutline(vert); - - numVertices++; - } - else if(segmentType == PathIterator.SEG_LINETO){ - Vertex vert1 = vertexFactory().create(coords[0],coords[1]); - vert1.setOnCurve(true); - addVertexToLastOutline(vert1); - - numVertices++; - } - else if(segmentType == PathIterator.SEG_QUADTO){ - Vertex vert1 = vertexFactory().create(coords[0],coords[1]); - vert1.setOnCurve(false); - addVertexToLastOutline(vert1); + pathIterator.next(); + } + } + shape.transformOutlines(OutlineShape.QUADRATIC_NURBS); + } + + public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); } + + private void addVertexToLastOutline(Vertex vertex){ + shape.addVertex(vertex); + } + + private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){ + if(segmentType == PathIterator.SEG_MOVETO){ + if(!shape.getLastOutline().isEmpty()){ + shape.addEmptyOutline(); + } + Vertex vert = vertexFactory().create(coords[0],coords[1]); + vert.setOnCurve(true); + addVertexToLastOutline(vert); + + numVertices++; + } + else if(segmentType == PathIterator.SEG_LINETO){ + Vertex vert1 = vertexFactory().create(coords[0],coords[1]); + vert1.setOnCurve(true); + addVertexToLastOutline(vert1); + + numVertices++; + } + else if(segmentType == PathIterator.SEG_QUADTO){ + Vertex vert1 = vertexFactory().create(coords[0],coords[1]); + vert1.setOnCurve(false); + addVertexToLastOutline(vert1); - Vertex vert2 = vertexFactory().create(coords[2],coords[3]); - vert2.setOnCurve(true); - addVertexToLastOutline(vert2); - - numVertices+=2; - } - else if(segmentType == PathIterator.SEG_CUBICTO){ - Vertex vert1 = vertexFactory().create(coords[0],coords[1]); - vert1.setOnCurve(false); - addVertexToLastOutline(vert1); + Vertex vert2 = vertexFactory().create(coords[2],coords[3]); + vert2.setOnCurve(true); + addVertexToLastOutline(vert2); + + numVertices+=2; + } + else if(segmentType == PathIterator.SEG_CUBICTO){ + Vertex vert1 = vertexFactory().create(coords[0],coords[1]); + vert1.setOnCurve(false); + addVertexToLastOutline(vert1); - Vertex vert2 = vertexFactory().create(coords[2],coords[3]); - vert2.setOnCurve(false); - addVertexToLastOutline(vert2); + Vertex vert2 = vertexFactory().create(coords[2],coords[3]); + vert2.setOnCurve(false); + addVertexToLastOutline(vert2); - Vertex vert3 = vertexFactory().create(coords[4],coords[5]); - vert3.setOnCurve(true); - addVertexToLastOutline(vert3); - - numVertices+=3; - } - else if(segmentType == PathIterator.SEG_CLOSE){ - shape.closeLastOutline(); - } - } - - public int getNumVertices() { - return numVertices; - } - - /** Get the rotational Quaternion attached to this Shape - * @return the Quaternion Object - */ - public Quaternion getQuat() { - return quat; - } - - /** Set the Quaternion that shall defien the rotation - * of this shape. - * @param quat - */ - public void setQuat(Quaternion quat) { - this.quat = quat; - } - - /** Triangluate the glyph shape - * @param sharpness sharpness of the curved regions default = 0.5 - * @return ArrayList of triangles which define this shape - */ - public ArrayList<Triangle> triangulate(float sharpness){ - return shape.triangulate(sharpness); - } + Vertex vert3 = vertexFactory().create(coords[4],coords[5]); + vert3.setOnCurve(true); + addVertexToLastOutline(vert3); + + numVertices+=3; + } + else if(segmentType == PathIterator.SEG_CLOSE){ + shape.closeLastOutline(); + } + } + + public int getNumVertices() { + return numVertices; + } + + /** Get the rotational Quaternion attached to this Shape + * @return the Quaternion Object + */ + public Quaternion getQuat() { + return quat; + } + + /** Set the Quaternion that shall defien the rotation + * of this shape. + * @param quat + */ + public void setQuat(Quaternion quat) { + this.quat = quat; + } + + /** Triangluate the glyph shape + * @param sharpness sharpness of the curved regions default = 0.5 + * @return ArrayList of triangles which define this shape + */ + public ArrayList<Triangle> triangulate(float sharpness){ + return shape.triangulate(sharpness); + } - /** Get the list of Vertices of this Object - * @return arrayList of Vertices - */ - public ArrayList<Vertex> getVertices(){ - return shape.getVertices(); - } + /** Get the list of Vertices of this Object + * @return arrayList of Vertices + */ + public ArrayList<Vertex> getVertices(){ + return shape.getVertices(); + } } diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java index 7c7bb816f..705613447 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java @@ -47,122 +47,122 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderState; public class GlyphString { - private final Vertex.Factory<? extends Vertex> pointFactory; - private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>(); - private String str = ""; - private String fontname = ""; - private Region region; - - private SVertex origin = new SVertex(); + private final Vertex.Factory<? extends Vertex> pointFactory; + private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>(); + private String str = ""; + private String fontname = ""; + private Region region; + + private SVertex origin = new SVertex(); - /** Create a new GlyphString object - * @param fontname the name of the font that this String is - * associated with - * @param str the string object - */ - public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){ - pointFactory = factory; - this.fontname = fontname; - this.str = str; - } - - public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; } - - public void addGlyphShape(GlyphShape glyph){ - glyphs.add(glyph); - } - public String getString(){ - return str; - } + /** Create a new GlyphString object + * @param fontname the name of the font that this String is + * associated with + * @param str the string object + */ + public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){ + pointFactory = factory; + this.fontname = fontname; + this.str = str; + } + + public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; } + + public void addGlyphShape(GlyphShape glyph){ + glyphs.add(glyph); + } + public String getString(){ + return str; + } - /** Creates the Curve based Glyphs from a Font - * @param paths a list of FontPath2D objects that define the outline - * @param affineTransform a global affine transformation applied to the paths. - */ - public void createfromFontPath(Path2D[] paths, AffineTransform affineTransform){ - final int numGlyps = paths.length; - for (int index=0;index<numGlyps;index++){ - if(paths[index] == null){ - continue; - } - PathIterator iterator = paths[index].iterator(affineTransform); - GlyphShape glyphShape = new GlyphShape(pointFactory, iterator); - - if(glyphShape.getNumVertices() < 3) { - continue; - } - addGlyphShape(glyphShape); - } - } - - private ArrayList<Triangle> initializeTriangles(float sharpness){ - ArrayList<Triangle> triangles = new ArrayList<Triangle>(); - for(GlyphShape glyph:glyphs){ - ArrayList<Triangle> tris = glyph.triangulate(sharpness); - triangles.addAll(tris); - } - return triangles; - } - - /** Generate a OGL Region to represent this Object. - * @param context the GLContext which the region is defined by. - * @param shaprness the curvature sharpness of the object. - * @param st shader state - */ - public void generateRegion(GLContext context, float shaprness, ShaderState st, int type){ - region = RegionFactory.create(context, st, type); - region.setFlipped(true); - - ArrayList<Triangle> tris = initializeTriangles(shaprness); - region.addTriangles(tris); - - int numVertices = region.getNumVertices(); - for(GlyphShape glyph:glyphs){ - ArrayList<Vertex> gVertices = glyph.getVertices(); - for(Vertex vert:gVertices){ - vert.setId(numVertices++); - } - region.addVertices(gVertices); - } - - /** initialize the region */ - region.update(); - } - - /** Generate a Hashcode for this object - * @return a string defining the hashcode - */ - public String getTextHashCode(){ - return "" + fontname.hashCode() + str.hashCode(); - } + /** Creates the Curve based Glyphs from a Font + * @param paths a list of FontPath2D objects that define the outline + * @param affineTransform a global affine transformation applied to the paths. + */ + public void createfromFontPath(Path2D[] paths, AffineTransform affineTransform){ + final int numGlyps = paths.length; + for (int index=0;index<numGlyps;index++){ + if(paths[index] == null){ + continue; + } + PathIterator iterator = paths[index].iterator(affineTransform); + GlyphShape glyphShape = new GlyphShape(pointFactory, iterator); + + if(glyphShape.getNumVertices() < 3) { + continue; + } + addGlyphShape(glyphShape); + } + } + + private ArrayList<Triangle> initializeTriangles(float sharpness){ + ArrayList<Triangle> triangles = new ArrayList<Triangle>(); + for(GlyphShape glyph:glyphs){ + ArrayList<Triangle> tris = glyph.triangulate(sharpness); + triangles.addAll(tris); + } + return triangles; + } + + /** Generate a OGL Region to represent this Object. + * @param context the GLContext which the region is defined by. + * @param shaprness the curvature sharpness of the object. + * @param st shader state + */ + public void generateRegion(GLContext context, float shaprness, ShaderState st, int type){ + region = RegionFactory.create(context, st, type); + region.setFlipped(true); + + ArrayList<Triangle> tris = initializeTriangles(shaprness); + region.addTriangles(tris); + + int numVertices = region.getNumVertices(); + for(GlyphShape glyph:glyphs){ + ArrayList<Vertex> gVertices = glyph.getVertices(); + for(Vertex vert:gVertices){ + vert.setId(numVertices++); + } + region.addVertices(gVertices); + } + + /** initialize the region */ + region.update(); + } + + /** Generate a Hashcode for this object + * @return a string defining the hashcode + */ + public String getTextHashCode(){ + return "" + fontname.hashCode() + str.hashCode(); + } - /** Render the Object based using the associated Region - * previously generated. - */ - public void renderString3D() { - region.render(null, 0, 0, 0); - } - /** Render the Object based using the associated Region - * previously generated. - */ - public void renderString3D(PMVMatrix matrix, int vp_width, int vp_height, int size) { - region.render(matrix, vp_width, vp_height, size); - } - - /** Get the Origion of this GlyphString - * @return - */ - public Vertex getOrigin() { - return origin; - } + /** Render the Object based using the associated Region + * previously generated. + */ + public void renderString3D() { + region.render(null, 0, 0, 0); + } + /** Render the Object based using the associated Region + * previously generated. + */ + public void renderString3D(PMVMatrix matrix, int vp_width, int vp_height, int size) { + region.render(matrix, vp_width, vp_height, size); + } + + /** Get the Origion of this GlyphString + * @return + */ + public Vertex getOrigin() { + return origin; + } - /** Destroy the associated OGL objects - */ - public void destroy(){ - region.destroy(); - } - - public AABBox getBounds(){ - return region.getBounds(); - } + /** Destroy the associated OGL objects + */ + public void destroy(){ + region.destroy(); + } + + public AABBox getBounds(){ + return region.getBounds(); + } } diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index a9ab902a9..bead9a5d2 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -74,7 +74,7 @@ public class JavaFontLoader implements FontSet { return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular } - public Font get(int family, int style) { + public Font get(int family, int style) { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { return font; @@ -121,7 +121,7 @@ public class JavaFontLoader implements FontSet { return font; } - + Font abspath(String fname, int family, int style) { final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ; diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index 3614add5c..17db08801 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -76,8 +76,8 @@ public class UbuntuFontLoader implements FontSet { return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular } - public Font get(int family, int style) - { + public Font get(int family, int style) + { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { return font; @@ -119,7 +119,7 @@ public class UbuntuFontLoader implements FontSet { return font; } - + Font abspath(String fname, int family, int style) { final String err = "Problem loading font "+fname+", stream "+relPath+fname; try { @@ -136,5 +136,5 @@ public class UbuntuFontLoader implements FontSet { } catch(IOException ioe) { throw new GLException(err, ioe); } - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index f702b981f..6292c8826 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -43,97 +43,97 @@ import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.geom.AABBox; class TypecastFont implements FontInt { - static final boolean DEBUG = false; - - final OTFontCollection fontset; - final OTFont font; + static final boolean DEBUG = false; + + final OTFontCollection fontset; + final OTFont font; TypecastHMetrics metrics; final CmapFormat cmapFormat; - int cmapentries; - - // FIXME: Add cache size to limit memory usage ?? + int cmapentries; + + // FIXME: Add cache size to limit memory usage ?? IntObjectHashMap char2Glyph; public TypecastFont(OTFontCollection fontset) { - this.fontset = fontset; + this.fontset = fontset; this.font = fontset.getFont(0); // FIXME: Generic attempt to find the best CmapTable, // which is assumed to be the one with the most entries (stupid 'eh?) - CmapTable cmapTable = font.getCmapTable(); + CmapTable cmapTable = font.getCmapTable(); CmapFormat[] _cmapFormatP = { null, null, null, null }; int platform = -1; int platformLength = -1; int encoding = -1; - for(int i=0; i<cmapTable.getNumTables(); i++) { - CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i); - int pidx = cmapIdxEntry.getPlatformId(); - CmapFormat cf = cmapIdxEntry.getFormat(); + for(int i=0; i<cmapTable.getNumTables(); i++) { + CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i); + int pidx = cmapIdxEntry.getPlatformId(); + CmapFormat cf = cmapIdxEntry.getFormat(); if(DEBUG) { System.err.println("CmapFormat["+i+"]: platform " + pidx + ", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf); } - if( _cmapFormatP[pidx] == null || - _cmapFormatP[pidx].getLength() < cf.getLength() ) { - _cmapFormatP[pidx] = cf; - if( cf.getLength() > platformLength ) { - platformLength = cf.getLength() ; - platform = pidx; - encoding = cmapIdxEntry.getEncodingId(); - } - } - } + if( _cmapFormatP[pidx] == null || + _cmapFormatP[pidx].getLength() < cf.getLength() ) { + _cmapFormatP[pidx] = cf; + if( cf.getLength() > platformLength ) { + platformLength = cf.getLength() ; + platform = pidx; + encoding = cmapIdxEntry.getEncodingId(); + } + } + } if(0 <= platform) { cmapFormat = _cmapFormatP[platform]; if(DEBUG) { System.err.println("Selected CmapFormat: platform " + platform + ", encoding "+encoding + ": "+cmapFormat); } - } else { - CmapFormat _cmapFormat = null; - /*if(null == _cmapFormat) { + } else { + CmapFormat _cmapFormat = null; + /*if(null == _cmapFormat) { platform = ID.platformMacintosh; encoding = ID.encodingASCII; - _cmapFormat = cmapTable.getCmapFormat(platform, encoding); - } */ - if(null == _cmapFormat) { - // default unicode - platform = ID.platformMicrosoft; - encoding = ID.encodingUnicode; - _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding); - } - if(null == _cmapFormat) { - // maybe a symbol font ? + _cmapFormat = cmapTable.getCmapFormat(platform, encoding); + } */ + if(null == _cmapFormat) { + // default unicode + platform = ID.platformMicrosoft; + encoding = ID.encodingUnicode; + _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding); + } + if(null == _cmapFormat) { + // maybe a symbol font ? platform = ID.platformMicrosoft; encoding = ID.encodingSymbol; _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding); - } - if(null == _cmapFormat) { - throw new RuntimeException("Cannot find a suitable cmap table for font "+font); - } + } + if(null == _cmapFormat) { + throw new RuntimeException("Cannot find a suitable cmap table for font "+font); + } cmapFormat = _cmapFormat; if(DEBUG) { System.err.println("Selected CmapFormat (2): platform " + platform + ", encoding "+encoding + ": "+cmapFormat); } } - cmapentries = 0; + cmapentries = 0; for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { CmapFormat.Range range = cmapFormat.getRange(i); cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included - } + } if(DEBUG) { - System.err.println("num glyphs: "+font.getNumGlyphs()); - System.err.println("num cmap entries: "+cmapentries); - System.err.println("num cmap ranges: "+cmapFormat.getRangeCount()); + System.err.println("num glyphs: "+font.getNumGlyphs()); + System.err.println("num cmap entries: "+cmapentries); + System.err.println("num cmap ranges: "+cmapFormat.getRangeCount()); for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { CmapFormat.Range range = cmapFormat.getRange(i); for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) { - final int code = cmapFormat.mapCharCode(j); - if(code < 15) { - System.err.println(" char: " + (int)j + " ( " + (char)j +" ) -> " + code); - } + final int code = cmapFormat.mapCharCode(j); + if(code < 15) { + System.err.println(" char: " + (int)j + " ( " + (char)j +" ) -> " + code); + } } } } @@ -155,9 +155,9 @@ class TypecastFont implements FontInt { } public Glyph getGlyph(char symbol) { - TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); + TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); if (null == result) { - // final short code = (short) char2Code.get(symbol); + // final short code = (short) char2Code.get(symbol); short code = (short) cmapFormat.mapCharCode(symbol); if(0 == code && 0 != symbol) { // reserved special glyph IDs by convention @@ -168,19 +168,19 @@ class TypecastFont implements FontInt { } } - jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code); - if(null == glyph) { - glyph = font.getGlyph(Glyph.ID_UNKNOWN); - } - if(null == glyph) { - throw new RuntimeException("Could not retrieve glyph for symbol: <"+symbol+"> "+(int)symbol+" -> glyph id "+code); - } - Path2D path = TypecastRenderer.buildPath(glyph); - result = new TypecastGlyph(this, symbol, code, glyph.getBBox(), glyph.getAdvanceWidth(), path); - if(DEBUG) { - System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path); - } - final HdmxTable hdmx = font.getHdmxTable(); + jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code); + if(null == glyph) { + glyph = font.getGlyph(Glyph.ID_UNKNOWN); + } + if(null == glyph) { + throw new RuntimeException("Could not retrieve glyph for symbol: <"+symbol+"> "+(int)symbol+" -> glyph id "+code); + } + Path2D path = TypecastRenderer.buildPath(glyph); + result = new TypecastGlyph(this, symbol, code, glyph.getBBox(), glyph.getAdvanceWidth(), path); + if(DEBUG) { + System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path); + } + final HdmxTable hdmx = font.getHdmxTable(); if (null!= result && null != hdmx) { /*if(DEBUG) { System.err.println("hdmx "+hdmx); @@ -193,14 +193,14 @@ class TypecastFont implements FontInt { System.err.println("hdmx advance : pixelsize = "+dr.getWidth(code)+" : "+ dr.getPixelSize()); } } - } - char2Glyph.put(symbol, result); + } + char2Glyph.put(symbol, result); } return result; } public void getOutline(String string, float pixelSize, AffineTransform transform, Path2D[] result) { - TypecastRenderer.getOutline(this, string, pixelSize, transform, result); + TypecastRenderer.getOutline(this, string, pixelSize, transform, result); } public float getStringWidth(String string, float pixelSize) { @@ -217,7 +217,7 @@ class TypecastFont implements FontInt { } } - return (int)(width + 0.5f); + return (int)(width + 0.5f); } public float getStringHeight(String string, float pixelSize) { @@ -233,7 +233,7 @@ class TypecastFont implements FontInt { height = (int)Math.ceil(Math.max(bbox.getHeight(), height)); } } - return height; + return height; } public AABBox getStringBounds(CharSequence string, float pixelSize) { @@ -263,11 +263,11 @@ class TypecastFont implements FontInt { totalHeight -= advanceY; totalWidth = Math.max(curLineWidth, totalWidth); } - return new AABBox(0, 0, 0, totalWidth, totalHeight,0); + return new AABBox(0, 0, 0, totalWidth, totalHeight,0); } final public int getNumGlyphs() { - return font.getNumGlyphs(); + return font.getNumGlyphs(); } public boolean isPrintableChar( char c ) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index 88d865f9c..f20b7d1e7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -42,7 +42,7 @@ public class TypecastGlyph implements FontInt.Glyph { final Font font; final float advance; HashMap<Float, Float> size2advance = new HashMap<Float, Float>(); - + public Advance(Font font, float advance) { this.font = font; @@ -86,12 +86,12 @@ public class TypecastGlyph implements FontInt.Glyph { "\n advances: \n"+size2advance; } } - + public class Metrics { - AABBox bbox; + AABBox bbox; Advance advance; - + public Metrics(Font font, AABBox bbox, float advance) { this.bbox = bbox; @@ -128,13 +128,13 @@ public class TypecastGlyph implements FontInt.Glyph { "\n bbox: "+this.bbox+ this.advance; } - } + } public static final short INVALID_ID = (short)((1 << 16) - 1); public static final short MAX_ID = (short)((1 << 16) - 2); private final Font font; - + char symbol; short id; int advance; @@ -143,15 +143,15 @@ public class TypecastGlyph implements FontInt.Glyph { protected Path2D path; // in EM units protected Path2D pathSized; protected float numberSized; - + protected TypecastGlyph(Font font, char symbol) { - this.font = font; + this.font = font; this.symbol = symbol; } protected TypecastGlyph(Font font, - char symbol, short id, AABBox bbox, int advance, Path2D path) { - this.font = font; + char symbol, short id, AABBox bbox, int advance, Path2D path) { + this.font = font; this.symbol = symbol; this.advance = advance; @@ -161,7 +161,7 @@ public class TypecastGlyph implements FontInt.Glyph { this.pathSized = null; this.numberSized = 0.0f; } - + void init(short id, AABBox bbox, int advance) { this.id = id; this.advance = advance; @@ -176,11 +176,11 @@ public class TypecastGlyph implements FontInt.Glyph { public Font getFont() { return this.font; } - + public char getSymbol() { return this.symbol; } - + AABBox getBBoxUnsized() { return this.metrics.getBBox(); } @@ -192,22 +192,22 @@ public class TypecastGlyph implements FontInt.Glyph { public Metrics getMetrics() { return this.metrics; } - + public short getID() { return this.id; } - + public float getScale(float pixelSize) { return this.metrics.getScale(pixelSize); } - + public AABBox getBBox(float pixelSize) { final float size = getScale(pixelSize); AABBox newBox = getBBox().clone(); newBox.scale(size); return newBox; } - + protected void addAdvance(float advance, float size) { this.metrics.addAdvance(advance, size); } @@ -217,9 +217,9 @@ public class TypecastGlyph implements FontInt.Glyph { } public Path2D getPath() { - return this.path; + return this.path; } - + public Path2D getPath(float pixelSize) { final float size = getScale(pixelSize); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index a69948006..0dd7a6178 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -34,22 +34,22 @@ import com.jogamp.graph.font.Font.Metrics; import com.jogamp.graph.geom.AABBox; class TypecastHMetrics implements Metrics { - private final TypecastFont fontImpl; - - // HeadTable + private final TypecastFont fontImpl; + + // HeadTable private final HeadTable headTable; - private final float unitsPerEM_Inv; - private final AABBox bbox; - // HheaTable - private final HheaTable hheaTable; + private final float unitsPerEM_Inv; + private final AABBox bbox; + // HheaTable + private final HheaTable hheaTable; // VheaTable (for horizontal fonts) // private final VheaTable vheaTable; - - public TypecastHMetrics(TypecastFont fontImpl) { - this.fontImpl = fontImpl; - headTable = this.fontImpl.font.getHeadTable(); - hheaTable = this.fontImpl.font.getHheaTable(); - // vheaTable = this.fontImpl.font.getVheaTable(); + + public TypecastHMetrics(TypecastFont fontImpl) { + this.fontImpl = fontImpl; + headTable = this.fontImpl.font.getHeadTable(); + hheaTable = this.fontImpl.font.getHheaTable(); + // vheaTable = this.fontImpl.font.getVheaTable(); unitsPerEM_Inv = 1.0f / ( (float) headTable.getUnitsPerEm() ); int maxWidth = headTable.getXMax() - headTable.getXMin(); @@ -59,8 +59,8 @@ class TypecastHMetrics implements Metrics { float highx = lowx + maxWidth; float highy = lowy + maxHeight; bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert - } - + } + public final float getAscent(float pixelSize) { return getScale(pixelSize) * -hheaTable.getAscender(); // invert } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index 9a81d78d3..ab5e673db 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -40,48 +40,48 @@ import com.jogamp.graph.font.Font; */ public class TypecastRenderer { - public static void getOutline(TypecastFont font, - String string, float pixelSize, AffineTransform transform, Path2D[] p) - { - if (string == null) { - return; - } - Font.Metrics metrics = font.getMetrics(); - float advanceTotal = 0; - float lineGap = metrics.getLineGap(pixelSize) ; - float ascent = metrics.getAscent(pixelSize) ; - float descent = metrics.getDescent(pixelSize) ; - if (transform == null) { - transform = new AffineTransform(); - } - AffineTransform t = new AffineTransform(); + public static void getOutline(TypecastFont font, + String string, float pixelSize, AffineTransform transform, Path2D[] p) + { + if (string == null) { + return; + } + Font.Metrics metrics = font.getMetrics(); + float advanceTotal = 0; + float lineGap = metrics.getLineGap(pixelSize) ; + float ascent = metrics.getAscent(pixelSize) ; + float descent = metrics.getDescent(pixelSize) ; + if (transform == null) { + transform = new AffineTransform(); + } + AffineTransform t = new AffineTransform(); - float advanceY = lineGap - descent + ascent; - float y = 0; - for (int i=0; i<string.length(); i++) - { - p[i] = new Path2D(); - p[i].reset(); - t.setTransform(transform); - char character = string.charAt(i); - if (character == '\n') { - y -= advanceY; - advanceTotal = 0; - continue; - } else if (character == ' ') { - advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize); + float advanceY = lineGap - descent + ascent; + float y = 0; + for (int i=0; i<string.length(); i++) + { + p[i] = new Path2D(); + p[i].reset(); + t.setTransform(transform); + char character = string.charAt(i); + if (character == '\n') { + y -= advanceY; + advanceTotal = 0; + continue; + } else if (character == ' ') { + advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize); continue; } - TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character); - Path2D gp = glyph.getPath(); - float scale = metrics.getScale(pixelSize); - t.translate(advanceTotal, y); - t.scale(scale, scale); - p[i].append(gp.iterator(t), false); - advanceTotal += glyph.getAdvance(pixelSize, true); - } - } - + TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character); + Path2D gp = glyph.getPath(); + float scale = metrics.getScale(pixelSize); + t.translate(advanceTotal, y); + t.scale(scale, scale); + p[i].append(gp.iterator(t), false); + advanceTotal += glyph.getAdvance(pixelSize, true); + } + } + /** * Build a {@link com.jogamp.graph.geom.Path2D Path2D} from a * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}. This glyph path can then @@ -116,44 +116,44 @@ public class TypecastRenderer { Point point = glyph.getPoint(startIndex + offset%count); Point point_plus1 = glyph.getPoint(startIndex + (offset+1)%count); Point point_plus2 = glyph.getPoint(startIndex + (offset+2)%count); - if(offset == 0) + if(offset == 0) { gp.moveTo(point.x, -point.y); } - - if (point.onCurve) { - if (point_plus1.onCurve) { - // s = new Line2D.Float(point.x, -point.y, point_plus1.x, -point_plus1.y); - gp.lineTo( point_plus1.x, -point_plus1.y ); - offset++; - } else { - if (point_plus2.onCurve) { - // s = new QuadCurve2D.Float( point.x, -point.y, point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y); - gp.quadTo(point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y); - offset+=2; - } else { - // s = new QuadCurve2D.Float(point.x,-point.y,point_plus1.x,-point_plus1.y, - // midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y)); - gp.quadTo(point_plus1.x, -point_plus1.y, midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y)); - offset+=2; - } - } - } else { - if (point_plus1.onCurve) { - // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), - // point.x, -point.y, point_plus1.x, -point_plus1.y); - //gp.curve3(point_plus1.x, -point_plus1.y, point.x, -point.y); - gp.quadTo(point.x, -point.y, point_plus1.x, -point_plus1.y); - offset++; - - } else { - // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), point.x, -point.y, - // midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y)); - //gp.curve3(midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y), point.x, -point.y); - gp.quadTo(point.x, -point.y, midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y)); - offset++; - } - } + + if (point.onCurve) { + if (point_plus1.onCurve) { + // s = new Line2D.Float(point.x, -point.y, point_plus1.x, -point_plus1.y); + gp.lineTo( point_plus1.x, -point_plus1.y ); + offset++; + } else { + if (point_plus2.onCurve) { + // s = new QuadCurve2D.Float( point.x, -point.y, point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y); + gp.quadTo(point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y); + offset+=2; + } else { + // s = new QuadCurve2D.Float(point.x,-point.y,point_plus1.x,-point_plus1.y, + // midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y)); + gp.quadTo(point_plus1.x, -point_plus1.y, midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y)); + offset+=2; + } + } + } else { + if (point_plus1.onCurve) { + // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), + // point.x, -point.y, point_plus1.x, -point_plus1.y); + //gp.curve3(point_plus1.x, -point_plus1.y, point.x, -point.y); + gp.quadTo(point.x, -point.y, point_plus1.x, -point_plus1.y); + offset++; + + } else { + // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), point.x, -point.y, + // midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y)); + //gp.curve3(midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y), point.x, -point.y); + gp.quadTo(point.x, -point.y, midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y)); + offset++; + } + } } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java index 5afb939ab..6b3dc1f6f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java @@ -72,9 +72,9 @@ public class Mnemonic { public static final short RS = 0x43; public static final short WCVTP = 0x44; public static final short RCVT = 0x45; - public static final short GC = 0x46; // [a] + public static final short GC = 0x46; // [a] public static final short SCFS = 0x48; - public static final short MD = 0x49; // [a] + public static final short MD = 0x49; // [a] public static final short MPPEM = 0x4B; public static final short MPS = 0x4C; public static final short FLIPON = 0x4D; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java index 17b5af594..6e7e76bc7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java @@ -182,8 +182,8 @@ public class OTFont { } public OTGlyph getGlyph(int i) { - - final GlyfDescript _glyfDescr = _glyf.getDescription(i); + + final GlyfDescript _glyfDescr = _glyf.getDescription(i); return (null != _glyfDescr) ? new OTGlyph( _glyfDescr, diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java index 4b6242d56..5c004246a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java @@ -103,7 +103,7 @@ public class OTGlyph { } public AABBox getBBox() { - return _bbox; + return _bbox; } public int getAdvanceWidth() { @@ -164,6 +164,6 @@ public class OTGlyph { // _points[gd.getPointCount()] = new Point(0, 0, true, true); // _points[gd.getPointCount()+1] = new Point(_advanceWidth, 0, true, true); - _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0); + _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java index ed82f2654..4804c35f2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java @@ -175,15 +175,15 @@ public class PostTable implements Table { "lessequal", // 148 "greaterequal", // 149 "yen", // 150 - "mu", // 151 + "mu", // 151 "partialdiff", // 152 "summation", // 153 "product", // 154 - "pi", // 155 + "pi", // 155 "integral'", // 156 "ordfeminine", // 157 "ordmasculine", // 158 - "Omega", // 159 + "Omega", // 159 "ae", // 160 "oslash", // 161 "questiondown", // 162 diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java index 252c6acc4..a659a7003 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java @@ -140,8 +140,8 @@ public class Interpreter { private void _deltac1() { int n = pop(); for (int i = 0; i < n; i++) { - pop(); // pn - pop(); // argn + pop(); // pn + pop(); // argn } } @@ -151,8 +151,8 @@ public class Interpreter { private void _deltac2() { int n = pop(); for (int i = 0; i < n; i++) { - pop(); // pn - pop(); // argn + pop(); // pn + pop(); // argn } } @@ -162,8 +162,8 @@ public class Interpreter { private void _deltac3() { int n = pop(); for (int i = 0; i < n; i++) { - pop(); // pn - pop(); // argn + pop(); // pn + pop(); // argn } } @@ -173,8 +173,8 @@ public class Interpreter { private void _deltap1() { int n = pop(); for (int i = 0; i < n; i++) { - pop(); // pn - pop(); // argn + pop(); // pn + pop(); // argn } } @@ -184,8 +184,8 @@ public class Interpreter { private void _deltap2() { int n = pop(); for (int i = 0; i < n; i++) { - pop(); // pn - pop(); // argn + pop(); // pn + pop(); // argn } } @@ -195,8 +195,8 @@ public class Interpreter { private void _deltap3() { int n = pop(); for (int i = 0; i < n; i++) { - pop(); // pn - pop(); // argn + pop(); // pn + pop(); // argn } } @@ -407,12 +407,12 @@ public class Interpreter { * to inhibit grid-fitting when a glyph is being rotated or stretched, use the * following sequence on the preprogram: * - * PUSHB[000] 6 ; ask GETINFO to check for stretching or rotation - * GETINFO[] ; will push TRUE if glyph is stretched or rotated - * IF[] ; tests value at top of stack - * PUSHB[000] 1 ; value for INSTCTRL - * PUSHB[000] 1 ; selector for INSTCTRL - * INSTRCTRL[] ; based on selector and value will turn grid-fitting off + * PUSHB[000] 6 ; ask GETINFO to check for stretching or rotation + * GETINFO[] ; will push TRUE if glyph is stretched or rotated + * IF[] ; tests value at top of stack + * PUSHB[000] 1 ; value for INSTCTRL + * PUSHB[000] 1 ; selector for INSTCTRL + * INSTRCTRL[] ; based on selector and value will turn grid-fitting off * EIF[] * * Selector flag 2 is used to establish that any parameters set in the CVT program @@ -923,8 +923,8 @@ public class Interpreter { * Set Freedom_Vector From Stack */ private void _sfvfs() { - gs.freedom_vector[1] = pop(); // y - gs.freedom_vector[0] = pop(); // x + gs.freedom_vector[1] = pop(); // y + gs.freedom_vector[0] = pop(); // x } /* @@ -988,9 +988,9 @@ public class Interpreter { * USES: loop */ private void _shpix() { - pop(); // amount + pop(); // amount while (gs.loop-- > 0) { - pop(); // p + pop(); // p } gs.loop = 1; } @@ -1017,8 +1017,8 @@ public class Interpreter { * Set Projection_Vector From Stack */ private void _spvfs() { - gs.projection_vector[1] = pop(); // y - gs.projection_vector[0] = pop(); // x + gs.projection_vector[1] = pop(); // y + gs.projection_vector[0] = pop(); // x } /* diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java index 3e2a594c5..79e842887 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java @@ -80,14 +80,14 @@ public class AffineTransform implements Cloneable, Serializable { } public AffineTransform(Factory<? extends Vertex> factory) { - pointFactory = factory; + pointFactory = factory; type = TYPE_IDENTITY; m00 = m11 = 1.0f; m10 = m01 = m02 = m12 = 0.0f; } public AffineTransform(AffineTransform t) { - this.pointFactory = t.pointFactory; + this.pointFactory = t.pointFactory; this.type = t.type; this.m00 = t.m00; this.m10 = t.m10; @@ -98,7 +98,7 @@ public class AffineTransform implements Cloneable, Serializable { } public AffineTransform(Vertex.Factory<? extends Vertex> factory, float m00, float m10, float m01, float m11, float m02, float m12) { - pointFactory = factory; + pointFactory = factory; this.type = TYPE_UNKNOWN; this.m00 = m00; this.m10 = m10; @@ -109,7 +109,7 @@ public class AffineTransform implements Cloneable, Serializable { } public AffineTransform(Vertex.Factory<? extends Vertex> factory, float[] matrix) { - pointFactory = factory; + pointFactory = factory; this.type = TYPE_UNKNOWN; m00 = matrix[0]; m10 = matrix[1]; @@ -316,25 +316,25 @@ public class AffineTransform implements Cloneable, Serializable { } public static <T extends Vertex> AffineTransform getScaleInstance(Vertex.Factory<? extends Vertex> factory, float scx, float scY) { - AffineTransform t = new AffineTransform(factory); + AffineTransform t = new AffineTransform(factory); t.setToScale(scx, scY); return t; } public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) { - AffineTransform t = new AffineTransform(factory); + AffineTransform t = new AffineTransform(factory); t.setToShear(shx, shy); return t; } public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle) { - AffineTransform t = new AffineTransform(factory); + AffineTransform t = new AffineTransform(factory); t.setToRotation(angle); return t; } public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle, float x, float y) { - AffineTransform t = new AffineTransform(factory); + AffineTransform t = new AffineTransform(factory); t.setToRotation(angle, x, y); return t; } @@ -391,7 +391,7 @@ public class AffineTransform implements Cloneable, Serializable { throw new NoninvertibleTransformException(determinantIsZero); } return new AffineTransform( - this.pointFactory, + this.pointFactory, m11 / det, // m00 -m10 / det, // m10 -m01 / det, // m01 @@ -401,9 +401,9 @@ public class AffineTransform implements Cloneable, Serializable { ); } - public Vertex transform(Vertex src, Vertex dst) { + public Vertex transform(Vertex src, Vertex dst) { if (dst == null) { - dst = pointFactory.create(); + dst = pointFactory.create(); } float x = src.getX(); @@ -415,12 +415,12 @@ public class AffineTransform implements Cloneable, Serializable { public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) { while (--length >= 0) { - Vertex srcPoint = src[srcOff++]; + Vertex srcPoint = src[srcOff++]; float x = srcPoint.getX(); float y = srcPoint.getY(); Vertex dstPoint = dst[dstOff]; if (dstPoint == null) { - throw new IllegalArgumentException("dst["+dstOff+"] is null"); + throw new IllegalArgumentException("dst["+dstOff+"] is null"); } dstPoint.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12); dst[dstOff++] = dstPoint; @@ -444,9 +444,9 @@ public class AffineTransform implements Cloneable, Serializable { } } - public Vertex deltaTransform(Vertex src, Vertex dst) { + public Vertex deltaTransform(Vertex src, Vertex dst) { if (dst == null) { - dst = pointFactory.create(); + dst = pointFactory.create(); } float x = src.getX(); @@ -465,13 +465,13 @@ public class AffineTransform implements Cloneable, Serializable { } } - public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException { + public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException { float det = getDeterminant(); if (MathFloat.abs(det) < ZERO) { - throw new NoninvertibleTransformException(determinantIsZero); + throw new NoninvertibleTransformException(determinantIsZero); } if (dst == null) { - dst = pointFactory.create(); + dst = pointFactory.create(); } float x = src.getX() - m02; @@ -486,7 +486,7 @@ public class AffineTransform implements Cloneable, Serializable { { float det = getDeterminant(); if (MathFloat.abs(det) < ZERO) { - throw new NoninvertibleTransformException(determinantIsZero); + throw new NoninvertibleTransformException(determinantIsZero); } while (--length >= 0) { diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java index 431891361..edeabaa40 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java @@ -243,11 +243,11 @@ public final class Path2D implements Cloneable { } final public int size() { - return typeSize; + return typeSize; } final public boolean isClosed() { - return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ; + return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ; } public void closePath() { @@ -258,7 +258,7 @@ public final class Path2D implements Cloneable { } public String toString() { - return "[size "+size()+", closed "+isClosed()+"]"; + return "[size "+size()+", closed "+isClosed()+"]"; } public void append(Path2D path, boolean connect) { diff --git a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java index 8f8638632..2138b217d 100644 --- a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java +++ b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java @@ -385,12 +385,12 @@ public class Crossing { // START if (x == x1) { - return x1 < x2 ? 0 : -1; + return x1 < x2 ? 0 : -1; } // END if (x == x2) { - return x1 < x2 ? 1 : 0; + return x1 < x2 ? 1 : 0; } // INSIDE-DOWN @@ -496,9 +496,9 @@ public class Crossing { // checks if the point (x,y) is the vertex of shape with PathIterator p if (x == cx && y == cy) { - cross = 0; - cy = my; - break; + cross = 0; + cy = my; + break; } p.next(); } diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index 5eb73cd2e..3f8a76535 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -223,7 +223,7 @@ public class GLUquadricImpl implements GLUquadric { * GLU.LINE: Quadrics are rendered as a set of lines. * * GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges - * separating coplanar faces will not be drawn. + * separating coplanar faces will not be drawn. * * GLU.POINT: Quadrics are rendered as a set of points. * @@ -234,8 +234,8 @@ public class GLUquadricImpl implements GLUquadric { } /** - * specifies what kind of normals are desired for quadrics. - * The legal values are as follows: + * specifies what kind of normals are desired for quadrics. + * The legal values are as follows: * * GLU.NONE: No normals are generated. * @@ -252,7 +252,7 @@ public class GLUquadricImpl implements GLUquadric { /** * specifies what kind of orientation is desired for. - * The orientation values are as follows: + * The orientation values are as follows: * * GLU.OUTSIDE: Quadrics are drawn with normals pointing outward. * @@ -495,10 +495,10 @@ public class GLUquadricImpl implements GLUquadric { glNormal3f(gl, 0.0f, 0.0f, -1.0f); } } - + da = 2.0f * PI / slices; dr = (outerRadius - innerRadius) / loops; - + switch (drawStyle) { case GLU.GLU_FILL: { @@ -916,7 +916,7 @@ public class GLUquadricImpl implements GLUquadric { } /** - * draws a sphere of the given radius centered around the origin. + * draws a sphere of the given radius centered around the origin. * The sphere is subdivided around the z axis into slices and along the z axis * into stacks (similar to lines of longitude and latitude). * @@ -1188,7 +1188,7 @@ public class GLUquadricImpl implements GLUquadric { */ private void normal3f(GL gl, float x, float y, float z) { float mag; - + mag = (float)Math.sqrt(x * x + y * y + z * z); if (mag > 0.00001F) { x /= mag; diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java index 043edac89..2ef4468e5 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java @@ -131,7 +131,7 @@ class GL2CurveEvaluator implements CurveEvaluator { CArrayOfFloats ps) { if (output_triangles) { // TODO code for callback (output_triangles probably indicates callback) - // System.out.println("TODO curveevaluator.map1f-output_triangles"); + // System.out.println("TODO curveevaluator.map1f-output_triangles"); } else { gl.glMap1f(type, ulo, uhi, stride, order, ps.getArray(), ps .getPointer()); @@ -166,10 +166,10 @@ class GL2CurveEvaluator implements CurveEvaluator { */ public void mapgrid1f(int nu, float u1, float u2) { if (output_triangles) { - // System.out.println("TODO curveevaluator.mapgrid1f"); + // System.out.println("TODO curveevaluator.mapgrid1f"); } else gl.glMapGrid1f(nu, u1, u2); - // // System.out.println("upravit NU"); + // // System.out.println("upravit NU"); // gl.glMapGrid1f(50,u1,u2); } @@ -189,7 +189,7 @@ class GL2CurveEvaluator implements CurveEvaluator { */ if (output_triangles) { // TODO code for callback - // System.out.println("TODO openglcurveevaluator.mapmesh1f output_triangles"); + // System.out.println("TODO openglcurveevaluator.mapmesh1f output_triangles"); } else { switch (style) { case Backend.N_MESHFILL: diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java index bc63994cb..155c4f9a9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java @@ -76,10 +76,10 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { if (output_triangles) { // TODO outp triangles surfaceevaluator bgnmap2f - // System.out.println("TODO surfaceevaluator.bgnmap2f output triangles"); + // System.out.println("TODO surfaceevaluator.bgnmap2f output triangles"); } else { gl.glPushAttrib(GL2.GL_EVAL_BIT); - // System.out.println("TODO surfaceevaluator.bgnmap2f glgetintegerv"); + // System.out.println("TODO surfaceevaluator.bgnmap2f glgetintegerv"); } } @@ -112,7 +112,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { public void endmap2f() { // TODO Auto-generated method stub if (output_triangles) { - // System.out.println("TODO surfaceevaluator.endmap2f output triangles"); + // System.out.println("TODO surfaceevaluator.endmap2f output triangles"); } else { gl.glPopAttrib(); // TODO use LOD @@ -142,7 +142,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) { if (output_triangles) { - // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles"); + // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles"); } else { gl.glMapGrid2d(nu, u0, u1, nv, v0, v1); } @@ -159,7 +159,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { */ public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) { if (output_triangles) { - // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles"); + // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles"); } else { /* //DEBUG - draw control points this.poradi++; @@ -199,7 +199,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) { // TODO Auto-generated method stub if (output_triangles) { - // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles"); + // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles"); } else { gl.glMap2f(type, ulo, uhi, ustride, uorder, vlo, vhi, vstride, vorder, pts.getArray(), pts.getPointer()); diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java index bd0eaf771..58b565484 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -442,7 +442,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { // TODO errval ?? if (numTrims > 0) { - // System.out.println("TODO glunurbs.do_endsurface - numtrims > 0"); + // System.out.println("TODO glunurbs.do_endsurface - numtrims > 0"); } subdivider.beginQuilts(new GL2Backend()); @@ -461,7 +461,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void do_endcurve() { // DONE - // // System.out.println("do_endcurve"); + // // System.out.println("do_endcurve"); if (inCurve <= 0) { do_nurbserror(7); return; @@ -509,7 +509,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ private void do_nurbserror(int i) { // TODO nurberror - // System.out.println("TODO nurbserror " + i); + // System.out.println("TODO nurbserror " + i); } /** @@ -527,7 +527,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ private void loadGLMatrices() { // TODO Auto-generated method stub - // System.out.println("TODO glunurbs.loadGLMatrices"); + // System.out.println("TODO glunurbs.loadGLMatrices"); } /** @@ -783,7 +783,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { // DONE O_surface o_surface = new O_surface(); // TODO nuid - // System.out.println("TODO glunurbs.bgnsurface nuid"); + // System.out.println("TODO glunurbs.bgnsurface nuid"); thread("do_bgnsurface", o_surface); } @@ -800,7 +800,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ private void endtrim() { // TODO Auto-generated method stub - // System.out.println("TODO glunurbs.endtrim"); + // System.out.println("TODO glunurbs.endtrim"); } /** diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java index 0d04d4cd6..f4ad70193 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java @@ -47,7 +47,7 @@ public class ArcSdirSorter { */ public ArcSdirSorter(Subdivider subdivider) { //TODO - // System.out.println("TODO arcsdirsorter.constructor"); + // System.out.println("TODO arcsdirsorter.constructor"); } /** @@ -57,7 +57,7 @@ public class ArcSdirSorter { */ public void qsort(CArrayOfArcs list, int count) { // TODO - // System.out.println("TODO arcsdirsorter.qsort"); + // System.out.println("TODO arcsdirsorter.qsort"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java index bee98b8c3..be72c53d2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java @@ -46,7 +46,7 @@ public class ArcTdirSorter { */ public ArcTdirSorter(Subdivider subdivider) { // TODO Auto-generated constructor stub - // System.out.println("TODO arcTsorter.konstruktor"); + // System.out.println("TODO arcTsorter.konstruktor"); } /** * Sorts list of arcs @@ -55,6 +55,6 @@ public class ArcTdirSorter { */ public void qsort(CArrayOfArcs list, int count) { // TODO Auto-generated method stub - // System.out.println("TODO arcTsorter.qsort"); + // System.out.println("TODO arcTsorter.qsort"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java index 2e4d3eb96..bd6311414 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java @@ -72,7 +72,7 @@ public class ArcTesselator { */ public void pwl_right(Arc newright, float s, float t1, float t2, float f) { // TODO Auto-generated method stub - // System.out.println("TODO arctesselator.pwl_right"); + // System.out.println("TODO arctesselator.pwl_right"); } /** @@ -85,6 +85,6 @@ public class ArcTesselator { */ public void pwl_left(Arc newright, float s, float t2, float t1, float f) { // TODO Auto-generated method stub - // System.out.println("TODO arctesselator.pwl_left"); + // System.out.println("TODO arctesselator.pwl_left"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java index 4959f8000..610a19556 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java @@ -188,7 +188,7 @@ public abstract class Backend { * @param m step in v direction */ public void surfmesh(int u, int v, int n, int m) { - // System.out.println("TODO backend.surfmesh wireframequads"); + // System.out.println("TODO backend.surfmesh wireframequads"); // TODO wireframequads surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java index b0ff4e6e5..786781723 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java @@ -135,7 +135,7 @@ public class Curve { stride); } if (cullval == Subdivider.CULL_ACCEPT) { - // System.out.println("TODO curve.Curve-cullval"); + // System.out.println("TODO curve.Curve-cullval"); // mapdesc.xformCulling(ps,qs.get().order,qs.get().stride,cpts,stride); } @@ -145,13 +145,13 @@ public class Curve { range[2] = range[1] - range[0]; // TODO it is necessary to solve problem with "this" pointer here if (range[0] != pta[0]) { - // System.out.println("TODO curve.Curve-range0"); + // System.out.println("TODO curve.Curve-range0"); // Curve lower=new Curve(this,pta,0); // lower.next=next; // this=lower; } if (range[1] != ptb[0]) { - // System.out.println("TODO curve.Curve-range1"); + // System.out.println("TODO curve.Curve-range1"); // Curve lower=new Curve(this,ptb,0); } } @@ -162,7 +162,7 @@ public class Curve { */ public int cullCheck() { if (cullval == Subdivider.CULL_ACCEPT) { - // System.out.println("TODO curve.cullval"); + // System.out.println("TODO curve.cullval"); // cullval=mapdesc.cullCheck(cpts,order,stride); } // TODO compute cullval and return the computed value @@ -189,16 +189,16 @@ public class Curve { int val = 0; // mapdesc.project(spts,stride,tmp,tstride,order); - // System.out.println("TODO curve.getsptepsize mapdesc.project"); + // System.out.println("TODO curve.getsptepsize mapdesc.project"); if (val == 0) { setstepsize(mapdesc.maxrate); } else { float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); if (mapdesc.isParametricDistanceSampling()) { - // System.out.println("TODO curve.getstepsize - parametric"); + // System.out.println("TODO curve.getstepsize - parametric"); } else if (mapdesc.isPathLengthSampling()) { - // System.out.println("TODO curve.getstepsize - pathlength"); + // System.out.println("TODO curve.getstepsize - pathlength"); } else { setstepsize(mapdesc.maxrate); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java index 5c80ffd30..d9d012606 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java @@ -51,6 +51,6 @@ public class DisplayList { */ public void append(Object src, Method m, Object arg) { // TODO Auto-generated method stub - // System.out.println("TODO displaylist append"); + // System.out.println("TODO displaylist append"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java index 4f97b1271..114832a1c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java @@ -366,7 +366,7 @@ public class Knotspec { break; default: // TODO break with copying in general case - // System.out.println("TODO knotspec.pt_io_copy"); + // System.out.println("TODO knotspec.pt_io_copy"); break; } @@ -388,7 +388,7 @@ public class Knotspec { if (istransformed) { p.raisePointerBy(postoffset); for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), - p.getPointer() + postwidth); p.getPointer() != pend + p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) next.transform(p); @@ -409,7 +409,7 @@ public class Knotspec { if (istransformed) { p.raisePointerBy(postoffset); for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), - p.getPointer() + postwidth); p.getPointer() != pend + p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) { kspectotrans.insert(p); } @@ -549,8 +549,8 @@ public class Knotspec { * z.getRelative(0))); break; default: - //no need of default - see previous method and its case statement - // System.out.println("TODO pt_oo_sum default"); + //no need of default - see previous method and its case statement + // System.out.println("TODO pt_oo_sum default"); break; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java index 89389dea6..aac4dfc52 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java @@ -160,7 +160,7 @@ public class Knotvector { */ public void show(String msg) { // TODO Auto-generated method stub - // System.out.println("TODO knotvector.show"); + // System.out.println("TODO knotvector.show"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java index 8fab114ff..bd5d2db98 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java @@ -349,7 +349,7 @@ public class Mapdesc { */ public float getProperty(int tag) { // TODO Auto-generated method stub - // System.out.println("TODO mapdesc.getproperty"); + // System.out.println("TODO mapdesc.getproperty"); return 0; } @@ -428,10 +428,10 @@ public class Mapdesc { * @param outstride output number of control points' coordinates */ private void xFormMat(float[][] mat, CArrayOfFloats pts, int order, - int stride, float[] cp, int outstride) { + int stride, float[] cp, int outstride) { // TODO Auto-generated method stub - // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats"); + // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats"); if (isrational > 0) { diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java index 51c43fca7..a44f2451c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java @@ -49,6 +49,6 @@ public class Patch { * @param patch */ public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) { - // System.out.println("TODO patch.constructor"); + // System.out.println("TODO patch.constructor"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java index f60a0cc43..f1e499a28 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java @@ -82,7 +82,7 @@ public class Patchlist { */ public Patchlist(Patchlist patchlist, int param, float mid) { // TODO Auto-generated constructor stub - // System.out.println("TODO patchlist.konstruktor 2"); + // System.out.println("TODO patchlist.konstruktor 2"); } /** @@ -91,7 +91,7 @@ public class Patchlist { */ public int cullCheck() { // TODO Auto-generated method stub - // System.out.println("TODO patchlist.cullcheck"); + // System.out.println("TODO patchlist.cullcheck"); return 0; } @@ -99,7 +99,7 @@ public class Patchlist { * Empty method */ public void getstepsize() { - // System.out.println("TODO patchlist.getsptepsize"); + // System.out.println("TODO patchlist.getsptepsize"); // TODO Auto-generated method stub } @@ -110,7 +110,7 @@ public class Patchlist { */ public boolean needsSamplingSubdivision() { // TODO Auto-generated method stub - // System.out.println("patchlist.needsSamplingSubdivision"); + // System.out.println("patchlist.needsSamplingSubdivision"); return false; } @@ -121,7 +121,7 @@ public class Patchlist { */ public boolean needsSubdivision(int i) { // TODO Auto-generated method stub - // System.out.println("TODO patchlist.needsSubdivision"); + // System.out.println("TODO patchlist.needsSubdivision"); return false; } @@ -131,7 +131,7 @@ public class Patchlist { */ public boolean needsNonSamplingSubdivision() { // TODO Auto-generated method stub - // System.out.println("TODO patchlist.needsNonSamplingSubdivision"); + // System.out.println("TODO patchlist.needsNonSamplingSubdivision"); return false; } @@ -140,6 +140,6 @@ public class Patchlist { */ public void bbox() { // TODO Auto-generated method stub - // System.out.println("TODO patchlist.bbox"); + // System.out.println("TODO patchlist.bbox"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java index 6d732a44f..6bea4928c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java @@ -248,7 +248,7 @@ public class Quilt { */ public int isCulled() { if (mapdesc.isCulling()) { - // System.out.println("TODO quilt.isculled mapdesc.isculling"); + // System.out.println("TODO quilt.isculled mapdesc.isculling"); return 0; } else { return Subdivider.CULL_ACCEPT; @@ -277,6 +277,6 @@ public class Quilt { */ public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) { // TODO Auto-generated method stub - // System.out.println("TODO quilt.findrates"); + // System.out.println("TODO quilt.findrates"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt b/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt index 89630c71e..7f80e568c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt @@ -1,59 +1,59 @@ Unimplemented functionality - - tesselation and callbacks - - trimming - - setting NURBS properties (-> sampling etc.) + - tesselation and callbacks + - trimming + - setting NURBS properties (-> sampling etc.) Differences from C++ source - - no pooling - - pointers to arrays are replaced by CArrayOf... classes and their methods + - no pooling + - pointers to arrays are replaced by CArrayOf... classes and their methods Unimplemented or incomplete "calltree top" methods (according to glu.def in Mesa 6.5) - gluBeginTrim - gluDeleteNurbsRenderer - won't be needed - gluEndTrim - gluGetNurbsProperty - gluLoadSamplingMatrices - gluNurbsCallback - gluNurbsCallbackData - gluNurbsCallbackDataEXT - gluNurbsCurve - TODO type switch - gluNurbsProperty - gluPwlCurve - gluQuadricCallback - not a NURBS method + gluBeginTrim + gluDeleteNurbsRenderer - won't be needed + gluEndTrim + gluGetNurbsProperty + gluLoadSamplingMatrices + gluNurbsCallback + gluNurbsCallbackData + gluNurbsCallbackDataEXT + gluNurbsCurve - TODO type switch + gluNurbsProperty + gluPwlCurve + gluQuadricCallback - not a NURBS method As of files - - Arc[ST]dirSorter.java - unimplemented (part of tesselation) - - Backend.java:194 - wireframe quads - part of tesselation/callback - - Curve.java:141-204 - culling - - DisplayList.java:57 - append to DL - not sure whether it will be needed - - GLUnurbs.java :443,484 - error values - :445 - trimming - :512 - error handling (callback) - :530 - loadGLmatrices - :786 - nuid - nurbs object id - won't be needed I think - :803 - end trim - - GLUwNURBS.java:68,176 - NUBRS properties - - Knotspec.java :371 - copying in general case (more than 4 coords) - :517 - copying with more than 4 coords - :556 - pt_oo_sum default - - Knotvector.java:165 - show method (probably debugging) - - Mapdesc.java :354 - get property - :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality - - Maplist.java:68 - clear ? - - OpenGLCurveEvaluator.java :132 - tess./callback code - :168 - mapgrid1f - :190 - tess./callback code (output triangles) - - OpenGLSurfaceEvaluator.java :77 . tess./callback code - :81 - glGetIntegerValue - :114 - tess./callback code - :117 - Level of detail - :144,161,201 - tess./callback code - output triangles - - Patch.java:55 - constructor stuff ? - - Patchlist.java:55 - constructor stuff ? - :97 - cull check - :105 - step size - :115 - need of sampling subdivision - :126 - need of subdivision - :137 - need of non sampling subd. - :146 - bbox (??) - -Quilt.java :254 - culling - :282 - rates - -Subdivider.java - all TODOs - it's stuff about trimming probably - :545 - jumpbuffer - not sure purpose it exactly served in original source + - Arc[ST]dirSorter.java - unimplemented (part of tesselation) + - Backend.java:194 - wireframe quads - part of tesselation/callback + - Curve.java:141-204 - culling + - DisplayList.java:57 - append to DL - not sure whether it will be needed + - GLUnurbs.java :443,484 - error values + :445 - trimming + :512 - error handling (callback) + :530 - loadGLmatrices + :786 - nuid - nurbs object id - won't be needed I think + :803 - end trim + - GLUwNURBS.java:68,176 - NUBRS properties + - Knotspec.java :371 - copying in general case (more than 4 coords) + :517 - copying with more than 4 coords + :556 - pt_oo_sum default + - Knotvector.java:165 - show method (probably debugging) + - Mapdesc.java :354 - get property + :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality + - Maplist.java:68 - clear ? + - OpenGLCurveEvaluator.java :132 - tess./callback code + :168 - mapgrid1f + :190 - tess./callback code (output triangles) + - OpenGLSurfaceEvaluator.java :77 . tess./callback code + :81 - glGetIntegerValue + :114 - tess./callback code + :117 - Level of detail + :144,161,201 - tess./callback code - output triangles + - Patch.java:55 - constructor stuff ? + - Patchlist.java:55 - constructor stuff ? + :97 - cull check + :105 - step size + :115 - need of sampling subdivision + :126 - need of subdivision + :137 - need of non sampling subd. + :146 - bbox (??) + -Quilt.java :254 - culling + :282 - rates + -Subdivider.java - all TODOs - it's stuff about trimming probably + :545 - jumpbuffer - not sure purpose it exactly served in original source diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java index 3378dba8d..37774f811 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java @@ -187,7 +187,7 @@ public class Subdivider { renderhints.init(); if (qlist == null) { - // System.out.println("qlist is null"); + // System.out.println("qlist is null"); return; } @@ -217,7 +217,7 @@ public class Subdivider { } else { float[] rate = new float[2]; qlist.findRates(spbrkpts, tpbrkpts, rate); - // System.out.println("subdivider.drawsurfaces decompose"); + // System.out.println("subdivider.drawsurfaces decompose"); } backend.bgnsurf(renderhints.wiretris, renderhints.wirequads); @@ -268,7 +268,7 @@ public class Subdivider { */ private void freejarcs(Bin initialbin2) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.freejarcs"); + // System.out.println("TODO subdivider.freejarcs"); } /** @@ -319,7 +319,7 @@ public class Subdivider { } } } else{ - // System.out.println("Source is empty - subdivider.splitins"); + // System.out.println("Source is empty - subdivider.splitins"); } } @@ -331,7 +331,7 @@ public class Subdivider { */ private void splitInT(Bin source, int start, int end) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.splitint"); + // System.out.println("TODO subdivider.splitint"); if (source.isnonempty()) { if (start != end) { @@ -485,7 +485,7 @@ public class Subdivider { */ private void monosplitInS(Bin source, int start, int end) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.monosplitins"); + // System.out.println("TODO subdivider.monosplitins"); } /** @@ -494,7 +494,7 @@ public class Subdivider { */ private void findIrregularS(Bin source) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.findIrregularS"); + // System.out.println("TODO subdivider.findIrregularS"); } /** @@ -502,7 +502,7 @@ public class Subdivider { */ private void setArcTypePwl() { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.setarctypepwl"); + // System.out.println("TODO subdivider.setarctypepwl"); } /** @@ -512,7 +512,7 @@ public class Subdivider { */ private void tesselation(Bin source, Patchlist patchlist) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.tesselation"); + // System.out.println("TODO subdivider.tesselation"); } /** @@ -520,7 +520,7 @@ public class Subdivider { */ private void setDegenerate() { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.setdegenerate"); + // System.out.println("TODO subdivider.setdegenerate"); } /** @@ -611,7 +611,7 @@ public class Subdivider { */ private void join_t(Bin left, Bin right, Arc arc, Arc relative) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.join_t"); + // System.out.println("TODO subdivider.join_t"); } /** @@ -621,7 +621,7 @@ public class Subdivider { */ private void check_t(Arc arc, Arc relative) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.check_t"); + // System.out.println("TODO subdivider.check_t"); } /** @@ -670,7 +670,7 @@ public class Subdivider { */ private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.link"); + // System.out.println("TODO subdivider.link"); } /** @@ -679,7 +679,7 @@ public class Subdivider { */ private boolean isBezierArcType() { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.isbezierarc"); + // System.out.println("TODO subdivider.isbezierarc"); return true; } @@ -690,7 +690,7 @@ public class Subdivider { */ private void simplelink(Arc jarc1, Arc jarc2) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.simplelink"); + // System.out.println("TODO subdivider.simplelink"); } /** @@ -700,7 +700,7 @@ public class Subdivider { */ private void check_s(Arc arc, Arc relative) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.check_s"); + // System.out.println("TODO subdivider.check_s"); } @@ -756,7 +756,7 @@ public class Subdivider { } else { if (hdiff > 0) { // TODO rest - // System.out.println("TODO subdivider.partition rest of else"); + // System.out.println("TODO subdivider.partition rest of else"); } else if (hdiff == 0) { tailonleft.addarc(jarc); } else { @@ -788,7 +788,7 @@ public class Subdivider { private void classify_tailonright_t(Bin tailonright, Bin intersections, Bin right, float value) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.classify_tailonright_t"); + // System.out.println("TODO subdivider.classify_tailonright_t"); } @@ -862,7 +862,7 @@ public class Subdivider { */ private boolean ccwTurn_sr(Arc prev, Arc j) { // TODO Auto-generated method stub - // System.out.println("TODO ccwTurn_sr"); + // System.out.println("TODO ccwTurn_sr"); return false; } @@ -876,7 +876,7 @@ public class Subdivider { private void classify_headonright_t(Bin headonright, Bin intersections, Bin right, float value) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.classify_headonright_t"); + // System.out.println("TODO subdivider.classify_headonright_t"); } /** @@ -889,7 +889,7 @@ public class Subdivider { private void classify_tailonleft_t(Bin tailonleft, Bin intersections, Bin left, float value) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.classify_tailonleft_t"); + // System.out.println("TODO subdivider.classify_tailonleft_t"); } /** @@ -930,7 +930,7 @@ public class Subdivider { */ private boolean ccwTurn_tl(Arc prev, Arc j) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.ccwTurn_tl"); + // System.out.println("TODO subdivider.ccwTurn_tl"); return false; } @@ -1004,7 +1004,7 @@ public class Subdivider { */ private boolean ccwTurn_sl(Arc prev, Arc j) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.ccwTurn_sl"); + // System.out.println("TODO subdivider.ccwTurn_sl"); return false; } @@ -1018,7 +1018,7 @@ public class Subdivider { */ private int arc_split(Arc jarc, int param, float value, int i) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.arc_split"); + // System.out.println("TODO subdivider.arc_split"); return 0; } @@ -1045,7 +1045,7 @@ public class Subdivider { */ private void outline(Bin source) { // TODO Auto-generated method stub - // System.out.println("TODO subdivider.outline"); + // System.out.println("TODO subdivider.outline"); } /** @@ -1128,7 +1128,7 @@ public class Subdivider { if (curvelist.needsSamplingSubdivision() && (subdivisions > 0)) { // TODO kód - // System.out.println("TODO subdivider-needsSamplingSubdivision"); + // System.out.println("TODO subdivider-needsSamplingSubdivision"); } else { int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); backend.curvgrid(curvelist.range[0], curvelist.range[1], nu); diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java index 13c226a7c..17f58309a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java @@ -54,16 +54,16 @@ package jogamp.opengl.glu.tessellator; class ActiveRegion { - GLUhalfEdge eUp; /* upper edge, directed right to left */ - DictNode nodeUp; /* dictionary node corresponding to eUp */ - int windingNumber; /* used to determine which regions are + GLUhalfEdge eUp; /* upper edge, directed right to left */ + DictNode nodeUp; /* dictionary node corresponding to eUp */ + int windingNumber; /* used to determine which regions are * inside the polygon */ - boolean inside; /* is this region inside the polygon? */ - boolean sentinel; /* marks fake edges at t = +/-infinity */ - boolean dirty; /* marks regions where the upper or lower + boolean inside; /* is this region inside the polygon? */ + boolean sentinel; /* marks fake edges at t = +/-infinity */ + boolean dirty; /* marks regions where the upper or lower * edge has changed, but we haven't checked * whether they intersect yet */ - boolean fixUpperEdge; /* marks temporary edges introduced when + boolean fixUpperEdge; /* marks temporary edges introduced when * we process a "right vertex" (one without * any edges leaving to the right) */ } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java index b15bf7195..892722d9f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java @@ -53,13 +53,13 @@ package jogamp.opengl.glu.tessellator; class GLUface { - public GLUface next; /* next face (never NULL) */ - public GLUface prev; /* previous face (never NULL) */ - public GLUhalfEdge anEdge; /* a half edge with this left face */ - public Object data; /* room for client's data */ + public GLUface next; /* next face (never NULL) */ + public GLUface prev; /* previous face (never NULL) */ + public GLUhalfEdge anEdge; /* a half edge with this left face */ + public Object data; /* room for client's data */ /* Internal data (keep hidden) */ - public GLUface trail; /* "stack" for conversion to strips */ - public boolean marked; /* flag for conversion to strips */ - public boolean inside; /* this face is in the polygon interior */ + public GLUface trail; /* "stack" for conversion to strips */ + public boolean marked; /* flag for conversion to strips */ + public boolean inside; /* this face is in the polygon interior */ } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java index 385a4384b..29944f9b2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java @@ -53,16 +53,16 @@ package jogamp.opengl.glu.tessellator; class GLUhalfEdge { - public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */ - public GLUhalfEdge Sym; /* same edge, opposite direction */ - public GLUhalfEdge Onext; /* next edge CCW around origin */ - public GLUhalfEdge Lnext; /* next edge CCW around left face */ - public GLUvertex Org; /* origin vertex (Overtex too long) */ - public jogamp.opengl.glu.tessellator.GLUface Lface; /* left face */ + public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */ + public GLUhalfEdge Sym; /* same edge, opposite direction */ + public GLUhalfEdge Onext; /* next edge CCW around origin */ + public GLUhalfEdge Lnext; /* next edge CCW around left face */ + public GLUvertex Org; /* origin vertex (Overtex too long) */ + public jogamp.opengl.glu.tessellator.GLUface Lface; /* left face */ /* Internal data (keep hidden) */ - public jogamp.opengl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */ - public int winding; /* change in winding number when crossing */ + public jogamp.opengl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */ + public int winding; /* change in winding number when crossing */ public boolean first; public GLUhalfEdge(boolean first) { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java index dfdf5be70..10af74319 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java @@ -53,8 +53,8 @@ package jogamp.opengl.glu.tessellator; class GLUmesh { - GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */ - jogamp.opengl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */ - jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */ - jogamp.opengl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */ + GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */ + jogamp.opengl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */ + jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */ + jogamp.opengl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */ } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java index 182820bbc..d594cb3eb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java @@ -59,32 +59,32 @@ import javax.media.opengl.glu.*; public class GLUtessellatorImpl implements GLUtessellator { public static final int TESS_MAX_CACHE = 100; - private int state; /* what begin/end calls have we seen? */ + private int state; /* what begin/end calls have we seen? */ - private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */ - GLUmesh mesh; /* stores the input contours, and eventually + private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */ + GLUmesh mesh; /* stores the input contours, and eventually the tessellation itself */ /*** state needed for projecting onto the sweep plane ***/ - double[] normal = new double[3]; /* user-specified normal (if provided) */ - double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */ - double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */ + double[] normal = new double[3]; /* user-specified normal (if provided) */ + double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */ + double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */ /*** state needed for the line sweep ***/ - private double relTolerance; /* tolerance for merging features */ - int windingRule; /* rule for determining polygon interior */ - boolean fatalError; /* fatal error: needed combine callback */ + private double relTolerance; /* tolerance for merging features */ + int windingRule; /* rule for determining polygon interior */ + boolean fatalError; /* fatal error: needed combine callback */ - Dict dict; /* edge dictionary for sweep line */ - PriorityQ pq; /* priority queue of vertex events */ - GLUvertex event; /* current sweep event being processed */ + Dict dict; /* edge dictionary for sweep line */ + PriorityQ pq; /* priority queue of vertex events */ + GLUvertex event; /* current sweep event being processed */ /*** state needed for rendering callbacks (see render.c) ***/ - boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ - boolean boundaryOnly; /* Extract contours, not triangles */ + boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ + boolean boundaryOnly; /* Extract contours, not triangles */ boolean avoidDegenerateTris; /* JOGL-specific hint to try to improve triangulation by avoiding producing degenerate (zero-area) triangles; has not been tested exhaustively and is therefore an option */ @@ -96,12 +96,12 @@ public class GLUtessellatorImpl implements GLUtessellator { /*** state needed to cache single-contour polygons for renderCache() */ - private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */ - int cacheCount; /* number of cached vertices */ - CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */ + private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */ + int cacheCount; /* number of cached vertices */ + CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */ /*** rendering callbacks that also pass polygon data ***/ - private Object polygonData; /* client data for current polygon */ + private Object polygonData; /* client data for current polygon */ private GLUtessellatorCallback callBegin; private GLUtessellatorCallback callEdgeFlag; @@ -120,10 +120,10 @@ public class GLUtessellatorImpl implements GLUtessellator { private GLUtessellatorCallback callCombineData; private static final double GLU_TESS_DEFAULT_TOLERANCE = 0.0; -// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */ +// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */ private static GLUtessellatorCallback NULL_CB = new GLUtessellatorCallbackAdapter(); -// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ +// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ // MAX(sizeof(GLUvertex),sizeof(GLUface)))) private GLUtessellatorImpl() { @@ -220,7 +220,7 @@ public class GLUtessellatorImpl implements GLUtessellator { case GLU.GLU_TESS_WINDING_RULE: int windingRule = (int) value; - if (windingRule != value) break; /* not an integer */ + if (windingRule != value) break; /* not an integer */ switch (windingRule) { case GLU.GLU_TESS_WINDING_ODD: @@ -523,7 +523,7 @@ public class GLUtessellatorImpl implements GLUtessellator { * Each interior region is guaranteed be monotone. */ if (!Sweep.__gl_computeInterior(this)) { - throw new RuntimeException(); /* could've used a label */ + throw new RuntimeException(); /* could've used a label */ } mesh = this.mesh; @@ -539,7 +539,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } else { rc = TessMono.__gl_meshTessellateInterior(mesh, avoidDegenerateTris); } - if (!rc) throw new RuntimeException(); /* could've used a label */ + if (!rc) throw new RuntimeException(); /* could've used a label */ Mesh.__gl_meshCheckMesh(mesh); @@ -552,7 +552,7 @@ public class GLUtessellatorImpl implements GLUtessellator { if (boundaryOnly) { Render.__gl_renderBoundary(this, mesh); /* output boundary contours */ } else { - Render.__gl_renderMesh(this, mesh); /* output strips and fans */ + Render.__gl_renderMesh(this, mesh); /* output strips and fans */ } } // if (callMesh != NULL_CB) { @@ -564,7 +564,7 @@ public class GLUtessellatorImpl implements GLUtessellator { // * faces in the first place. // */ // TessMono.__gl_meshDiscardExterior(mesh); -// callMesh.mesh(mesh); /* user wants the mesh itself */ +// callMesh.mesh(mesh); /* user wants the mesh itself */ // mesh = null; // polygonData = null; // return; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java index c30d75946..ecc91c2b6 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java @@ -53,13 +53,13 @@ package jogamp.opengl.glu.tessellator; class GLUvertex { - public GLUvertex next; /* next vertex (never NULL) */ - public GLUvertex prev; /* previous vertex (never NULL) */ - public jogamp.opengl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */ - public Object data; /* client's data */ + public GLUvertex next; /* next vertex (never NULL) */ + public GLUvertex prev; /* previous vertex (never NULL) */ + public jogamp.opengl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */ + public Object data; /* client's data */ /* Internal data (keep hidden) */ - public double[] coords = new double[3]; /* vertex location in 3D */ - public double s, t; /* projection onto the sweep plane */ - public int pqHandle; /* to allow deletion from priority queue */ + public double[] coords = new double[3]; /* vertex location in 3D */ + public double s, t; /* projection onto the sweep plane */ + public int pqHandle; /* to allow deletion from priority queue */ } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java index 942dfe8d1..eb48aa5a4 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java @@ -281,8 +281,8 @@ class Mesh { /* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the * mesh connectivity and topology. It changes the mesh so that - * eOrg->Onext <- OLD( eDst->Onext ) - * eDst->Onext <- OLD( eOrg->Onext ) + * eOrg->Onext <- OLD( eDst->Onext ) + * eDst->Onext <- OLD( eOrg->Onext ) * where OLD(...) means the value before the meshSplice operation. * * This can have two effects on the vertex structure: @@ -453,9 +453,9 @@ class Mesh { /* Set the vertex and face information */ eOrg.Sym.Org = eNew.Org; - eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */ + eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */ eNew.Sym.Lface = eOrg.Sym.Lface; - eNew.winding = eOrg.winding; /* copy old winding information */ + eNew.winding = eOrg.winding; /* copy old winding information */ eNew.Sym.winding = eOrg.Sym.winding; return eNew; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java index 7d5acd9f8..196e6cf27 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java @@ -60,7 +60,7 @@ class Normal { } static boolean SLANTED_SWEEP = false; - static double S_UNIT_X; /* Pre-normalized */ + static double S_UNIT_X; /* Pre-normalized */ static double S_UNIT_Y; private static final boolean TRUE_PROJECT = false; @@ -75,7 +75,7 @@ class Normal { * direction to be something unusual (ie. not parallel to one of the * coordinate axes). */ - S_UNIT_X = 0.50941539564955385; /* Pre-normalized */ + S_UNIT_X = 0.50941539564955385; /* Pre-normalized */ S_UNIT_Y = 0.86052074622010633; } else { S_UNIT_X = 1.0; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java index 899df2e3d..474056cc3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java @@ -76,7 +76,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { freeList = 0; this.leq = leq; - nodes[1].handle = 1; /* so that Minimum() returns NULL */ + nodes[1].handle = 1; /* so that Minimum() returns NULL */ handles[1].key = null; } @@ -171,7 +171,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } nodes = pqNodes; if (nodes == null) { - nodes = saveNodes; /* restore ptr to free upon return */ + nodes = saveNodes; /* restore ptr to free upon return */ return Integer.MAX_VALUE; } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java index f37f98ace..f9e0225e3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java @@ -152,7 +152,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { } while (LT(leq, keys[order[j]], keys[piv])); Swap(order, i, j); } while (i < j); - Swap(order, i, j); /* Undo last swap */ + Swap(order, i, j); /* Undo last swap */ if (i - p < r - j) { stack[top].p = j + 1; stack[top].r = r; @@ -176,7 +176,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { } max = size; initialized = true; - heap.pqInit(); /* always succeeds */ + heap.pqInit(); /* always succeeds */ /* #ifndef NDEBUG p = order; @@ -208,7 +208,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { System.arraycopy( keys, 0, pqKeys, 0, keys.length ); keys = pqKeys; if (keys == null) { - keys = saveKey; /* restore ptr to free upon return */ + keys = saveKey; /* restore ptr to free upon return */ return Integer.MAX_VALUE; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java index 34b7ee55b..1801e1c59 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java @@ -79,8 +79,8 @@ class Render { this.render = render; } - long size; /* number of triangles used */ - jogamp.opengl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */ + long size; /* number of triangles used */ + jogamp.opengl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */ renderCallBack render; }; @@ -295,7 +295,7 @@ class Render { */ jogamp.opengl.glu.tessellator.GLUhalfEdge e; int newState; - int edgeState = -1; /* force edge state output for first vertex */ + int edgeState = -1; /* force edge state output for first vertex */ tess.callBeginOrBeginData(GL.GL_TRIANGLES); diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java index 95eb5dda1..b4a400c1c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java @@ -300,7 +300,7 @@ class Sweep { regPrev = regFirst; ePrev = regFirst.eUp; while (regPrev != regLast) { - regPrev.fixUpperEdge = false; /* placement was OK */ + regPrev.fixUpperEdge = false; /* placement was OK */ reg = RegionBelow(regPrev); e = reg.eUp; if (e.Org != ePrev.Org) { @@ -327,7 +327,7 @@ class Sweep { if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); if (!Mesh.__gl_meshSplice(ePrev, e)) throw new RuntimeException(); } - FinishRegion(tess, regPrev); /* may change reg.eUp */ + FinishRegion(tess, regPrev); /* may change reg.eUp */ ePrev = reg.eUp; regPrev = reg; } @@ -627,11 +627,11 @@ class Sweep { assert (orgUp != tess.event && orgLo != tess.event); assert (!regUp.fixUpperEdge && !regLo.fixUpperEdge); - if (orgUp == orgLo) return false; /* right endpoints are the same */ + if (orgUp == orgLo) return false; /* right endpoints are the same */ tMinUp = Math.min(orgUp.t, dstUp.t); tMaxLo = Math.max(orgLo.t, dstLo.t); - if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */ + if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */ if (Geom.VertLeq(orgUp, orgLo)) { if (Geom.EdgeSign(dstLo, orgUp, orgLo) > 0) return false; @@ -743,7 +743,7 @@ class Sweep { eUp.Org.t = isect.t; eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */ if (eUp.Org.pqHandle == Long.MAX_VALUE) { - tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ + tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ tess.pq = null; throw new RuntimeException(); } @@ -959,7 +959,7 @@ class Sweep { regUp.fixUpperEdge = false; } if (!Mesh.__gl_meshSplice(vEvent.anEdge, e)) throw new RuntimeException(); - SweepEvent(tess, vEvent); /* recurse */ + SweepEvent(tess, vEvent); /* recurse */ return; } @@ -1001,9 +1001,9 @@ class Sweep { * * - the degenerate case: if vEvent is close enough to U or L, we * merge vEvent into that edge chain. The subcases are: - * - merging with the rightmost vertex of U or L - * - merging with the active edge of U or L - * - merging with an already-processed portion of U or L + * - merging with the rightmost vertex of U or L + * - merging with the active edge of U or L + * - merging with an already-processed portion of U or L */ { ActiveRegion regUp, regLo, reg; GLUhalfEdge eUp, eLo, eNew; @@ -1063,7 +1063,7 @@ class Sweep { ActiveRegion regUp, reg; GLUhalfEdge e, eTopLeft, eBottomLeft; - tess.event = vEvent; /* for access in EdgeLeq() */ + tess.event = vEvent; /* for access in EdgeLeq() */ DebugEvent(tess); /* Check if this vertex is the right endpoint of an edge that is @@ -1130,7 +1130,7 @@ class Sweep { e.Org.t = t; e.Sym.Org.s = -SENTINEL_COORD; e.Sym.Org.t = t; - tess.event = e.Sym.Org; /* initialize it */ + tess.event = e.Sym.Org; /* initialize it */ reg.eUp = e; reg.windingNumber = 0; @@ -1180,7 +1180,7 @@ class Sweep { DeleteRegion(tess, reg); /* __gl_meshDelete( reg.eUp );*/ } - Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */ + Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */ } @@ -1199,7 +1199,7 @@ class Sweep { if (Geom.VertEq(e.Org, e.Sym.Org) && e.Lnext.Lnext != e) { /* Zero-length edge, contour has at least 3 edges */ - SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */ + SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */ if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); /* e is a self-loop */ e = eLnext; eLnext = e.Lnext; @@ -1243,7 +1243,7 @@ class Sweep { if (v.pqHandle == Long.MAX_VALUE) break; } if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */ - tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ + tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ tess.pq = null; return false; } @@ -1306,7 +1306,7 @@ class Sweep { * all the vertices in a priority queue. Events are processed in * lexicographic order, ie. * - * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) + * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) */ RemoveDegenerateEdges(tess); if (!InitPriorityQ(tess)) return false; /* if error */ diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 085889739..2a2fba8bd 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -49,7 +49,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; public abstract class MacOSXCGLContext extends GLContextImpl -{ +{ protected boolean isNSContext; private CGLExt cglExt; // Table that holds the addresses of the native C-language entry points for @@ -178,7 +178,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl } } } - + protected void releaseImpl() throws GLException { if ( isNSContext ) { if (!CGL.clearCurrentContext(contextHandle)) { @@ -188,7 +188,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl CGL.CGLReleaseContext(contextHandle); } } - + protected void destroyImpl() throws GLException { if ( !isNSContext ) { if (CGL.kCGLNoError != CGL.CGLDestroyContext(contextHandle)) { @@ -254,12 +254,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl } } } - + public String getPlatformExtensionsString() { return ""; } - + protected void swapBuffers() { DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java index 6dba11038..949963fa0 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java @@ -48,7 +48,7 @@ public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext GLContext shareWith) { super(drawable, shareWith); } - + public int getOffscreenContextPixelDataType() { GL gl = getGL(); return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java index 6eda3f068..dc5ce26c8 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -138,7 +138,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities(); if (capabilities.getPbufferFloatingPointBuffers() && - !isTigerOrLater) { + !isTigerOrLater) { throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later"); } // Change our OpenGL mode to match that of any share context before we create ourselves diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 248dfa482..c9cdcad90 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -169,7 +169,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { /** * http://msdn.microsoft.com/en-us/library/ms724832%28v=vs.85%29.aspx - * Windows XP 5.1 + * Windows XP 5.1 */ static final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0); @@ -199,22 +199,22 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { hasARBReadDrawable = arbReadDrawable; vendor = glVendor; if(null != vendor) { - isVendorNVIDIA = vendor.startsWith("NVIDIA") ; - isVendorATI = vendor.startsWith("ATI") ; + isVendorNVIDIA = vendor.startsWith("NVIDIA") ; + isVendorATI = vendor.startsWith("ATI") ; } - if ( isVendorATI() ) { - final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), "."); - final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0; - if(DEBUG) { - System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion()); - } - needsCurrenContext4ARBPFDQueries = isWinXPOrLess; - } else { - if(DEBUG) { - System.err.println("needsCurrenContext4ARBPFDQueries: false"); - } - needsCurrenContext4ARBPFDQueries = false; + if ( isVendorATI() ) { + final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), "."); + final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0; + if(DEBUG) { + System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion()); + } + needsCurrenContext4ARBPFDQueries = isWinXPOrLess; + } else { + if(DEBUG) { + System.err.println("needsCurrenContext4ARBPFDQueries: false"); + } + needsCurrenContext4ARBPFDQueries = false; } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 1899f5212..8859d636a 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -158,7 +158,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio if (0 == hdc) { throw new GLException("Error: HDC is null"); } - + if (!GDI.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) { throw new GLException("Unable to set pixel format " + caps + " for device context " + toHexString(hdc) + @@ -166,7 +166,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio } if (DEBUG) { System.err.println("!!! setPixelFormat (ARB): hdc "+toHexString(hdc) +", "+caps); - } + } setCapsPFD(caps); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index 8c1f5e87c..d765572a6 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -192,25 +192,25 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration(); if( !config.isExternal() ) { - if( !config.isDetermined() ) { - updateGraphicsConfiguration(config, chooser, factory, hdc, false, pfdIDs); - } else { - // set PFD if not set yet - int pfdID = -1; - boolean set = false; - if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) { - if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) { - throw new GLException("Unable to set pixel format " + config.getPixelFormatID() + - " for device context " + toHexString(hdc) + - ": error code " + GDI.GetLastError()); - } - set = true; - } - if (DEBUG) { - System.err.println("!!! setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set); - Thread.dumpStack(); - } - } + if( !config.isDetermined() ) { + updateGraphicsConfiguration(config, chooser, factory, hdc, false, pfdIDs); + } else { + // set PFD if not set yet + int pfdID = -1; + boolean set = false; + if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) { + if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) { + throw new GLException("Unable to set pixel format " + config.getPixelFormatID() + + " for device context " + toHexString(hdc) + + ": error code " + GDI.GetLastError()); + } + set = true; + } + if (DEBUG) { + System.err.println("!!! setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set); + Thread.dumpStack(); + } + } } } finally { ns.unlockSurface(); @@ -400,9 +400,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } if ( !extHDC && !pixelFormatSet ) { - config.setPixelFormat(hdc, pixelFormatCaps); + config.setPixelFormat(hdc, pixelFormatCaps); } else { - config.setCapsPFD(pixelFormatCaps); + config.setCapsPFD(pixelFormatCaps); } return true; } @@ -476,9 +476,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } if ( !extHDC && !pixelFormatSet ) { - config.setPixelFormat(hdc, pixelFormatCaps); + config.setPixelFormat(hdc, pixelFormatCaps); } else { - config.setCapsPFD(pixelFormatCaps); + config.setCapsPFD(pixelFormatCaps); } return true; } |