diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/opengl/glu | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/glu')
73 files changed, 1871 insertions, 1898 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index 717b1255c..977881e6b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -132,7 +132,7 @@ import com.jogamp.opengl.util.glsl.ShaderState; */ public class GLUquadricImpl implements GLUquadric { - private boolean useGLSL; + private final boolean useGLSL; private int drawStyle; private int orientation; private boolean textureFlag; @@ -149,7 +149,7 @@ public class GLUquadricImpl implements GLUquadric { private ImmModeSink immModeSink=null; - public GLUquadricImpl(GL gl, boolean useGLSL, ShaderState st, int shaderProgram) { + public GLUquadricImpl(final GL gl, final boolean useGLSL, final ShaderState st, final int shaderProgram) { this.gl=gl; this.useGLSL = useGLSL; this.drawStyle = GLU.GLU_FILL; @@ -165,7 +165,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void enableImmModeSink(boolean val) { + public void enableImmModeSink(final boolean val) { if(gl.isGL2()) { immModeSinkEnabled=val; } else { @@ -182,7 +182,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void setImmMode(boolean val) { + public void setImmMode(final boolean val) { if(immModeSinkEnabled) { immModeSinkImmediate=val; } else { @@ -199,7 +199,7 @@ public class GLUquadricImpl implements GLUquadric { public ImmModeSink replaceImmModeSink() { if(!immModeSinkEnabled) return null; - ImmModeSink res = immModeSink; + final ImmModeSink res = immModeSink; if(useGLSL) { if(null != shaderState) { immModeSink = ImmModeSink.createGLSL (32, @@ -228,7 +228,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void resetImmModeSink(GL gl) { + public void resetImmModeSink(final GL gl) { if(immModeSinkEnabled) { immModeSink.reset(gl); } @@ -252,7 +252,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param drawStyle The drawStyle to set */ - public void setDrawStyle(int drawStyle) { + public void setDrawStyle(final int drawStyle) { this.drawStyle = drawStyle; } @@ -269,7 +269,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param normals The normals to set */ - public void setNormals(int normals) { + public void setNormals(final int normals) { this.normals = normals; } @@ -286,7 +286,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param orientation The orientation to set */ - public void setOrientation(int orientation) { + public void setOrientation(final int orientation) { this.orientation = orientation; } @@ -301,7 +301,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param textureFlag The textureFlag to set */ - public void setTextureFlag(boolean textureFlag) { + public void setTextureFlag(final boolean textureFlag) { this.textureFlag = textureFlag; } @@ -363,7 +363,7 @@ public class GLUquadricImpl implements GLUquadric { * @param slices Specifies the number of subdivisions around the z axis. * @param stacks Specifies the number of subdivisions along the z axis. */ - public void drawCylinder(GL gl, float baseRadius, float topRadius, float height, int slices, int stacks) { + public void drawCylinder(final GL gl, final float baseRadius, final float topRadius, final float height, final int slices, final int stacks) { float da, r, dr, dz; float x, y, z, nz, nsign; @@ -446,8 +446,8 @@ public class GLUquadricImpl implements GLUquadric { } glEnd(gl); } else if (drawStyle == GLU.GLU_FILL) { - float ds = 1.0f / slices; - float dt = 1.0f / stacks; + final float ds = 1.0f / slices; + final float dt = 1.0f / stacks; float t = 0.0f; z = 0.0f; r = baseRadius; @@ -505,7 +505,7 @@ public class GLUquadricImpl implements GLUquadric { * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at * (0, -r, 0) it is (0.5, 0). */ - public void drawDisk(GL gl, float innerRadius, float outerRadius, int slices, int loops) + public void drawDisk(final GL gl, final float innerRadius, final float outerRadius, final int slices, final int loops) { float da, dr; @@ -529,12 +529,12 @@ public class GLUquadricImpl implements GLUquadric { * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] * (linear mapping) */ - float dtc = 2.0f * outerRadius; + final float dtc = 2.0f * outerRadius; float sa, ca; float r1 = innerRadius; int l; for (l = 0; l < loops; l++) { - float r2 = r1 + dr; + final float r2 = r1 + dr; if (orientation == GLU.GLU_OUTSIDE) { int s; glBegin(gl, ImmModeSink.GL_QUAD_STRIP); @@ -580,22 +580,22 @@ public class GLUquadricImpl implements GLUquadric { int l, s; /* draw loops */ for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; + final float r = innerRadius + l * dr; glBegin(gl, GL.GL_LINE_LOOP); for (s = 0; s < slices; s++) { - float a = s * da; + final float a = s * da; glVertex2f(gl, r * sin(a), r * cos(a)); } glEnd(gl); } /* draw spokes */ for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); + final float a = s * da; + final float x = sin(a); + final float y = cos(a); glBegin(gl, GL.GL_LINE_STRIP); for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; + final float r = innerRadius + l * dr; glVertex2f(gl, r * x, r * y); } glEnd(gl); @@ -607,12 +607,12 @@ public class GLUquadricImpl implements GLUquadric { int s; glBegin(gl, GL.GL_POINTS); for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); + final float a = s * da; + final float x = sin(a); + final float y = cos(a); int l; for (l = 0; l <= loops; l++) { - float r = innerRadius * l * dr; + final float r = innerRadius * l * dr; glVertex2f(gl, r * x, r * y); } } @@ -625,8 +625,8 @@ public class GLUquadricImpl implements GLUquadric { float a; glBegin(gl, GL.GL_LINE_LOOP); for (a = 0.0f; a < 2.0 * PI; a += da) { - float x = innerRadius * sin(a); - float y = innerRadius * cos(a); + final float x = innerRadius * sin(a); + final float y = innerRadius * cos(a); glVertex2f(gl, x, y); } glEnd(gl); @@ -635,8 +635,8 @@ public class GLUquadricImpl implements GLUquadric { float a; glBegin(gl, GL.GL_LINE_LOOP); for (a = 0; a < 2.0f * PI; a += da) { - float x = outerRadius * sin(a); - float y = outerRadius * cos(a); + final float x = outerRadius * sin(a); + final float y = outerRadius * cos(a); glVertex2f(gl, x, y); } glEnd(gl); @@ -671,16 +671,16 @@ public class GLUquadricImpl implements GLUquadric { * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), * and at (0, -r, 0) it is (0.5, 0). */ - public void drawPartialDisk(GL gl, - float innerRadius, - float outerRadius, + public void drawPartialDisk(final GL gl, + final float innerRadius, + final float outerRadius, int slices, - int loops, + final int loops, float startAngle, float sweepAngle) { int i, j; - float[] sinCache = new float[CACHE_SIZE]; - float[] cosCache = new float[CACHE_SIZE]; + final float[] sinCache = new float[CACHE_SIZE]; + final float[] cosCache = new float[CACHE_SIZE]; float angle; float sintemp, costemp; float deltaRadius; @@ -952,7 +952,7 @@ public class GLUquadricImpl implements GLUquadric { * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 * at the -x axis, and back to 1.0 at the +y axis. */ - public void drawSphere(GL gl, float radius, int slices, int stacks) { + public void drawSphere(final GL gl, final float radius, final int slices, final int stacks) { // TODO float rho, drho, theta, dtheta; @@ -1121,7 +1121,7 @@ public class GLUquadricImpl implements GLUquadric { private static final float PI = (float)Math.PI; private static final int CACHE_SIZE = 240; - private final void glBegin(GL gl, int mode) { + private final void glBegin(final GL gl, final int mode) { if(immModeSinkEnabled) { immModeSink.glBegin(mode); } else { @@ -1129,7 +1129,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glEnd(GL gl) { + private final void glEnd(final GL gl) { if(immModeSinkEnabled) { immModeSink.glEnd(gl, immModeSinkImmediate); } else { @@ -1137,7 +1137,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glVertex2f(GL gl, float x, float y) { + private final void glVertex2f(final GL gl, final float x, final float y) { if(immModeSinkEnabled) { immModeSink.glVertex2f(x, y); } else { @@ -1145,7 +1145,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glVertex3f(GL gl, float x, float y, float z) { + private final void glVertex3f(final GL gl, final float x, final float y, final float z) { if(immModeSinkEnabled) { immModeSink.glVertex3f(x, y, z); } else { @@ -1153,10 +1153,10 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f_s(GL gl, float x, float y, float z) { - short a=(short)(x*0xFFFF); - short b=(short)(y*0xFFFF); - short c=(short)(z*0xFFFF); + private final void glNormal3f_s(final GL gl, final float x, final float y, final float z) { + final short a=(short)(x*0xFFFF); + final short b=(short)(y*0xFFFF); + final short c=(short)(z*0xFFFF); if(immModeSinkEnabled) { immModeSink.glNormal3s(a, b, c); } else { @@ -1164,10 +1164,10 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f_b(GL gl, float x, float y, float z) { - byte a=(byte)(x*0xFF); - byte b=(byte)(y*0xFF); - byte c=(byte)(z*0xFF); + private final void glNormal3f_b(final GL gl, final float x, final float y, final float z) { + final byte a=(byte)(x*0xFF); + final byte b=(byte)(y*0xFF); + final byte c=(byte)(z*0xFF); if(immModeSinkEnabled) { immModeSink.glNormal3b(a, b, c); } else { @@ -1175,7 +1175,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f(GL gl, float x, float y, float z) { + private final void glNormal3f(final GL gl, final float x, final float y, final float z) { switch(normalType) { case GL.GL_FLOAT: if(immModeSinkEnabled) { @@ -1193,7 +1193,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glTexCoord2f(GL gl, float x, float y) { + private final void glTexCoord2f(final GL gl, final float x, final float y) { if(immModeSinkEnabled) { immModeSink.glTexCoord2f(x, y); } else { @@ -1208,7 +1208,7 @@ public class GLUquadricImpl implements GLUquadric { * @param y * @param z */ - private void normal3f(GL gl, float x, float y, float z) { + private void normal3f(final GL gl, float x, float y, float z) { float mag; mag = (float)Math.sqrt(x * x + y * y + z * z); @@ -1220,15 +1220,15 @@ public class GLUquadricImpl implements GLUquadric { glNormal3f(gl, x, y, z); } - private final void TXTR_COORD(GL gl, float x, float y) { + private final void TXTR_COORD(final GL gl, final float x, final float y) { if (textureFlag) glTexCoord2f(gl, x,y); } - private float sin(float r) { + private float sin(final float r) { return (float)Math.sin(r); } - private float cos(float r) { + private float cos(final float r) { return (float)Math.cos(r); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/Glue.java b/src/jogl/classes/jogamp/opengl/glu/Glue.java index 2ad3d8c89..fc85b137f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/Glue.java +++ b/src/jogl/classes/jogamp/opengl/glu/Glue.java @@ -94,7 +94,7 @@ public class Glue { public Glue() { } - public static String __gluNURBSErrorString( int errno ) { + public static String __gluNURBSErrorString( final int errno ) { return( __gluNurbsErrors[ errno ] ); } @@ -108,7 +108,7 @@ public class Glue { "need combine callback" }; - public static String __gluTessErrorString( int errno ) { + public static String __gluTessErrorString( final int errno ) { return( __gluTessErrors[ errno ] ); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java index ffb8d9471..235c59717 100644 --- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java +++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java @@ -76,7 +76,7 @@ public class Error { public Error() { } - public static String gluErrorString( int errorCode ) { + public static String gluErrorString( final int errorCode ) { if( errorCode == 0 ) { return( "no error" ); } 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 4213dfd46..96da49a80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java @@ -1,42 +1,9 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -/* - ** License Applicability. Except to the extent portions of this file are - ** made subject to an alternative license as permitted in the SGI Free - ** Software License B, Version 2.0 (the "License"), the contents of this - ** file are subject only to the provisions of the License. You may not use - ** this file except in compliance with the License. You may obtain a copy - ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - ** - ** http://oss.sgi.com/projects/FreeB - ** - ** Note that, as provided in the License, the Software is distributed on an - ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - ** - ** Original Code. The Original Code is: OpenGL Sample Implementation, - ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - ** Copyright in any portions created by third parties is as indicated - ** elsewhere herein. All Rights Reserved. - ** - ** Additional Notice Provisions: The application programming interfaces - ** established by SGI in conjunction with the Original Code are The - ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - ** Window System(R) (Version 1.3), released October 19, 1998. This software - ** was created using the OpenGL(R) version 1.2.1 Sample Implementation - ** published by SGI, but has not been independently verified as being - ** compliant with the OpenGL(R) version 1.2.1 Specification. - */ - import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2.GLUgl2; @@ -55,7 +22,7 @@ class GL2CurveEvaluator implements CurveEvaluator { /** * OpenGL object */ - private GL2 gl; + private final GL2 gl; /** * Not used @@ -130,8 +97,8 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param ps control points */ @Override - public void map1f(int type, float ulo, float uhi, int stride, int order, - CArrayOfFloats ps) { + public void map1f(final int type, final float ulo, final float uhi, final int stride, final int order, + final CArrayOfFloats ps) { if (output_triangles) { // TODO code for callback (output_triangles probably indicates callback) // System.out.println("TODO curveevaluator.map1f-output_triangles"); @@ -157,7 +124,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param type what to enable */ @Override - public void enable(int type) { + public void enable(final int type) { // DONE gl.glEnable(type); } @@ -169,7 +136,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param u2 high u */ @Override - public void mapgrid1f(int nu, float u1, float u2) { + public void mapgrid1f(final int nu, final float u1, final float u2) { if (output_triangles) { // System.out.println("TODO curveevaluator.mapgrid1f"); } else @@ -185,7 +152,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param to highest param */ @Override - public void mapmesh1f(int style, int from, int to) { + public void mapmesh1f(final int style, final int from, final int to) { /* //DEBUG drawing control points this.poradi++; if (poradi % 2 == 0) @@ -200,10 +167,10 @@ class GL2CurveEvaluator implements CurveEvaluator { switch (style) { case Backend.N_MESHFILL: case Backend.N_MESHLINE: - gl.glEvalMesh1(GL2.GL_LINE, from, to); + gl.glEvalMesh1(GL2GL3.GL_LINE, from, to); break; case Backend.N_MESHPOINT: - gl.glEvalMesh1(GL2.GL_POINT, from, to); + gl.glEvalMesh1(GL2GL3.GL_POINT, from, to); break; } } 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 e9c9fca3f..e5cb715ab 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java @@ -1,42 +1,9 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -/* - ** License Applicability. Except to the extent portions of this file are - ** made subject to an alternative license as permitted in the SGI Free - ** Software License B, Version 2.0 (the "License"), the contents of this - ** file are subject only to the provisions of the License. You may not use - ** this file except in compliance with the License. You may obtain a copy - ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - ** - ** http://oss.sgi.com/projects/FreeB - ** - ** Note that, as provided in the License, the Software is distributed on an - ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - ** - ** Original Code. The Original Code is: OpenGL Sample Implementation, - ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - ** Copyright in any portions created by third parties is as indicated - ** elsewhere herein. All Rights Reserved. - ** - ** Additional Notice Provisions: The application programming interfaces - ** established by SGI in conjunction with the Original Code are The - ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - ** Window System(R) (Version 1.3), released October 19, 1998. This software - ** was created using the OpenGL(R) version 1.2.1 Sample Implementation - ** published by SGI, but has not been independently verified as being - ** compliant with the OpenGL(R) version 1.2.1 Specification. - */ - import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2.GLUgl2; @@ -50,7 +17,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { /** * JOGL OpenGL object */ - private GL2 gl; + private final GL2 gl; /** * Output triangles (callback) @@ -90,18 +57,18 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param style polygon mode (N_MESHFILL/N_MESHLINE/N_MESHPOINT) */ @Override - public void polymode(int style) { + public void polymode(final int style) { if (!output_triangles) { switch (style) { default: case NurbsConsts.N_MESHFILL: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_FILL); break; case NurbsConsts.N_MESHLINE: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_LINE); break; case NurbsConsts.N_MESHPOINT: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_POINT); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_POINT); break; } } @@ -130,7 +97,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param vhi */ @Override - public void domain2f(float ulo, float uhi, float vlo, float vhi) { + public void domain2f(final float ulo, final float uhi, final float vlo, final float vhi) { // DONE } @@ -144,7 +111,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param v1 highest v */ @Override - public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) { + public void mapgrid2f(final int nu, final float u0, final float u1, final int nv, final float v0, final float v1) { if (output_triangles) { // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles"); @@ -163,7 +130,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param vmax maximum V */ @Override - public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) { + public void mapmesh2f(final int style, final int umin, final int umax, final int vmin, final int vmax) { if (output_triangles) { // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles"); } else { @@ -176,13 +143,13 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { */ switch (style) { case NurbsConsts.N_MESHFILL: - gl.glEvalMesh2(GL2.GL_FILL, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_FILL, umin, umax, vmin, vmax); break; case NurbsConsts.N_MESHLINE: - gl.glEvalMesh2(GL2.GL_LINE, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_LINE, umin, umax, vmin, vmax); break; case NurbsConsts.N_MESHPOINT: - gl.glEvalMesh2(GL2.GL_POINT, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_POINT, umin, umax, vmin, vmax); break; } } @@ -202,8 +169,8 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param pts control points */ @Override - public void map2f(int type, float ulo, float uhi, int ustride, int uorder, - float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) { + public void map2f(final int type, final float ulo, final float uhi, final int ustride, final int uorder, + final float vlo, final float vhi, final int vstride, final int vorder, final CArrayOfFloats pts) { // TODO Auto-generated method stub if (output_triangles) { // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles"); @@ -218,7 +185,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param type what to enable */ @Override - public void enable(int type) { + public void enable(final int type) { //DONE gl.glEnable(type); } 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 f83b3a805..338d7e6d6 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -67,17 +67,17 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Matrixes autoloading */ - private boolean autoloadmode; + private final boolean autoloadmode; /** * Using callback */ - private int callBackFlag; + private final int callBackFlag; /** * Object for error call backs */ - private Object errorCallback; + private final Object errorCallback; /** * List of map definitions @@ -122,7 +122,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object holding rendering settings */ - private Renderhints renderhints; + private final Renderhints renderhints; /** * Display list @@ -132,7 +132,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object for subdividing curves and surfaces */ - private Subdivider subdivider; + private final Subdivider subdivider; /** * Object responsible for rendering @@ -221,13 +221,13 @@ public class GLUgl2nurbsImpl implements GLUnurbs { defineMap(GL2.GL_MAP1_INDEX, 0, 1); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_PIXEL_TOLERANCE, (float) 50.0); @@ -276,7 +276,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_u_rate(double d) { + private void set_domain_distance_u_rate(final double d) { // DONE subdivider.set_domain_distance_u_rate(d); } @@ -287,7 +287,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_v_rate(double d) { + private void set_domain_distance_v_rate(final double d) { // DONE subdivider.set_domain_distance_v_rate(d); } @@ -297,7 +297,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgncurve() { // DONE - O_curve o_curve = new O_curve(); + final O_curve o_curve = new O_curve(); thread("do_bgncurve", o_curve); } @@ -309,9 +309,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param arg * parameter to be passed to called method */ - private void thread(String name, Object arg) { + private void thread(final String name, final Object arg) { // DONE - Class partype[] = new Class[1]; + final Class partype[] = new Class[1]; partype[0] = arg.getClass(); Method m; try { @@ -321,7 +321,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { } else { m.invoke(this, new Object[] { arg }); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } @@ -333,16 +333,16 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param name * name of a method to be called */ - private void thread2(String name) { + private void thread2(final String name) { // DONE try { - Method m = this.getClass().getMethod(name, (Class[]) null); + final Method m = this.getClass().getMethod(name, (Class[]) null); if (dl != null) { dl.append(this, m, null); } else { m.invoke(this, (Object[]) null); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } } @@ -353,7 +353,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_curve * curve object */ - public void do_bgncurve(O_curve o_curve) { + public void do_bgncurve(final O_curve o_curve) { if (inCurve > 0) { do_nurbserror(6); endcurve(); @@ -385,7 +385,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_surface * surface object */ - public void do_bgnsurface(O_surface o_surface) { + public void do_bgnsurface(final O_surface o_surface) { // DONE if (inSurface > 0) { do_nurbserror(27); @@ -507,7 +507,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * error code */ - private void do_nurbserror(int i) { + private void do_nurbserror(final int i) { // TODO nurberror // System.out.println("TODO nurbserror " + i); } @@ -553,10 +553,10 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param realType * type of the curve */ - public void nurbscurve(int nknots, float[] knot, int stride, - float[] ctlarray, int order, int realType) { + public void nurbscurve(final int nknots, final float[] knot, final int stride, + final float[] ctlarray, final int order, final int realType) { // DONE - Mapdesc mapdesc = maplist.locate(realType); + final Mapdesc mapdesc = maplist.locate(realType); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -572,14 +572,14 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector knots = new Knotvector(nknots, stride, order, knot); + final Knotvector knots = new Knotvector(nknots, stride, order, knot); if (!do_check_knots(knots, "curve")) return; - O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); + final O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); o_nurbscurve.bezier_curves = new Quilt(mapdesc); - CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); o_nurbscurve.bezier_curves.toBezier(knots, ctrlcarr, mapdesc .getNCoords()); thread("do_nurbscurve", o_nurbscurve); @@ -594,9 +594,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * error message * @return knot vector is / is not valid */ - public boolean do_check_knots(Knotvector knots, String msg) { + public boolean do_check_knots(final Knotvector knots, final String msg) { // DONE - int status = knots.validate(); + final int status = knots.validate(); if (status > 0) { do_nurbserror(status); if (renderhints.errorchecking != NurbsConsts.N_NOMSG) @@ -611,7 +611,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbscurve * NURBS curve object */ - public void do_nurbscurve(O_nurbscurve o_nurbscurve) { + public void do_nurbscurve(final O_nurbscurve o_nurbscurve) { // DONE if (inCurve <= 0) { @@ -664,7 +664,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbssurface * NURBS surface object */ - public void do_nurbssurface(O_nurbssurface o_nurbssurface) { + public void do_nurbssurface(final O_nurbssurface o_nurbssurface) { // DONE if (inSurface <= 0) { bgnsurface(); @@ -712,7 +712,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param ncoords * number of control point coordinates */ - public void defineMap(int type, int rational, int ncoords) { + public void defineMap(final int type, final int rational, final int ncoords) { // DONE maplist.define(type, rational, ncoords); } @@ -727,9 +727,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param value * property value */ - public void setnurbsproperty(int type, int tag, float value) { + public void setnurbsproperty(final int type, final int tag, final float value) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); return; @@ -738,7 +738,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { do_nurbserror(26); return; } - Property prop = new Property(type, tag, value); + final Property prop = new Property(type, tag, value); thread("do_setnurbsproperty2", prop); } @@ -748,8 +748,8 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property */ - public void do_setnurbsproperty2(Property prop) { - Mapdesc mapdesc = maplist.find(prop.type); + public void do_setnurbsproperty2(final Property prop) { + final Mapdesc mapdesc = maplist.find(prop.type); mapdesc.setProperty(prop.tag, prop.value); } @@ -759,7 +759,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property to be set */ - public void do_setnurbsproperty(Property prop) { + public void do_setnurbsproperty(final Property prop) { // DONE renderhints.setProperty(prop); // TODO freeproperty? @@ -771,7 +771,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * domain distance sampling flag */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE subdivider.set_is_domain_distance_sampling(i); } @@ -781,7 +781,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgnsurface() { // DONE - O_surface o_surface = new O_surface(); + final O_surface o_surface = new O_surface(); // TODO nuid // System.out.println("TODO glunurbs.bgnsurface nuid"); thread("do_bgnsurface", o_surface); @@ -827,11 +827,11 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param type * NURBS surface type (rational,...) */ - public void nurbssurface(int sknot_count, float[] sknot, int tknot_count, - float[] tknot, int s_stride, int t_stride, float[] ctlarray, - int sorder, int torder, int type) { + public void nurbssurface(final int sknot_count, final float[] sknot, final int tknot_count, + final float[] tknot, final int s_stride, final int t_stride, final float[] ctlarray, + final int sorder, final int torder, final int type) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -842,19 +842,19 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, + final Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, sknot); if (!do_check_knots(sknotvector, "surface")) return; - Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, + final Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, tknot); if (!do_check_knots(tknotvector, "surface")) return; - O_nurbssurface o_nurbssurface = new O_nurbssurface(type); + final O_nurbssurface o_nurbssurface = new O_nurbssurface(type); o_nurbssurface.bezier_patches = new Quilt(mapdesc); - CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); o_nurbssurface.bezier_patches.toBezier(sknotvector, tknotvector, ctrlarr, mapdesc.getNCoords()); thread("do_nurbssurface", o_nurbssurface); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java index 81a99beab..337d93b80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java @@ -46,9 +46,15 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; + import jogamp.opengl.Debug; + import com.jogamp.common.nio.Buffers; + import java.nio.*; import java.io.*; @@ -65,9 +71,9 @@ public class BuildMipmap { public BuildMipmap() { } - public static int gluBuild1DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int widthPowerOf2, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { + public static int gluBuild1DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int widthPowerOf2, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { int newwidth; int level, levels; ShortBuffer newImage = null; @@ -75,9 +81,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer imageTemp = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 ); @@ -90,40 +96,40 @@ public class BuildMipmap { Mipmap.retrieveStoreModes( gl, psm ); try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format, - GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes was set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = userLevel; level <= levels; level++ ) { if( newImage_width == newwidth ) { // user newimage for this level if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, format, - GL2.GL_UNSIGNED_SHORT, newImage ); + GL.GL_UNSIGNED_SHORT, newImage ); } } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth, 1, format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth, 1, format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -136,26 +142,26 @@ public class BuildMipmap { newImage_width = newwidth; if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, - format, GL2.GL_UNSIGNED_SHORT, newImage ); + format, GL.GL_UNSIGNED_SHORT, newImage ); } } if( newwidth > 1 ) { newwidth /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, ByteBuffer data ) { - int newwidth[] = new int[1]; - int newheight[] = new int[1]; + public static int bitmapBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int newwidth[] = new int[1]; + final int newheight[] = new int[1]; int level, levels; ShortBuffer newImage = null; int newImage_width; @@ -163,9 +169,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer tempImage = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); Mipmap.retrieveStoreModes( gl, psm ); @@ -179,8 +185,8 @@ public class BuildMipmap { try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height, - format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -189,30 +195,30 @@ public class BuildMipmap { Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes is set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level < levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + newImage_height, 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -227,7 +233,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } if( newheight[0] > 1 ) { newwidth[0] /= 2; @@ -236,38 +242,38 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int widthPowerOf2, int heightPowerOf2, - int format, int type, int userLevel, int baseLevel, int maxLevel, - ByteBuffer data ) { // PointerWrapper data + public static int gluBuild2DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int widthPowerOf2, final int heightPowerOf2, + final int format, final int type, final int userLevel, final int baseLevel, final int maxLevel, + final ByteBuffer data ) { // PointerWrapper data int newwidth; int newheight; int level, levels; - int usersImage; + final int usersImage; ByteBuffer srcImage = null; ByteBuffer dstImage = null; ByteBuffer tempImage = null; - int newImage_width; - int newImage_height; - short[] SWAP_IMAGE = null; + final int newImage_width; + final int newImage_height; + final short[] SWAP_IMAGE = null; int memReq; - int maxsize; + final int maxsize; int cmpts; int mark=-1; boolean myswap_bytes; int groups_per_line, element_size, group_size; int rowsize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 ); @@ -310,9 +316,9 @@ public class BuildMipmap { mark = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; data.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); level = userLevel; @@ -324,11 +330,11 @@ public class BuildMipmap { gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } int nextWidth = newwidth / 2; @@ -345,97 +351,97 @@ public class BuildMipmap { try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, width, height, data, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -462,36 +468,36 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } // level userLevel+1 is in srcImage; level userLevel already saved @@ -500,113 +506,113 @@ public class BuildMipmap { memReq = Mipmap.image_size( newwidth, newheight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } data.position( mark ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): ScaleInternal.scale_internal_uint( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): ScaleInternal.scale_internal_int( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): ScaleInternal.scale_internal_float( cmpts, width, height, data, newwidth, newheight, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract332(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract233rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract5551(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1555rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1010102(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract2101010rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; @@ -634,36 +640,36 @@ public class BuildMipmap { memReq = Mipmap.image_size( nextWidth, nextHeight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -671,7 +677,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { srcImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); @@ -691,63 +697,63 @@ public class BuildMipmap { srcImage.rewind(); dstImage.rewind(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, newwidth, newheight, srcImage, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -768,7 +774,7 @@ public class BuildMipmap { newheight /= 2; } // compute amount to pad per row if any - int rowPad = rowsize % psm.getUnpackAlignment(); + final int rowPad = rowsize % psm.getUnpackAlignment(); // should row be padded if( rowPad == 0 ) { @@ -788,21 +794,21 @@ public class BuildMipmap { } } else { // compute length of new row in bytes, including padding - int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; + final int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; int ii, jj; - int dstTrav; - int srcTrav; + final int dstTrav; + final int srcTrav; // allocate new image for mipmap of size newRowLength x newheight ByteBuffer newMipmapImage = null; try { newMipmapImage = ByteBuffer.allocateDirect( newRowLength * newheight ); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } srcImage.rewind(); @@ -828,19 +834,19 @@ public class BuildMipmap { } } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, - int components, int width, int height, int format, int type, ByteBuffer data ) { - int[] newwidth = new int[1]; - int[] newheight = new int[1]; + public static int fastBuild2DMipmaps( final GL gl, final PixelStorageModes psm, final int target, + final int components, final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int[] newwidth = new int[1]; + final int[] newheight = new int[1]; int level, levels; ByteBuffer newImage; int newImage_width; @@ -848,7 +854,7 @@ public class BuildMipmap { ByteBuffer otherImage; ByteBuffer imageTemp; int memReq; - int maxsize; + final int maxsize; int cmpts; Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, @@ -876,12 +882,12 @@ public class BuildMipmap { int elements_per_line; int start; int iter; - int iter2; + final int iter2; int i, j; try { - newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL2.GL_UNSIGNED_BYTE ) ); - } catch( OutOfMemoryError err ) { + newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL.GL_UNSIGNED_BYTE ) ); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -907,29 +913,29 @@ public class BuildMipmap { } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 1 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level <= levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { // use newImage for this level newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_BYTE ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_BYTE ); try { otherImage = Buffers.newDirectByteBuffer( memReq ); - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -942,7 +948,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } if( newwidth[0] > 1 ) { newwidth[0] /= 2; @@ -951,30 +957,30 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( 0 ); } - public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, - int depthPowerOf2, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { + public static int gluBuild3DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int widthPowerOf2, final int heightPowerOf2, + final int depthPowerOf2, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { int newWidth; int newHeight; int newDepth; int level, levels; ByteBuffer usersImage; ByteBuffer srcImage, dstImage, tempImage; - int newImageWidth; - int newImageHeight; - int newImageDepth; + final int newImageWidth; + final int newImageHeight; + final int newImageDepth; int memReq; - int maxSize; + final int maxSize; int cmpts; int mark=-1; @@ -982,7 +988,7 @@ public class BuildMipmap { int groupsPerLine, elementSize, groupSize; int rowsPerImage, imageSize; int rowSize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 && depth >= 1 ); @@ -1041,11 +1047,11 @@ public class BuildMipmap { psm.getUnpackSkipImages() * imageSize; usersImage.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0 ); level = userLevel; @@ -1056,13 +1062,13 @@ public class BuildMipmap { 0, format, type, usersImage ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } int nextWidth = newWidth / 2; @@ -1082,44 +1088,44 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, @@ -1129,7 +1135,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1139,7 +1145,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1149,7 +1155,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1159,7 +1165,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1169,7 +1175,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1179,7 +1185,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1189,53 +1195,53 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1268,38 +1274,38 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1309,38 +1315,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1371,38 +1377,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -1410,7 +1416,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { usersImage.position( mark ); gl.getGL2().glTexImage3D( target, level, internalFormat, width, height, depth, @@ -1419,7 +1425,7 @@ public class BuildMipmap { level++; for( ; level <= levels; level++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1429,7 +1435,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1439,7 +1445,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1449,7 +1455,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1459,7 +1465,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1469,7 +1475,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1479,7 +1485,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1489,51 +1495,51 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1563,22 +1569,22 @@ public class BuildMipmap { 0, format, type, usersImage ); } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } private static final int TARGA_HEADER_SIZE = 18; - private static void writeTargaFile(String filename, ByteBuffer data, - int width, int height) { + private static void writeTargaFile(final String filename, final ByteBuffer data, + final int width, final int height) { try { - FileOutputStream fos = new FileOutputStream(new File(filename)); - ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); + final FileOutputStream fos = new FileOutputStream(new File(filename)); + final ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); header.put(0, (byte) 0).put(1, (byte) 0); header.put(2, (byte) 2); // uncompressed type header.put(12, (byte) (width & 0xFF)); // width @@ -1590,7 +1596,7 @@ public class BuildMipmap { fos.write(data.array()); data.clear(); fos.close(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java index 0c155ff96..fe9c15e60 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java @@ -57,7 +57,7 @@ public class Extract1010102 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1010102 implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; + extractComponents[0] = ( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0x00000003 ) ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java index 5208ea537..d619502be 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java @@ -57,7 +57,7 @@ public class Extract1555rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1555rev implements Extract { // 01111100,00000000 == 0x7C00 // 10000000,00000000 == 0x8000 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x003E ) >> 5 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x7C00 ) >> 10) / 31.0f; + extractComponents[3] = ( ushort & 0x8000 ) >> 15; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00011111 == 0x001F // 00000011,11100000 == 0x03E0 // 01111100,00000000 == 0x7C00 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java index 1bf8abcc3..9d00badcb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java @@ -57,7 +57,7 @@ public class Extract2101010rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract2101010rev implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; + extractComponents[0] = ( ( uint & 0x000003FF ) ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java index c86b39e63..3bc797518 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java @@ -57,18 +57,18 @@ public class Extract233rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0x07) ) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; - extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0x07) ) / 7.0f; + extractComponents[1] = ((ubyte & 0x38) >> 3) / 7.0f; + extractComponents[2] = ((ubyte & 0xC0) >> 6) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java index 706f0c3f2..93983f1d7 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java @@ -57,18 +57,18 @@ public class Extract332 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0xe0) >> 5) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; - extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0xe0) >> 5) / 7.0f; + extractComponents[1] = ((ubyte & 0x1c) >> 2) / 7.0f; + extractComponents[2] = ((ubyte & 0x03)) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java index 182d66ce2..323ca7f1a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java @@ -57,7 +57,7 @@ public class Extract4444 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444 implements Extract { // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[0] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0x000F ) ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java index 52ecdc17c..267286519 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java @@ -57,7 +57,7 @@ public class Extract4444rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444rev implements Extract { // 00001111,00000000 == 0x0F00 // 11110000,00000000 == 0xF000 - extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[0] = ( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java index 21f53aa1d..ee33ca7c1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java @@ -57,7 +57,7 @@ public class Extract5551 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract5551 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) ); + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) ); } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java index 7408c45b2..d63943a2e 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java @@ -57,7 +57,7 @@ public class Extract565 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565 implements Extract { // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0x001F ) ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11111000,00000000 == 0xF800 // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java index adaafa7ea..cfea71487 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java @@ -57,7 +57,7 @@ public class Extract565rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565rev implements Extract { // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00111111 == 0x001F // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java index be155d578..f6fe92c82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java @@ -57,7 +57,7 @@ public class Extract8888 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[0] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[1] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[3] = ( ( uint & 0x000000FF ) ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java index 294e60e12..942f6d88a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java @@ -57,7 +57,7 @@ public class Extract8888rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888rev implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[0] = ( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[1] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[3] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java index 1dd8bff8a..09d70e492 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java @@ -57,7 +57,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer data ) { + public double extract( final boolean isSwap, final ByteBuffer data ) { float f = 0; if( isSwap ) { f = Mipmap.GLU_SWAP_4_BYTES( data.getInt() ); @@ -69,7 +69,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 1.0); data.asFloatBuffer().put( index, (float)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java index dcbe52a40..e9b021413 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java @@ -57,14 +57,14 @@ public class ExtractSByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer sbyte ) { - byte b = sbyte.get(); + public double extract( final boolean isSwap, final ByteBuffer sbyte ) { + final byte b = sbyte.get(); assert( b <= 127 ); return( b ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { data.position( index ); data.put( (byte)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java index 547bd944a..9532fdade 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java @@ -57,7 +57,7 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { int i = 0; if( isSwap ) { i = Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < Integer.MAX_VALUE); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java index 7dc172976..6e14f89c0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java @@ -57,7 +57,7 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { short s = 0; if( isSwap ) { s = Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 32768.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java index 3e933811c..d9db0019b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java @@ -57,14 +57,14 @@ public class ExtractUByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ubyte ) { - int i = 0x000000FF & ubyte.get(); + public double extract( final boolean isSwap, final ByteBuffer ubyte ) { + final int i = 0x000000FF & ubyte.get(); assert( i <= 255 ); return( i ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 256.0); data.position( index ); data.put( (byte)value ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java index 1c34828b3..3e4ad41c2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java @@ -57,7 +57,7 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { long i = 0; if( isSwap ) { i = 0xFFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 0xFFFFFFFF); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java index 8e0d25c42..b121c1054 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java @@ -57,7 +57,7 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { int i = 0; if( isSwap ) { i = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 65536.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 184c5fda8..100c6ba1f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -57,8 +57,8 @@ public class HalveImage { private static final int BOX4 = 4; private static final int BOX8 = 8; - public static void halveImage( int components, int width, int height, - ShortBuffer datain, ShortBuffer dataout ) { + public static void halveImage( final int components, final int width, final int height, + final ShortBuffer datain, final ShortBuffer dataout ) { int i, j, k; int newwidth, newheight; int delta; @@ -92,9 +92,9 @@ public class HalveImage { } } - public static void halveImage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halveImage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; int s; @@ -134,9 +134,9 @@ public class HalveImage { } } - public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -170,10 +170,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -203,12 +203,12 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, int element_size, - int ysize, int group_size ) { + public static void halveImage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, final int element_size, + final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; byte temp = (byte)0; @@ -245,9 +245,9 @@ public class HalveImage { } } - public static void halve1Dimage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = width / 2; int src = 0; @@ -276,10 +276,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assert only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -304,12 +304,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; // handle case where there is only 1 column/row @@ -365,9 +366,9 @@ public class HalveImage { } } - public static void halve1Dimage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -384,7 +385,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -402,10 +403,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -414,7 +415,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -438,12 +439,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; short temp = (short)0; // handle case where there is only 1 column/row @@ -472,7 +474,7 @@ public class HalveImage { temp += datain.getShort(); temp += 2; temp /= 4; - dataout.put( (short)temp ); + dataout.put( temp ); t += element_size; } t += group_size; @@ -483,8 +485,8 @@ public class HalveImage { for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { for( k = 0; k < components; k++ ) { - short b; - int buf; + final short b; + final int buf; datain.position( t ); temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); datain.position( t + group_size ); @@ -505,9 +507,9 @@ public class HalveImage { } } - public static void halve1Dimage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -524,7 +526,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -542,10 +544,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -554,7 +556,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -578,12 +580,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; double temp = 0; @@ -644,9 +647,9 @@ public class HalveImage { } } - public static void halve1Dimage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -663,7 +666,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -681,10 +684,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -693,7 +696,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -717,12 +720,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; @@ -786,9 +790,9 @@ public class HalveImage { } } - public static void halve1Dimage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -805,7 +809,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -823,10 +827,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -835,7 +839,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -859,12 +863,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; float temp = 0.0f; // handle case where there is only 1 column/row @@ -921,9 +926,9 @@ public class HalveImage { } } - public static void halve1Dimage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -940,7 +945,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -958,10 +963,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -970,7 +975,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -994,9 +999,9 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); halve1DimagePackedPixel( components, extract, width, height, datain, dataout, @@ -1005,16 +1010,16 @@ public class HalveImage { } int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; datain.position( src ); @@ -1046,9 +1051,9 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight ); } - public static void halve1DimagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halve1DimagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -1066,8 +1071,8 @@ public class HalveImage { // one horizontal row with possible pad bytes for( jj = 0; jj < halfWidth; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; datain.position( src ); @@ -1088,7 +1093,7 @@ public class HalveImage { // skip over to next group of 2 src += pixelSizeInBytes + pixelSizeInBytes; } - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); src += padBytes; assert( src == rowSizeInBytes ); @@ -1102,8 +1107,8 @@ public class HalveImage { // average two at a time for( jj = 0; jj < halfHeight; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; // average two at a time, instead of four datain.position( src ); @@ -1129,16 +1134,16 @@ public class HalveImage { } } - public static void halveImagePackedPixelSlice( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixelSlice( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1148,8 +1153,8 @@ public class HalveImage { assert( depth >= 2 ); for( ii = 0; ii < halfDepth; ii++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX2][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX2][4]; int cc; dataIn.position( src ); @@ -1178,8 +1183,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1199,7 +1204,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1212,8 +1217,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1233,7 +1238,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1244,16 +1249,16 @@ public class HalveImage { } } - public static void halveImageSlice( int components, ExtractPrimitive extract, int width, - int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImageSlice( final int components, final ExtractPrimitive extract, final int width, + final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1265,8 +1270,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { int cc; for( cc = 0; cc < components; cc++ ) { - double[] totals = new double[4]; - double[][] extractTotals = new double[BOX2][4]; + final double[] totals = new double[4]; + final double[][] extractTotals = new double[BOX2][4]; int kk; dataIn.position( src ); @@ -1281,7 +1286,7 @@ public class HalveImage { for( kk = 0; kk < BOX2; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX2; + totals[cc] /= BOX2; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1301,8 +1306,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1321,7 +1326,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1343,8 +1348,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1364,7 +1369,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1381,10 +1386,10 @@ public class HalveImage { } } - public static void halveImage3D( int components, ExtractPrimitive extract, - int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImage3D( final int components, final ExtractPrimitive extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { assert( depth > 1 ); // horizontal/vertical/onecolumn slice viewed from top @@ -1399,11 +1404,11 @@ public class HalveImage { int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { @@ -1412,8 +1417,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX8][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX8][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1437,7 +1442,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX8; + totals[cc] /= BOX8; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1457,10 +1462,10 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight * halfDepth * components ); } - public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel3D( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { if( depth == 1 ) { assert( 1 <= width && 1 <= height ); @@ -1476,18 +1481,18 @@ public class HalveImage { } int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; // 4 is max components - float extractTotals[][] = new float[BOX8][4]; + final float totals[] = new float[4]; // 4 is max components + final float extractTotals[][] = new float[BOX8][4]; int cc; dataIn.position( src ); @@ -1514,7 +1519,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (float)BOX8; + totals[cc] /= BOX8; } extract.shove( totals, outIndex, dataOut ); outIndex++; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java index 18f814dde..ef77f3555 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java @@ -46,6 +46,9 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; + import java.nio.*; /** @@ -58,14 +61,14 @@ public class Image { public Image() { } - public static short getShortFromByteArray( byte[] array, int index ) { + public static short getShortFromByteArray( final byte[] array, final int index ) { short s; s = (short)(array[index] << 8 ); s |= (short)(0x00FF & array[index+1]); return( s ); } - public static int getIntFromByteArray( byte[] array, int index ) { + public static int getIntFromByteArray( final byte[] array, final int index ) { int i; i = ( array[index] << 24 ) & 0xFF000000; i |= ( array[index+1] << 16 ) & 0x00FF0000; @@ -74,8 +77,8 @@ public class Image { return( i ); } - public static float getFloatFromByteArray( byte[] array, int index ) { - int i = getIntFromByteArray( array, index ); + public static float getFloatFromByteArray( final byte[] array, final int index ) { + final int i = getIntFromByteArray( array, index ); return( Float.intBitsToFloat(i) ); } @@ -83,9 +86,9 @@ public class Image { * Extract array from user's data applying all pixel store modes. * The internal format used is an array of unsigned shorts. */ - public static void fill_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, ByteBuffer userdata, - ShortBuffer newimage ) { + public static void fill_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, final ByteBuffer userdata, + final ShortBuffer newimage ) { int components; int element_size; int rowsize; @@ -102,40 +105,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -214,74 +217,74 @@ public class Image { iter = start; userdata.position( iter ); //*************************************** for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); - float[] extractComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] extractComponents = new float[4]; userdata.position( iter ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { newimage.put( iter2++, (short)( 0x000000FF & userdata.get() ) );//userdata[iter]; } else { newimage.put( iter2++, (short)( 0x000000FF & userdata.get()/*userdata[iter]*/ * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { newimage.put( iter2++, userdata.get() ); //userdata[iter]; } else { newimage.put( iter2++, (short)(userdata.get()/*userdata[iter]*/ * 516 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract.extract( myswap_bytes, userdata/*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswap_bytes ) { widget.setUB1( userdata.get() ); widget.setUB0( userdata.get() ); @@ -289,7 +292,7 @@ public class Image { widget.setUB0( userdata.get() ); widget.setUB1( userdata.get() ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( index_format ) { newimage.put( iter2++, widget.getS0() ); } else { @@ -299,33 +302,33 @@ public class Image { newimage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswap_bytes ) { widget.setUB3( userdata.get() ); widget.setUB2( userdata.get() ); @@ -337,13 +340,13 @@ public class Image { widget.setUB2( userdata.get() ); widget.setUB3( userdata.get() ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( index_format ) { newimage.put( iter2++, (short)widget.getF() ); } else { newimage.put( iter2++, (short)(widget.getF() * 65535 ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { newimage.put( iter2++, (short)( widget.getUI() ) ); } else { @@ -380,9 +383,9 @@ public class Image { * Theinternal format is an array of unsigned shorts. * empty_image() because it is the opposet of fill_image(). */ - public static void empty_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, - ShortBuffer oldimage, ByteBuffer userdata ) { + public static void empty_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, + final ShortBuffer oldimage, final ByteBuffer userdata ) { int components; int element_size; @@ -400,40 +403,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -499,7 +502,7 @@ public class Image { start += rowsize; } } else { - float shoveComponents[] = new float[4]; + final float shoveComponents[] = new float[4]; element_size = Mipmap.bytes_per_element( type ); group_size = element_size * components; @@ -519,22 +522,22 @@ public class Image { for( i = 0; i < height; i++ ) { iter = start; for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); + final Type_Widget widget = new Type_Widget(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -543,7 +546,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -552,7 +555,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -569,7 +572,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -586,7 +589,7 @@ public class Image { userdata.put( iter, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -603,7 +606,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -620,7 +623,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -637,7 +640,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -654,9 +657,9 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( index_format ) { widget.setS0( oldimage.get( iter2++ ) ); } else { @@ -677,7 +680,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -695,7 +698,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -713,7 +716,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -731,7 +734,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -749,16 +752,16 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( index_format ) { widget.setF( oldimage.get( iter2++ ) ); } else { widget.setF( oldimage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { widget.setUI( oldimage.get( iter2++ ) ); } else { @@ -800,9 +803,9 @@ public class Image { } } - public static void fillImage3D( PixelStorageModes psm, int width, int height, - int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, - ShortBuffer newImage ) { + public static void fillImage3D( final PixelStorageModes psm, final int width, final int height, + final int depth, final int format, final int type, final boolean indexFormat, final ByteBuffer userImage, + final ShortBuffer newImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -817,46 +820,46 @@ public class Image { int iter = 0; int iter2 = 0; int ww, hh, dd, k; - Type_Widget widget = new Type_Widget(); - float extractComponents[] = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float extractComponents[] = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -903,78 +906,78 @@ public class Image { for( ww = 0; ww < elementsPerLine; ww++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { newImage.put( iter2++, (short)(0x000000FF & userImage.get( iter ) ) ); } else { newImage.put( iter2++, (short)((0x000000FF & userImage.get( iter ) ) * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { newImage.put( iter2++, userImage.get( iter ) ); } else { newImage.put( iter2++, (short)(userImage.get( iter ) * 516 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 1 ) ); widget.setUB1( userImage.get( iter ) ); @@ -982,7 +985,7 @@ public class Image { widget.setUB0( userImage.get( iter ) ); widget.setUB1( userImage.get( iter + 1 ) ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( indexFormat ) { newImage.put( iter2++, widget.getUS0() ); } else { @@ -992,36 +995,36 @@ public class Image { newImage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 3 ) ); widget.setUB1( userImage.get( iter + 2 ) ); @@ -1033,13 +1036,13 @@ public class Image { widget.setUB2( userImage.get( iter + 2 ) ); widget.setUB3( userImage.get( iter + 3 ) ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getF() ); } else { newImage.put( iter2++, (short)( widget.getF() * 65535.0f ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getUI() ); } else { @@ -1075,8 +1078,8 @@ public class Image { psm.getUnpackSkipImages() * imageSize ); } - public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, - int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { + public static void emptyImage3D( final PixelStorageModes psm, final int width, final int height, final int depth, + final int format, final int type, final boolean indexFormat, final ShortBuffer oldImage, final ByteBuffer userImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -1090,46 +1093,46 @@ public class Image { int ii, jj, dd, k; int rowsPerImage; int imageSize; - Type_Widget widget = new Type_Widget(); - float[] shoveComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] shoveComponents = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -1182,33 +1185,33 @@ public class Image { for( jj = 0; jj < elementsPerLine; jj++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get( iter2++ ) ) ); } else { userImage.put( iter, (byte)(oldImage.get( iter2++ ) >> 8 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get(iter2++) ) ); } else { userImage.put( iter, (byte)(oldImage.get(iter2++) >> 9) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1220,7 +1223,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1232,7 +1235,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1244,7 +1247,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1256,7 +1259,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1268,7 +1271,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1280,16 +1283,16 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( indexFormat ) { - widget.setS0( (short)oldImage.get( iter2++ ) ); + widget.setS0( oldImage.get( iter2++ ) ); } else { widget.setS0( (short)(oldImage.get( iter2++ ) >> 1) ); } } else { - widget.setUS0( (short)oldImage.get( iter2++ ) ); + widget.setUS0( oldImage.get( iter2++ ) ); } if( myswapBytes ) { userImage.put( iter, widget.getUB1() ); @@ -1299,7 +1302,7 @@ public class Image { userImage.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1313,7 +1316,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1327,7 +1330,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1341,7 +1344,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1355,16 +1358,16 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( indexFormat ) { widget.setF( oldImage.get( iter2++ ) ); } else { widget.setF( oldImage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { widget.setUI( oldImage.get( iter2++ ) ); } else { diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index 938873ec5..fba6a231a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -46,10 +46,14 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.GLException; + import java.nio.*; + import com.jogamp.common.nio.Buffers; /** @@ -108,7 +112,7 @@ public class Mipmap { return( s ); } - public static int GLU_SWAP_4_BYTES( int i ) { + public static int GLU_SWAP_4_BYTES( final int i ) { int t = i << 24; t |= 0x00FF0000 & ( i << 8 ); t |= 0x0000FF00 & ( i >>> 8 ); @@ -116,17 +120,17 @@ public class Mipmap { return( t ); } - public static float GLU_SWAP_4_BYTES( float f ) { - int i = Float.floatToRawIntBits( f ); - float temp = Float.intBitsToFloat( i ); + public static float GLU_SWAP_4_BYTES( final float f ) { + final int i = Float.floatToRawIntBits( f ); + final float temp = Float.intBitsToFloat( i ); return( temp ); } - public static int checkMipmapArgs( int internalFormat, int format, int type ) { + public static int checkMipmapArgs( final int internalFormat, final int format, final int type ) { if( !legalFormat( format ) || !legalType( type ) ) { return( GLU.GLU_INVALID_ENUM ); } - if( format == GL2GL3.GL_STENCIL_INDEX ) { + if( format == GL2ES2.GL_STENCIL_INDEX ) { return( GLU.GLU_INVALID_ENUM ); } if( !isLegalFormatForPackedPixelType( format, type ) ) { @@ -135,19 +139,19 @@ public class Mipmap { return( 0 ); } - public static boolean legalFormat( int format ) { + public static boolean legalFormat( final int format ) { switch( format ) { case( GL2.GL_COLOR_INDEX ): - case( GL2GL3.GL_STENCIL_INDEX ): - case( GL2GL3.GL_DEPTH_COMPONENT ): - case( GL2GL3.GL_RED ): - case( GL2GL3.GL_GREEN ): - case( GL2GL3.GL_BLUE ): - case( GL2GL3.GL_ALPHA ): - case( GL2GL3.GL_RGB ): - case( GL2GL3.GL_RGBA ): - case( GL2GL3.GL_LUMINANCE ): - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL2ES2.GL_STENCIL_INDEX ): + case( GL2ES2.GL_DEPTH_COMPONENT ): + case( GL2ES2.GL_RED ): + case( GL2ES3.GL_GREEN ): + case( GL2ES3.GL_BLUE ): + case( GL.GL_ALPHA ): + case( GL.GL_RGB ): + case( GL.GL_RGBA ): + case( GL.GL_LUMINANCE ): + case( GL.GL_LUMINANCE_ALPHA ): case( GL2GL3.GL_BGR ): case( GL.GL_BGRA ): return( true ); @@ -156,55 +160,55 @@ public class Mipmap { } } - public static boolean legalType( int type ) { + public static boolean legalType( final int type ) { switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): - case( GL2GL3.GL_FLOAT ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): return( true ); default: return( false ); } } - public static boolean isTypePackedPixel( int type ) { + public static boolean isTypePackedPixel( final int type ) { assert( legalType( type ) ); if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( true ); } return( false ); } - public static boolean isLegalFormatForPackedPixelType( int format, int type ) { + public static boolean isLegalFormatForPackedPixelType( final int format, final int type ) { // if not a packed pixel type then return true if( isTypePackedPixel( type ) ) { return( true ); @@ -212,29 +216,29 @@ public class Mipmap { // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB if( (type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) - & format != GL2GL3.GL_RGB ) { + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) + & format != GL.GL_RGB ) { return( false ); } // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT - if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + if( ( type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) && + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) && (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { return( false ); } return( true ); } - public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, - int totalLevels ) { + public static boolean isLegalLevels( final int userLevel, final int baseLevel, final int maxLevel, + final int totalLevels ) { if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || (totalLevels < maxLevel) ) { return( false ); @@ -249,13 +253,13 @@ public class Mipmap { * advertise the texture extension. * Note that proxy textures are implemented but not according to spec in IMPACT* */ - public static void closestFit( GL gl, int target, int width, int height, int internalFormat, - int format, int type, int[] newWidth, int[] newHeight ) { + public static void closestFit( final GL gl, final int target, final int width, final int height, final int internalFormat, + final int format, final int type, final int[] newWidth, final int[] newHeight ) { // Use proxy textures if OpenGL version >= 1.1 if( Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) ) >= 1.1 ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; boolean noProxyTextures = false; // Some drivers (in particular, ATI's) seem to set a GL error @@ -265,24 +269,24 @@ public class Mipmap { try { do { // compute level 1 width & height, clamping each at 1 - int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); - int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); + final int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); + final int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); int proxyTarget; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); // does width x height at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { + if( target == GL.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_2D; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); - } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { + } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); @@ -313,7 +317,7 @@ public class Mipmap { } // else it does fit } while( proxyWidth[0] == 0 ); - } catch (GLException e) { + } catch (final GLException e) { noProxyTextures = true; } // loop must terminate @@ -324,8 +328,8 @@ public class Mipmap { return; } } - int[] maxsize = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_MAX_TEXTURE_SIZE, maxsize , 0); + final int[] maxsize = new int[1]; + gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize , 0); // clamp user's texture sizes to maximum sizes, if necessary newWidth[0] = nearestPower( width ); if( newWidth[0] > maxsize[0] ) { @@ -337,26 +341,26 @@ public class Mipmap { } } - public static void closestFit3D( GL gl, int target, int width, int height, int depth, - int internalFormat, int format, int type, int[] newWidth, int[] newHeight, - int[] newDepth ) { + public static void closestFit3D( final GL gl, final int target, final int width, final int height, final int depth, + final int internalFormat, final int format, final int type, final int[] newWidth, final int[] newHeight, + final int[] newDepth ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); int depthPowerOf2 = nearestPower( depth ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; do { // compute level 1 width & height & depth, clamping each at 1 - int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; - int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; - int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; + final int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; + final int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; + final int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; int proxyTarget = 0; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); assert( depthAtLevelOne > 0 ); // does width x height x depth at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { + if( target == GL2ES2.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D; gl.getGL2GL3().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, depthAtLevelOne, 0, format, type, null ); @@ -385,31 +389,31 @@ public class Mipmap { newDepth[0] = depthPowerOf2; } - public static int elements_per_group( int format, int type ) { + public static int elements_per_group( final int format, final int type ) { // Return the number of elements per grtoup of a specified gromat // If the type is packedpixels then answer is 1 if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( 1 ); } // Types are not packed pixels so get elements per group switch( format ) { - case( GL2GL3.GL_RGB ): + case( GL.GL_RGB ): case( GL2GL3.GL_BGR ): return( 3 ); - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL.GL_LUMINANCE_ALPHA ): return( 2 ); case( GL.GL_RGBA ): case( GL.GL_BGRA ): @@ -419,45 +423,45 @@ public class Mipmap { } } - public static int bytes_per_element( int type ) { + public static int bytes_per_element( final int type ) { // return the number of bytes per element, based on the element type switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): return( 1 ); - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): return( 2 ); - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): - case( GL2GL3.GL_FLOAT ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_FLOAT ): return( 4 ); default: return( 4 ); } } - public static boolean is_index( int format ) { - return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX ); + public static boolean is_index( final int format ) { + return( format == GL2.GL_COLOR_INDEX || format == GL2ES2.GL_STENCIL_INDEX ); } /* Compute memory required for internal packed array of data of given type and format. */ - public static int image_size( int width, int height, int format, int type ) { + public static int image_size( final int width, final int height, final int format, final int type ) { int bytes_per_row; int components; @@ -472,9 +476,9 @@ public class Mipmap { return( bytes_per_row * height * components ); } - public static int imageSize3D( int width, int height, int depth, int format, int type ) { - int components = elements_per_group( format, type ); - int bytes_per_row = bytes_per_element( type ) * width; + public static int imageSize3D( final int width, final int height, final int depth, final int format, final int type ) { + final int components = elements_per_group( format, type ); + final int bytes_per_row = bytes_per_element( type ) * width; assert( width > 0 && height > 0 && depth > 0 ); assert( type != GL2.GL_BITMAP ); @@ -482,28 +486,28 @@ public class Mipmap { return( bytes_per_row * height * depth * components ); } - public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -511,32 +515,32 @@ public class Mipmap { psm.setPackSwapBytes( ( a[0] == 1 ) ); } - public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes3D( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_IMAGES, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_SKIP_IMAGES, a, 0); psm.setUnpackSkipImages( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, a, 0); psm.setUnpackImageHeight( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0 ); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0 ); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0 ); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -548,17 +552,17 @@ public class Mipmap { psm.setPackImageHeight( a[0] ); } - public static int gluScaleImage( GL gl, int format, int widthin, int heightin, - int typein, ByteBuffer datain, int widthout, int heightout, - int typeout, ByteBuffer dataout ) { - int datainPos = datain.position(); - int dataoutPos = dataout.position(); + public static int gluScaleImage( final GL gl, final int format, final int widthin, final int heightin, + final int typein, final ByteBuffer datain, final int widthout, final int heightout, + final int typeout, final ByteBuffer dataout ) { + final int datainPos = datain.position(); + final int dataoutPos = dataout.position(); try { int components; ByteBuffer beforeimage; ByteBuffer afterimage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { return( 0 ); @@ -575,8 +579,8 @@ public class Mipmap { if( !isLegalFormatForPackedPixelType( format, typeout ) ) { return( GLU.GLU_INVALID_OPERATION ); } - beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL2GL3.GL_UNSIGNED_SHORT ) ); - afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL2GL3.GL_UNSIGNED_SHORT ) ); + beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL.GL_UNSIGNED_SHORT ) ); + afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL.GL_UNSIGNED_SHORT ) ); if( beforeimage == null || afterimage == null ) { return( GLU.GLU_OUT_OF_MEMORY ); } @@ -594,15 +598,15 @@ public class Mipmap { } } - public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, - int width, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -625,16 +629,16 @@ public class Mipmap { } } - public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, - int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmaps( final GL gl, final int target, final int internalFormat, final int width, + final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; int levels; - int[] dummy = new int[1]; + final int[] dummy = new int[1]; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -654,14 +658,14 @@ public class Mipmap { } - public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int format, int type, int userLevel, - int baseLevel, int maxLevel, Object data ) { + public static int gluBuild2DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final Object data ) { int dataPos = 0; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -687,23 +691,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -717,15 +721,15 @@ public class Mipmap { } - public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, Object data ) { + public static int gluBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final Object data ) { int dataPos = 0; - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -749,23 +753,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -779,17 +783,17 @@ public class Mipmap { } - public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; - int[] depthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; + final int[] depthPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -823,14 +827,14 @@ public class Mipmap { } } - public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java index 7eb98db35..9b26647a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java @@ -147,7 +147,7 @@ public class PixelStorageModes { * Setter for property packAlignment. * @param packAlignment New value of property packAlignment. */ - public void setPackAlignment(int packAlignment) { + public void setPackAlignment(final int packAlignment) { this.packAlignment = packAlignment; } @@ -165,7 +165,7 @@ public class PixelStorageModes { * Setter for property packRowLength. * @param packRowLength New value of property packRowLength. */ - public void setPackRowLength(int packRowLength) { + public void setPackRowLength(final int packRowLength) { this.packRowLength = packRowLength; } @@ -183,7 +183,7 @@ public class PixelStorageModes { * Setter for property packSkipRows. * @param packSkipRows New value of property packSkipRows. */ - public void setPackSkipRows(int packSkipRows) { + public void setPackSkipRows(final int packSkipRows) { this.packSkipRows = packSkipRows; } @@ -201,7 +201,7 @@ public class PixelStorageModes { * Setter for property packSkipPixels. * @param packSkipPixels New value of property packSkipPixels. */ - public void setPackSkipPixels(int packSkipPixels) { + public void setPackSkipPixels(final int packSkipPixels) { this.packSkipPixels = packSkipPixels; } @@ -219,7 +219,7 @@ public class PixelStorageModes { * Setter for property packLsbFirst. * @param packLsbFirst New value of property packLsbFirst. */ - public void setPackLsbFirst(boolean packLsbFirst) { + public void setPackLsbFirst(final boolean packLsbFirst) { this.packLsbFirst = packLsbFirst; } @@ -237,7 +237,7 @@ public class PixelStorageModes { * Setter for property packSwapBytes. * @param packSwapBytes New value of property packSwapBytes. */ - public void setPackSwapBytes(boolean packSwapBytes) { + public void setPackSwapBytes(final boolean packSwapBytes) { this.packSwapBytes = packSwapBytes; } @@ -255,7 +255,7 @@ public class PixelStorageModes { * Setter for property packSkipImages. * @param packSkipImages New value of property packSkipImages. */ - public void setPackSkipImages(int packSkipImages) { + public void setPackSkipImages(final int packSkipImages) { this.packSkipImages = packSkipImages; } @@ -273,7 +273,7 @@ public class PixelStorageModes { * Setter for property packImageHeight. * @param packImageHeight New value of property packImageHeight. */ - public void setPackImageHeight(int packImageHeight) { + public void setPackImageHeight(final int packImageHeight) { this.packImageHeight = packImageHeight; } @@ -291,7 +291,7 @@ public class PixelStorageModes { * Setter for property unpackAlignment. * @param unpackAlignment New value of property unpackAlignment. */ - public void setUnpackAlignment(int unpackAlignment) { + public void setUnpackAlignment(final int unpackAlignment) { this.unpackAlignment = unpackAlignment; } @@ -309,7 +309,7 @@ public class PixelStorageModes { * Setter for property unpackRowLength. * @param unpackRowLength New value of property unpackRowLength. */ - public void setUnpackRowLength(int unpackRowLength) { + public void setUnpackRowLength(final int unpackRowLength) { this.unpackRowLength = unpackRowLength; } @@ -327,7 +327,7 @@ public class PixelStorageModes { * Setter for property unpackSkipRows. * @param unpackSkipRows New value of property unpackSkipRows. */ - public void setUnpackSkipRows(int unpackSkipRows) { + public void setUnpackSkipRows(final int unpackSkipRows) { this.unpackSkipRows = unpackSkipRows; } @@ -345,7 +345,7 @@ public class PixelStorageModes { * Setter for property unpackSkipPixels. * @param unpackSkipPixels New value of property unpackSkipPixels. */ - public void setUnpackSkipPixels(int unpackSkipPixels) { + public void setUnpackSkipPixels(final int unpackSkipPixels) { this.unpackSkipPixels = unpackSkipPixels; } @@ -363,7 +363,7 @@ public class PixelStorageModes { * Setter for property unpackLsbFirst. * @param unpackLsbFirst New value of property unpackLsbFirst. */ - public void setUnpackLsbFirst(boolean unpackLsbFirst) { + public void setUnpackLsbFirst(final boolean unpackLsbFirst) { this.unpackLsbFirst = unpackLsbFirst; } @@ -381,7 +381,7 @@ public class PixelStorageModes { * Setter for property unpackSwapBytes. * @param unpackSwapBytes New value of property unpackSwapBytes. */ - public void setUnpackSwapBytes(boolean unpackSwapBytes) { + public void setUnpackSwapBytes(final boolean unpackSwapBytes) { this.unpackSwapBytes = unpackSwapBytes; } @@ -399,7 +399,7 @@ public class PixelStorageModes { * Setter for property unpackSkipImages. * @param unpackSkipImages New value of property unpackSkipImages. */ - public void setUnpackSkipImages(int unpackSkipImages) { + public void setUnpackSkipImages(final int unpackSkipImages) { this.unpackSkipImages = unpackSkipImages; } @@ -417,7 +417,7 @@ public class PixelStorageModes { * Setter for property unpackImageHeight. * @param unpackImageHeight New value of property unpackImageHeight. */ - public void setUnpackImageHeight(int unpackImageHeight) { + public void setUnpackImageHeight(final int unpackImageHeight) { this.unpackImageHeight = unpackImageHeight; } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index 9aca1fb03..ccb75091c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -56,16 +56,16 @@ import com.jogamp.common.nio.Buffers; */ public class ScaleInternal { - public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); + public static final float UINT_MAX = (0x00000000FFFFFFFF); - public static void scale_internal( int components, int widthin, int heightin, - ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { + public static void scale_internal( final int components, final int widthin, final int heightin, + final ShortBuffer datain, final int widthout, final int heightout, final ShortBuffer dataout ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float xpercent, ypercent; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, yint, xint, xindex, yindex; int temp; @@ -147,14 +147,16 @@ public class ScaleInternal { } } - public static void scale_internal_ubyte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_ubyte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -356,7 +358,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -372,15 +374,17 @@ public class ScaleInternal { } } - public static void scale_internal_byte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, - int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_byte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, + final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -581,7 +585,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -597,15 +601,17 @@ public class ScaleInternal { } } - public static void scale_internal_ushort( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_ushort( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -673,7 +679,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; } @@ -684,7 +690,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; } @@ -869,7 +875,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -885,15 +891,17 @@ public class ScaleInternal { } } - public static void scale_internal_short( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_short( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1173,7 +1181,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1189,15 +1197,17 @@ public class ScaleInternal { } } - public static void scale_internal_uint( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_uint( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1416,9 +1426,9 @@ public class ScaleInternal { percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); temp = xindex + (lowy_int * ysize); for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); + final long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); datain.position( temp_index ); - long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); + final long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); datain.position( temp_index ); if( myswap_bytes ) { totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; @@ -1468,7 +1478,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1484,15 +1494,17 @@ public class ScaleInternal { } } - public static void scale_internal_int( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_int( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1772,7 +1784,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1788,15 +1800,17 @@ public class ScaleInternal { } } - public static void scale_internal_float( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_float( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -2076,7 +2090,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -2092,25 +2106,27 @@ public class ScaleInternal { } } - public static void scaleInternalPackedPixel( int components, Extract extract, - int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, - int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, - int rowSizeInBytes, boolean isSwap ) { - float x, convx; - float y, convy; + public static void scaleInternalPackedPixel( final int components, final Extract extract, + final int widthIn, final int heightIn, final ByteBuffer dataIn, final int widthOut, + final int heightOut, final ByteBuffer dataOut, final int pixelSizeInBytes, + final int rowSizeInBytes, final boolean isSwap ) { + final float x; + float convx; + final float y; + float convy; float percent; // max components in a format is 4, so - float[] totals = new float[4]; - float[] extractTotals = new float[4]; - float[] extractMoreTotals = new float[4]; - float[] shoveTotals = new float[4]; + final float[] totals = new float[4]; + final float[] extractTotals = new float[4]; + final float[] extractMoreTotals = new float[4]; + final float[] shoveTotals = new float[4]; float area; int i, j, k, xindex; int temp, temp0; - int temp_index; + final int temp_index; int outIndex = 0; int lowx_int, highx_int, lowy_int, highy_int; @@ -2309,7 +2325,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthIn - 1) { - int delta = (highx_int - widthIn + 1); + final int delta = (highx_int - widthIn + 1); lowx_int -= delta; highx_int -= delta; } @@ -2326,16 +2342,16 @@ public class ScaleInternal { assert( outIndex == ( widthOut * heightOut - 1) ); } - public static void scaleInternal3D( int components, int widthIn, int heightIn, - int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, - int depthOut, ShortBuffer dataOut ) { + public static void scaleInternal3D( final int components, final int widthIn, final int heightIn, + final int depthIn, final ShortBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final ShortBuffer dataOut ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float z, lowz, highz, convz, halfconvz; float xpercent, ypercent, zpercent; float percent; // max compnents in a format is 4 - float[] totals = new float[4]; + final float[] totals = new float[4]; float volume; int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; int temp; @@ -2442,12 +2458,12 @@ public class ScaleInternal { } } - public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, - int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, - int depthOut, int typeOut, ByteBuffer dataOut ) { + public static int gluScaleImage3D( final GL gl, final int format, final int widthIn, final int heightIn, + final int depthIn, final int typeIn, final ByteBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final int typeOut, final ByteBuffer dataOut ) { int components; ShortBuffer beforeImage, afterImage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( widthIn == 0 || heightIn == 0 || depthIn == 0 || widthOut == 0 || heightOut == 0 || depthOut == 0 ) { @@ -2475,10 +2491,10 @@ public class ScaleInternal { try { beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError err ) { + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } Mipmap.retrieveStoreModes3D( gl, psm ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java index dc401880d..8683f75ac 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java @@ -61,7 +61,7 @@ public class Type_Widget { buffer = ByteBuffer.allocate( 4 ); } - public void setUB0( byte b ) { + public void setUB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -71,7 +71,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB1( byte b ) { + public void setUB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -81,7 +81,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB2( byte b ) { + public void setUB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -91,7 +91,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB3( byte b ) { + public void setUB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -101,7 +101,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUS0( short s ) { + public void setUS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -111,7 +111,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUS1( short s ) { + public void setUS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -121,7 +121,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUI( int i ) { + public void setUI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -131,7 +131,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setB0( byte b ) { + public void setB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -141,7 +141,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB1( byte b ) { + public void setB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -151,7 +151,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB2( byte b ) { + public void setB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -161,7 +161,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB3( byte b ) { + public void setB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -171,7 +171,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setS0( short s ) { + public void setS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -181,7 +181,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setS1( short s ) { + public void setS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -191,7 +191,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setI( int i ) { + public void setI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -201,7 +201,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setF( float f ) { + public void setF( final float f ) { buffer.position( 0 ); buffer.putFloat( f ); } @@ -216,8 +216,8 @@ public class Type_Widget { return( buffer ); } - public static void main( String args[] ) { - Type_Widget t = new Type_Widget(); + public static void main( final String args[] ) { + final Type_Widget t = new Type_Widget(); t.setI( 1000000 ); System.out.println("int: " + Integer.toHexString( t.getI() ) ); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java index df2b9a147..2194eb672 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java @@ -68,7 +68,7 @@ public class Arc { /** * Corresponding berizer type arc */ - private BezierArc bezierArc; + private final BezierArc bezierArc; /** * Makes new arc at specified side @@ -76,7 +76,7 @@ public class Arc { * @param side * which side doeas this arc form */ - public Arc(int side) { + public Arc(final int side) { bezierArc = null; pwlArc = null; type = 0; @@ -90,7 +90,7 @@ public class Arc { * @param side * arc side */ - private void setside(int side) { + private void setside(final int side) { // DONE clearside(); type |= side << 8; @@ -152,7 +152,7 @@ public class Arc { * arc to be append * @return this */ - public Arc append(Arc jarc) { + public Arc append(final Arc jarc) { // DONE if (jarc != null) { next = jarc.next; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java index c299b10af..68263b90d 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java @@ -45,7 +45,7 @@ public class ArcSdirSorter { * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider */ - public ArcSdirSorter(Subdivider subdivider) { + public ArcSdirSorter(final Subdivider subdivider) { //TODO // System.out.println("TODO arcsdirsorter.constructor"); } @@ -55,7 +55,7 @@ public class ArcSdirSorter { * @param list arc list to be sorted * @param count size of list */ - public void qsort(CArrayOfArcs list, int count) { + public void qsort(final CArrayOfArcs list, final int count) { // TODO // 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 1a584c396..dcd7d9fdc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java @@ -44,7 +44,7 @@ public class ArcTdirSorter { * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider */ - public ArcTdirSorter(Subdivider subdivider) { + public ArcTdirSorter(final Subdivider subdivider) { // TODO Auto-generated constructor stub // System.out.println("TODO arcTsorter.konstruktor"); } @@ -53,7 +53,7 @@ public class ArcTdirSorter { * @param list arc list to be sorted * @param count size of list */ - public void qsort(CArrayOfArcs list, int count) { + public void qsort(final CArrayOfArcs list, final int count) { // TODO Auto-generated method stub // 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 bd6311414..119ccbc81 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java @@ -49,9 +49,9 @@ public class ArcTesselator { * @param t1 minimum t param * @param t2 maximum s param */ - public void bezier(Arc arc, float s1, float s2, float t1, float t2) { + public void bezier(final Arc arc, final float s1, final float s2, final float t1, final float t2) { // DONE - TrimVertex[] p = new TrimVertex[2]; + final TrimVertex[] p = new TrimVertex[2]; p[0] = new TrimVertex(); p[1] = new TrimVertex(); arc.pwlArc = new PwlArc(2, p); @@ -70,7 +70,7 @@ public class ArcTesselator { * @param t1 third tail * @param f stepsize */ - public void pwl_right(Arc newright, float s, float t1, float t2, float f) { + public void pwl_right(final Arc newright, final float s, final float t1, final float t2, final float f) { // TODO Auto-generated method stub // System.out.println("TODO arctesselator.pwl_right"); } @@ -83,7 +83,7 @@ public class ArcTesselator { * @param t1 third tail * @param f stepsize */ - public void pwl_left(Arc newright, float s, float t2, float t1, float f) { + public void pwl_left(final Arc newright, final float s, final float t2, final float t1, final float f) { // TODO Auto-generated method stub // 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 3e974247b..bde1e2cbb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java @@ -101,8 +101,8 @@ public abstract class Backend { * @param ulo smallest u * @param uhi highest u */ - public void curvpts(int type, CArrayOfFloats ps, int stride, int order, - float ulo, float uhi) { + public void curvpts(final int type, final CArrayOfFloats ps, final int stride, final int order, + final float ulo, final float uhi) { // DONE curveEvaluator.map1f(type, ulo, uhi, stride, order, ps); curveEvaluator.enable(type); @@ -114,7 +114,7 @@ public abstract class Backend { * @param u2 highest u * @param nu number of pieces */ - public void curvgrid(float u1, float u2, int nu) { + public void curvgrid(final float u1, final float u2, final int nu) { // DONE curveEvaluator.mapgrid1f(nu, u1, u2); @@ -125,7 +125,7 @@ public abstract class Backend { * @param from low param * @param n step */ - public void curvmesh(int from, int n) { + public void curvmesh(final int from, final int n) { // DONE curveEvaluator.mapmesh1f(N_MESHFILL, from, from + n); } @@ -135,7 +135,7 @@ public abstract class Backend { * @param wiretris use triangles * @param wirequads use quads */ - public void bgnsurf(int wiretris, int wirequads) { + public void bgnsurf(final int wiretris, final int wirequads) { // DONE surfaceEvaluator.bgnmap2f(); @@ -160,7 +160,7 @@ public abstract class Backend { * @param vlo low v param * @param vhi high v param */ - public void patch(float ulo, float uhi, float vlo, float vhi) { + public void patch(final float ulo, final float uhi, final float vlo, final float vhi) { // DONE surfaceEvaluator.domain2f(ulo, uhi, vlo, vhi); } @@ -174,7 +174,7 @@ public abstract class Backend { * @param v1 highest v * @param nv number of pieces in v direction */ - public void surfgrid(float u0, float u1, int nu, float v0, float v1, int nv) { + public void surfgrid(final float u0, final float u1, final int nu, final float v0, final float v1, final int nv) { // DONE surfaceEvaluator.mapgrid2f(nu, u0, u1, nv, v0, v1); @@ -187,7 +187,7 @@ public abstract class Backend { * @param n step in u direction * @param m step in v direction */ - public void surfmesh(int u, int v, int n, int m) { + public void surfmesh(final int u, final int v, final int n, final int m) { // System.out.println("TODO backend.surfmesh wireframequads"); // TODO wireframequads surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m); @@ -206,8 +206,8 @@ public abstract class Backend { * @param vlo lowest v * @param vhi hightest v */ - public void surfpts(int type, CArrayOfFloats pts, int ustride, int vstride, - int uorder, int vorder, float ulo, float uhi, float vlo, float vhi) { + public void surfpts(final int type, final CArrayOfFloats pts, final int ustride, final int vstride, + final int uorder, final int vorder, final float ulo, final float uhi, final float vlo, final float vhi) { // DONE surfaceEvaluator.map2f(type, ulo, uhi, ustride, uorder, vlo, vhi, vstride, vorder, pts); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java index 17437ef01..638b018c9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java @@ -64,7 +64,7 @@ public class Bin { * Adds and arc to linked list * @param jarc added arc */ - public void addarc(Arc jarc) { + public void addarc(final Arc jarc) { // DONE // if (head == null) // head = jarc; @@ -93,7 +93,7 @@ public class Bin { */ public Arc removearc() { // DONE - Arc jarc = head; + final Arc jarc = head; if (jarc != null) head = jarc.link; return jarc; @@ -147,7 +147,7 @@ public class Bin { */ private Arc nextarc() { // DONE - Arc jarc = current; + final Arc jarc = current; if (jarc != null) current = jarc.link; return jarc; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java index b67764c30..6d2ab362b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java @@ -20,7 +20,7 @@ public class CArrayOfArcs { /** * Don't check for array borders? */ - private boolean noCheck = true; + private final boolean noCheck = true; /** * Makes new CArray @@ -30,7 +30,7 @@ public class CArrayOfArcs { * @param pointer * pointer (index) to array */ - public CArrayOfArcs(Arc[] array, int pointer) { + public CArrayOfArcs(final Arc[] array, final int pointer) { this.array = array; // this.pointer=pointer; setPointer(pointer); @@ -42,7 +42,7 @@ public class CArrayOfArcs { * @param carray * reference array */ - public CArrayOfArcs(CArrayOfArcs carray) { + public CArrayOfArcs(final CArrayOfArcs carray) { this.array = carray.array; // this.pointer=carray.pointer; setPointer(carray.pointer); @@ -54,7 +54,7 @@ public class CArrayOfArcs { * @param ctlarray * underlaying array */ - public CArrayOfArcs(Arc[] ctlarray) { + public CArrayOfArcs(final Arc[] ctlarray) { this.array = ctlarray; this.pointer = 0; } @@ -82,7 +82,7 @@ public class CArrayOfArcs { * @param f * desired value */ - public void set(Arc f) { + public void set(final Arc f) { array[pointer] = f; } @@ -94,7 +94,7 @@ public class CArrayOfArcs { * array index * @return element at index */ - public Arc get(int i) { + public Arc get(final int i) { return array[i]; } @@ -105,7 +105,7 @@ public class CArrayOfArcs { * relative index * @return element at relative index */ - public Arc getRelative(int i) { + public Arc getRelative(final int i) { return array[pointer + i]; } @@ -117,7 +117,7 @@ public class CArrayOfArcs { * @param value * value to be set */ - public void setRelative(int i, Arc value) { + public void setRelative(final int i, final Arc value) { array[pointer + i] = value; } @@ -127,7 +127,7 @@ public class CArrayOfArcs { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { // pointer-=i; setPointer(pointer - i); } @@ -147,7 +147,7 @@ public class CArrayOfArcs { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { if (!noCheck && pointer > array.length) throw new IllegalArgumentException("Pointer " + pointer + " out of bounds " + array.length); @@ -160,7 +160,7 @@ public class CArrayOfArcs { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { // pointer+=i; setPointer(pointer + i); } @@ -188,7 +188,7 @@ public class CArrayOfArcs { * @param array * underlaying array */ - public void setArray(Arc[] array) { + public void setArray(final Arc[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java index b5f588960..1c80289a3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java @@ -10,7 +10,7 @@ public class CArrayOfBreakpts { /** * Underlaying array */ - private Breakpt[] pole; + private final Breakpt[] pole; /** * Pointer to array member @@ -25,7 +25,7 @@ public class CArrayOfBreakpts { * @param pointer * pointer (index) to array */ - public CArrayOfBreakpts(Breakpt[] array, int pointer) { + public CArrayOfBreakpts(final Breakpt[] array, final int pointer) { this.pole = array; this.pointer = pointer; } @@ -36,7 +36,7 @@ public class CArrayOfBreakpts { * @param carray * reference array */ - public CArrayOfBreakpts(CArrayOfBreakpts carray) { + public CArrayOfBreakpts(final CArrayOfBreakpts carray) { this.pole = carray.pole; this.pointer = carray.pointer; } @@ -63,7 +63,7 @@ public class CArrayOfBreakpts { * @param f * desired value */ - public void set(Breakpt f) { + public void set(final Breakpt f) { pole[pointer] = f; } @@ -75,7 +75,7 @@ public class CArrayOfBreakpts { * array index * @return element at index */ - public Breakpt get(int i) { + public Breakpt get(final int i) { return pole[i]; } @@ -85,7 +85,7 @@ public class CArrayOfBreakpts { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { pointer -= i; } @@ -105,7 +105,7 @@ public class CArrayOfBreakpts { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { this.pointer = pointer; } @@ -115,7 +115,7 @@ public class CArrayOfBreakpts { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { pointer += i; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java index d9e4d0ff1..c9d6a59ad 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java @@ -21,7 +21,7 @@ public class CArrayOfFloats { /** * Don't check for array borders? */ - private boolean noCheck = true; + private final boolean noCheck = true; /** * Makes new CArray @@ -31,7 +31,7 @@ public class CArrayOfFloats { * @param pointer * pointer (index) to array */ - public CArrayOfFloats(float[] array, int pointer) { + public CArrayOfFloats(final float[] array, final int pointer) { this.array = array; // this.pointer=pointer; setPointer(pointer); @@ -43,7 +43,7 @@ public class CArrayOfFloats { * @param carray * reference array */ - public CArrayOfFloats(CArrayOfFloats carray) { + public CArrayOfFloats(final CArrayOfFloats carray) { this.array = carray.array; // this.pointer=carray.pointer; setPointer(carray.pointer); @@ -55,7 +55,7 @@ public class CArrayOfFloats { * @param ctlarray * underlaying array */ - public CArrayOfFloats(float[] ctlarray) { + public CArrayOfFloats(final float[] ctlarray) { this.array = ctlarray; this.pointer = 0; } @@ -83,7 +83,7 @@ public class CArrayOfFloats { * @param f * desired value */ - public void set(float f) { + public void set(final float f) { array[pointer] = f; } @@ -95,7 +95,7 @@ public class CArrayOfFloats { * array index * @return element at index */ - public float get(int i) { + public float get(final int i) { return array[i]; } @@ -106,7 +106,7 @@ public class CArrayOfFloats { * relative index * @return element at relative index */ - public float getRelative(int i) { + public float getRelative(final int i) { return array[pointer + i]; } @@ -118,7 +118,7 @@ public class CArrayOfFloats { * @param value * value to be set */ - public void setRelative(int i, float value) { + public void setRelative(final int i, final float value) { array[pointer + i] = value; } @@ -128,7 +128,7 @@ public class CArrayOfFloats { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { // pointer-=i; setPointer(pointer - i); } @@ -148,7 +148,7 @@ public class CArrayOfFloats { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { if (!noCheck && pointer > array.length) throw new IllegalArgumentException("Pointer " + pointer + " out of bounds " + array.length); @@ -161,7 +161,7 @@ public class CArrayOfFloats { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { // pointer+=i; setPointer(pointer + i); } @@ -189,7 +189,7 @@ public class CArrayOfFloats { * @param array * underlaying array */ - public void setArray(float[] array) { + public void setArray(final float[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java index e7bbac16a..0d769004a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java @@ -25,7 +25,7 @@ public class CArrayOfQuiltspecs { * @param pointer * pointer (index) to array */ - public CArrayOfQuiltspecs(Quiltspec[] array, int pointer) { + public CArrayOfQuiltspecs(final Quiltspec[] array, final int pointer) { this.array = array; this.pointer = pointer; } @@ -36,7 +36,7 @@ public class CArrayOfQuiltspecs { * @param carray * reference array */ - public CArrayOfQuiltspecs(CArrayOfQuiltspecs carray) { + public CArrayOfQuiltspecs(final CArrayOfQuiltspecs carray) { this.array = carray.array; this.pointer = carray.pointer; } @@ -47,7 +47,7 @@ public class CArrayOfQuiltspecs { * @param array * underlaying array */ - public CArrayOfQuiltspecs(Quiltspec[] array) { + public CArrayOfQuiltspecs(final Quiltspec[] array) { this.array = array; this.pointer = 0; } @@ -74,7 +74,7 @@ public class CArrayOfQuiltspecs { * @param f * desired value */ - public void set(Quiltspec f) { + public void set(final Quiltspec f) { array[pointer] = f; } @@ -86,7 +86,7 @@ public class CArrayOfQuiltspecs { * array index * @return element at index */ - public Quiltspec get(int i) { + public Quiltspec get(final int i) { return array[i]; } @@ -96,7 +96,7 @@ public class CArrayOfQuiltspecs { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { pointer -= i; } @@ -116,7 +116,7 @@ public class CArrayOfQuiltspecs { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { this.pointer = pointer; } @@ -126,7 +126,7 @@ public class CArrayOfQuiltspecs { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { pointer += i; } @@ -154,7 +154,7 @@ public class CArrayOfQuiltspecs { * @param array * underlaying array */ - public void setArray(Quiltspec[] array) { + public void setArray(final Quiltspec[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java index ea3a3d14e..5fccbc598 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java @@ -59,32 +59,32 @@ public class Curve { /** * OpenGL maps */ - private Mapdesc mapdesc; + private final Mapdesc mapdesc; /** * Does the curve need sampling */ - private boolean needsSampling; + private final boolean needsSampling; /** * Culling */ - private int cullval; + private final int cullval; /** * Number of coords */ - private int stride; + private final int stride; /** * Curve order */ - private int order; + private final int order; /** * Holds conversion range borders */ - private float[] range; + private final float[] range; /** * Subdivision stepsize @@ -110,7 +110,7 @@ public class Curve { * @param c * next curve in linked list */ - public Curve(Quilt geo, float[] pta, float[] ptb, Curve c) { + public Curve(final Quilt geo, final float[] pta, final float[] ptb, final Curve c) { spts = new float[MAXORDER * MAXCOORDS]; @@ -125,8 +125,8 @@ public class Curve { stride = MAXCOORDS; // CArrayOfFloats ps = geo.cpts; - CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0); - CArrayOfQuiltspecs qs = geo.qspec; + final CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0); + final CArrayOfQuiltspecs qs = geo.qspec; ps.raisePointerBy(qs.get().offset); ps.raisePointerBy(qs.get().index * qs.get().order * qs.get().stride); @@ -182,11 +182,11 @@ public class Curve { } else { assert (order <= MAXORDER); - float tmp[][] = new float[MAXORDER][MAXCOORDS]; + final float tmp[][] = new float[MAXORDER][MAXCOORDS]; - int tstride = (MAXORDER); + final int tstride = (MAXORDER); - int val = 0; + final int val = 0; // mapdesc.project(spts,stride,tmp,tstride,order); // System.out.println("TODO curve.getsptepsize mapdesc.project"); @@ -194,7 +194,7 @@ public class Curve { if (val == 0) { setstepsize(mapdesc.maxrate); } else { - float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); + final float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); if (mapdesc.isParametricDistanceSampling()) { // System.out.println("TODO curve.getstepsize - parametric"); } else if (mapdesc.isPathLengthSampling()) { @@ -212,7 +212,7 @@ public class Curve { * Sets maximum subdivision step size * @param max maximum subdivision step size */ - private void setstepsize(float max) { + private void setstepsize(final float max) { // DONE stepsize = (max >= 1) ? (range[2] / max) : range[2]; minstepsize = stepsize; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java index 80baf207b..96081a8ec 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java @@ -67,7 +67,7 @@ public class Curvelist { * @param pta range start * @param ptb range end */ - public Curvelist(Quilt qlist, float[] pta, float[] ptb) { + public Curvelist(final Quilt qlist, final float[] pta, final float[] ptb) { // DONE curve = null; range = new float[3]; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java index d9d012606..e1b4cb2bb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java @@ -49,7 +49,7 @@ public class DisplayList { * @param m invoked method * @param arg method argument */ - public void append(Object src, Method m, Object arg) { + public void append(final Object src, final Method m, final Object arg) { // TODO Auto-generated method stub // System.out.println("TODO displaylist append"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java index f9c4c2d6f..30f52d5cc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java @@ -68,7 +68,7 @@ public class Flist { * Grows list * @param maxpts maximum desired size */ - public void grow(int maxpts) { + public void grow(final int maxpts) { // DONE if (npts < maxpts) { // npts=2*maxpts; @@ -106,7 +106,7 @@ public class Flist { * @param from start from * @param to end at */ - public void taper(float from, float to) { + public void taper(final float from, final float to) { // DONE while (pts[start] != from) { @@ -123,7 +123,7 @@ public class Flist { * Adds breakpoint value * @param f value */ - public void add(float f) { + public void add(final float f) { //DONE pts[end++] = f; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java index 1dcf393a9..b7fa722ec 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java @@ -175,7 +175,7 @@ public class Knotspec { break; } - CArrayOfFloats k = new CArrayOfFloats(kfirst); + final CArrayOfFloats k = new CArrayOfFloats(kfirst); k.mm(); for (; k.getPointer() >= inkbegin.getPointer(); k.mm()) @@ -183,7 +183,7 @@ public class Knotspec { break; k.pp(); - Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst + final Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst .getPointer()) + 1]; for (int i = 0; i < bbeginArray.length; i++) bbeginArray[i] = new Breakpt(); @@ -218,7 +218,7 @@ public class Knotspec { */ private void factors() { // DONE - CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend + final CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend .getPointer() - 1) - order + bend.get().multi); @@ -226,18 +226,18 @@ public class Knotspec { if (sbegin != null) fptr = new CArrayOfFloats(sbegin); - for (CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt + for (final CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt .getPointer() >= bbegin.getPointer(); bpt.mm()) { mid.lessenPointerBy(bpt.get().multi); - int def = bpt.get().def - 1; + final int def = bpt.get().def - 1; if (def < 0) continue; - float kv = bpt.get().value; + final float kv = bpt.get().value; - CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid + final CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid .getPointer() - def) + (order - 1)); - for (CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf + for (final CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf .getPointer() + def); kl.getPointer() != kf.getPointer(); kl.mm()) { CArrayOfFloats kh, kt; @@ -257,10 +257,10 @@ public class Knotspec { */ private void knots() { // DONE - CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft + final CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft .getPointer() - order); - CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright + final CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright .getPointer() + bend.get().def); @@ -279,8 +279,8 @@ public class Knotspec { */ private void breakpoints() { // DONE - CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin); - CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend); + final CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin); + final CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend); int nfactors = 0; ubpt.get().value = ubend.get().value; @@ -320,13 +320,13 @@ public class Knotspec { * @param _outpt * output control points */ - public void copy(CArrayOfFloats _inpt, CArrayOfFloats _outpt) { - CArrayOfFloats inpt = new CArrayOfFloats(_inpt); - CArrayOfFloats outpt = new CArrayOfFloats(_outpt); + public void copy(final CArrayOfFloats _inpt, final CArrayOfFloats _outpt) { + final CArrayOfFloats inpt = new CArrayOfFloats(_inpt); + final CArrayOfFloats outpt = new CArrayOfFloats(_outpt); inpt.raisePointerBy(preoffset); if (next != null) { - for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), + for (final CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), outpt.getPointer() + prewidth); outpt.getPointer() != lpt .getPointer(); outpt.raisePointerBy(poststride)) { next.copy(inpt, outpt); @@ -334,7 +334,7 @@ public class Knotspec { } } else { - for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), + for (final CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), outpt.getPointer() + prewidth); outpt.getPointer() != lpt .getPointer(); outpt.raisePointerBy(poststride)) { pt_io_copy(outpt, inpt); @@ -352,7 +352,7 @@ public class Knotspec { * @param frompt * destination control point */ - private void pt_io_copy(CArrayOfFloats topt, CArrayOfFloats frompt) { + private void pt_io_copy(final CArrayOfFloats topt, final CArrayOfFloats frompt) { // DONE switch (ncoords) { case 4: @@ -378,8 +378,8 @@ public class Knotspec { * @param _p * inserted knot */ - public void transform(CArrayOfFloats _p) { - CArrayOfFloats p = new CArrayOfFloats(_p); + public void transform(final CArrayOfFloats _p) { + final CArrayOfFloats p = new CArrayOfFloats(_p); // DONE if (next != null) {//surface code if (this.equals(kspectotrans)) { @@ -387,13 +387,13 @@ public class Knotspec { } else { if (istransformed) { p.raisePointerBy(postoffset); - for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) next.transform(p); } else { - CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p + final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p .getPointer() + prewidth); for (; p.getPointer() != pend.getPointer(); p @@ -408,13 +408,13 @@ public class Knotspec { } else { if (istransformed) { p.raisePointerBy(postoffset); - for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) { kspectotrans.insert(p); } } else { - CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p + final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p .getPointer() + prewidth); for (; p.getPointer() != pend.getPointer(); p @@ -432,27 +432,27 @@ public class Knotspec { * @param p * inserted knot */ - private void insert(CArrayOfFloats p) { + private void insert(final CArrayOfFloats p) { // DONE CArrayOfFloats fptr = null; if (sbegin != null) fptr = new CArrayOfFloats(sbegin); - CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), p.getPointer() + final CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), p.getPointer() + prewidth - poststride); // CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), prewidth - // poststride); - CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), p.getPointer() + final CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth + postoffset - poststride); // CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), postwidth + // postoffset - poststride); - CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); + final CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); - for (CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt + for (final CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt .getPointer() - poststride * bpt.get().def); srcpt.getPointer() != pend .getPointer(); pend.raisePointerBy(poststride)) { - CArrayOfFloats p1 = new CArrayOfFloats(srcpt); - for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt + final CArrayOfFloats p1 = new CArrayOfFloats(srcpt); + for (final CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt .getPointer() - poststride); p2.getPointer() != pend.getPointer(); p1 .setPointer(p2.getPointer()), p2 @@ -469,15 +469,15 @@ public class Knotspec { dstpt.lessenPointerBy(poststride); srcpt.lessenPointerBy(poststride); } - for (CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt.getPointer() - poststride * bpt.get().def); srcpt .getPointer() != pend.getPointer(); pend .raisePointerBy(poststride), dstpt .lessenPointerBy(poststride)) { pt_oo_copy(dstpt, srcpt); - CArrayOfFloats p1 = new CArrayOfFloats(srcpt); + final CArrayOfFloats p1 = new CArrayOfFloats(srcpt); - for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), + for (final CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt.getPointer() - poststride); p2.getPointer() != pend .getPointer(); p1.setPointer(p2.getPointer()), p2 .lessenPointerBy(poststride)) { @@ -496,7 +496,7 @@ public class Knotspec { * @param frompt * distance ctrl point */ - private void pt_oo_copy(CArrayOfFloats topt, CArrayOfFloats frompt) { + private void pt_oo_copy(final CArrayOfFloats topt, final CArrayOfFloats frompt) { // DONE // this is a "trick" with case - "break" is omitted so it comes through all cases switch (ncoords) { @@ -531,8 +531,8 @@ public class Knotspec { * @param b * 1 - alpha */ - private void pt_oo_sum(CArrayOfFloats x, CArrayOfFloats y, - CArrayOfFloats z, float a, double b) { + private void pt_oo_sum(final CArrayOfFloats x, final CArrayOfFloats y, + final CArrayOfFloats z, final float a, final double b) { // DONE switch (ncoords) { case 4: diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java index 571f44f06..76b59231c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java @@ -85,7 +85,7 @@ public class Knotvector { * @param knot * knots */ - public Knotvector(int nknots, int stride, int order, float[] knot) { + public Knotvector(final int nknots, final int stride, final int order, final float[] knot) { // DONE init(nknots, stride, order, knot); } @@ -102,7 +102,7 @@ public class Knotvector { * @param knot * knots */ - public void init(int nknots, int stride, int order, float[] knot) { + public void init(final int nknots, final int stride, final int order, final float[] knot) { // DONE this.knotcount = nknots; this.stride = stride; @@ -158,7 +158,7 @@ public class Knotvector { * @param msg * message to be shown */ - public void show(String msg) { + public void show(final String msg) { // TODO Auto-generated method stub // System.out.println("TODO knotvector.show"); @@ -173,7 +173,7 @@ public class Knotvector { * second knot * @return knots are/are not equal */ - public static boolean identical(float a, float b) { + public static boolean identical(final float a, final float b) { return ((a - b) < TOLERANCE) ? true : false; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java index 86638a827..95ce60c25 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java @@ -64,22 +64,22 @@ public class Mapdesc { /** * Map type */ - private int type; + private final int type; /** * Number of homogenous coords */ - private int hcoords; + private final int hcoords; /** * Number of inhomogenous coords */ - private int inhcoords; + private final int inhcoords; /** * Not used */ - private int mask; + private final int mask; /** * Value of N_PIXEL_TOLERANCE property @@ -144,22 +144,22 @@ public class Mapdesc { /** * Not used */ - private float[][] bmat; + private final float[][] bmat; /** * Sampling matrix */ - private float[][] smat; + private final float[][] smat; /** * Not used */ - private float[][] cmat; + private final float[][] cmat; /** * Not used */ - private float[] bboxsize; + private final float[] bboxsize; /** * Makes new mapdesc @@ -168,7 +168,7 @@ public class Mapdesc { * @param ncoords number of control points coords * @param backend backend object */ - public Mapdesc(int type, int rational, int ncoords, Backend backend) { + public Mapdesc(final int type, final int rational, final int ncoords, final Backend backend) { // DONE this.type = type; this.isrational = rational; @@ -210,7 +210,7 @@ public class Mapdesc { * Make matrix identity matrix * @param arr matrix */ - private void identify(float[][] arr) { + private void identify(final float[][] arr) { // DONE for (int i = 0; i < MAXCOORDS; i++) for (int j = 0; j < MAXCOORDS; j++) @@ -225,7 +225,7 @@ public class Mapdesc { * @param tag property tag * @return is/is not property */ - public boolean isProperty(int tag) { + public boolean isProperty(final int tag) { boolean ret; switch (tag) { case NurbsConsts.N_PIXEL_TOLERANCE: @@ -347,7 +347,7 @@ public class Mapdesc { * @param tag property tag * @return property value */ - public float getProperty(int tag) { + public float getProperty(final int tag) { // TODO Auto-generated method stub // System.out.println("TODO mapdesc.getproperty"); return 0; @@ -358,7 +358,7 @@ public class Mapdesc { * @param tag property tag * @param value desired value */ - public void setProperty(int tag, float value) { + public void setProperty(final int tag, float value) { // TODO Auto-generated method stub switch (tag) { case NurbsConsts.N_PIXEL_TOLERANCE: @@ -412,8 +412,8 @@ public class Mapdesc { * @param sp breakpoints * @param outstride output number of control points' coordinates */ - public void xformSampling(CArrayOfFloats pts, int order, int stride, - float[] sp, int outstride) { + public void xformSampling(final CArrayOfFloats pts, final int order, final int stride, + final float[] sp, final int outstride) { // DONE xFormMat(smat, pts, order, stride, sp, outstride); } @@ -427,8 +427,8 @@ public class Mapdesc { * @param cp breakpoints * @param outstride output number of control points' coordinates */ - private void xFormMat(float[][] mat, CArrayOfFloats pts, int order, - int stride, float[] cp, int outstride) { + private void xFormMat(final float[][] mat, final CArrayOfFloats pts, final int order, + final int stride, final float[] cp, final int outstride) { // TODO Auto-generated method stub // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats"); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java index af8024109..7f9d7c5a0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java @@ -48,13 +48,13 @@ public class Maplist { /** * Backend class */ - private Backend backend; + private final Backend backend; /** * Makes new Maplist * @param backend Backend class */ - public Maplist(Backend backend) { + public Maplist(final Backend backend) { this.backend = backend; } @@ -72,9 +72,9 @@ public class Maplist { * @param rational is map rational * @param ncoords number of coords */ - public void define(int type, int rational, int ncoords) { + public void define(final int type, final int rational, final int ncoords) { // DONE - Mapdesc m = locate(type); + final Mapdesc m = locate(type); assert (m == null || (m.isrational == rational && m.ncoords == ncoords)); add(type, rational, ncoords); @@ -86,9 +86,9 @@ public class Maplist { * @param rational is map rational * @param ncoords number of coords */ - private void add(int type, int rational, int ncoords) { + private void add(final int type, final int rational, final int ncoords) { // DONE - Mapdesc map = new Mapdesc(type, rational, ncoords, backend); + final Mapdesc map = new Mapdesc(type, rational, ncoords, backend); if (maps == null) { maps = map; } else { @@ -102,7 +102,7 @@ public class Maplist { * @param type map type * @return Mapdesc of type or null if there is no such map */ - public Mapdesc locate(int type) { + public Mapdesc locate(final int type) { // DONE Mapdesc m = null; for (m = maps; m != null; m = m.next) @@ -116,7 +116,7 @@ public class Maplist { * @param type maptype * @return Mapdesc of type or null if there is no such map */ - public Mapdesc find(int type) { + public Mapdesc find(final int type) { return locate(type); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java index a686da696..a957c21a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java @@ -70,7 +70,7 @@ public class O_nurbscurve { * Makes new O_nurbscurve * @param realType type of curve */ - public O_nurbscurve(int realType) { + public O_nurbscurve(final int realType) { // DONE this.type = realType; this.owner = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java index 867f43657..4df3c14ca 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java @@ -64,13 +64,13 @@ public class O_nurbssurface { /** * Surface type */ - private int type; + private final int type; /** * Makes new O_nurbssurface of type * @param type surface type */ - public O_nurbssurface(int type) { + public O_nurbssurface(final int type) { this.type = type; this.owner = null; this.next = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java index a44f2451c..0fd4baa81 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java @@ -48,7 +48,7 @@ public class Patch { * @param ptb * @param patch */ - public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) { + public Patch(final Quilt q, final float[] pta, final float[] ptb, final Patch patch) { // 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 240c905a2..68b01d8d0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java @@ -57,7 +57,7 @@ public class Patchlist { * @param pta low border * @param ptb high border */ - public Patchlist(Quilt quilts, float[] pta, float[] ptb) { + public Patchlist(final Quilt quilts, final float[] pta, final float[] ptb) { // DONE patch = null; @@ -81,7 +81,7 @@ public class Patchlist { * @param param * @param mid */ - public Patchlist(Patchlist patchlist, int param, float mid) { + public Patchlist(final Patchlist patchlist, final int param, final float mid) { // TODO Auto-generated constructor stub // System.out.println("TODO patchlist.konstruktor 2"); } @@ -120,7 +120,7 @@ public class Patchlist { * @param i * @return false */ - public boolean needsSubdivision(int i) { + public boolean needsSubdivision(final int i) { // TODO Auto-generated method stub // System.out.println("TODO patchlist.needsSubdivision"); return false; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java index 79f36ce43..155549bce 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java @@ -67,7 +67,7 @@ public class Property { * @param value * property value */ - public Property(int type, int tag, float value) { + public Property(final int type, final int tag, final float value) { this.type = type; this.tag = tag; this.value = value; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java index bcbd20a16..8e04baf88 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java @@ -44,7 +44,7 @@ public class PwlArc { /** * Number of points */ - private int npts; + private final int npts; /** * Vertexes @@ -54,14 +54,14 @@ public class PwlArc { /** * Arc type */ - private int type; + private final int type; /** * Makes new trimming arc * @param i num ber of vertexes * @param p trimming vertexes array */ - public PwlArc(int i, TrimVertex[] p) { + public PwlArc(final int i, final TrimVertex[] p) { // DONE this.npts = i; this.pts = p; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java index 6bea4928c..2e2532a35 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java @@ -74,10 +74,10 @@ public class Quilt { * Makes new quilt with mapdesc * @param mapdesc map description */ - public Quilt(Mapdesc mapdesc) { + public Quilt(final Mapdesc mapdesc) { // DONE this.mapdesc = mapdesc; - Quiltspec[] tmpquilts = new Quiltspec[MAXDIM]; + final Quiltspec[] tmpquilts = new Quiltspec[MAXDIM]; for (int i = 0; i < tmpquilts.length; i++) tmpquilts[i] = new Quiltspec(); this.qspec = new CArrayOfQuiltspecs(tmpquilts); @@ -91,9 +91,9 @@ public class Quilt { * @param ctrlarr control points * @param coords control points coords */ - public void toBezier(Knotvector sknotvector, Knotvector tknotvector, - CArrayOfFloats ctrlarr, int coords) { - Splinespec spline = new Splinespec(2); + public void toBezier(final Knotvector sknotvector, final Knotvector tknotvector, + final CArrayOfFloats ctrlarr, final int coords) { + final Splinespec spline = new Splinespec(2); spline.kspecinit(sknotvector, tknotvector); spline.select(); spline.layout(coords); @@ -108,9 +108,9 @@ public class Quilt { * @param ctlarray control points * @param ncoords number of coordinates */ - public void toBezier(Knotvector knots, CArrayOfFloats ctlarray, int ncoords) { + public void toBezier(final Knotvector knots, final CArrayOfFloats ctlarray, final int ncoords) { // DONE - Splinespec spline = new Splinespec(1); + final Splinespec spline = new Splinespec(1); spline.kspecinit(knots); spline.select(); spline.layout(ncoords); @@ -125,7 +125,7 @@ public class Quilt { * @param ptb high border * @param backend Backend */ - public void downloadAll(float[] pta, float[] ptb, Backend backend) { + public void downloadAll(final float[] pta, final float[] ptb, final Backend backend) { // DONE for (Quilt m = this; m != null; m = m.next) { m.select(pta, ptb); @@ -138,11 +138,11 @@ public class Quilt { * Renders arcs/patches * @param backend Backend for rendering */ - private void download(Backend backend) { + private void download(final Backend backend) { // DONE if (getDimension() == 2) { - CArrayOfFloats ps = new CArrayOfFloats(cpts); + final CArrayOfFloats ps = new CArrayOfFloats(cpts); ps.raisePointerBy(qspec.get(0).offset); ps.raisePointerBy(qspec.get(1).offset); ps.raisePointerBy(qspec.get(0).index * qspec.get(0).order @@ -159,7 +159,7 @@ public class Quilt { } else {// code for curves // CArrayOfFloats ps=new CArrayOfFloats(cpts); - CArrayOfFloats ps = new CArrayOfFloats(cpts.getArray(), 0); + final CArrayOfFloats ps = new CArrayOfFloats(cpts.getArray(), 0); ps.raisePointerBy(qspec.get(0).offset); ps.raisePointerBy(qspec.get(0).index * qspec.get(0).order * qspec.get(0).stride); @@ -185,9 +185,9 @@ public class Quilt { * @param pta range * @param ptb range */ - private void select(float[] pta, float[] ptb) { + private void select(final float[] pta, final float[] ptb) { // DONE - int dim = eqspec.getPointer() - qspec.getPointer(); + final int dim = eqspec.getPointer() - qspec.getPointer(); int i, j; for (i = 0; i < dim; i++) { for (j = qspec.get(i).width - 1; j >= 0; j--) @@ -205,7 +205,7 @@ public class Quilt { * @param to high param * @param bpts breakpoints */ - public void getRange(float[] from, float[] to, Flist bpts) { + public void getRange(final float[] from, final float[] to, final Flist bpts) { // DONE getRange(from, to, 0, bpts); @@ -218,9 +218,9 @@ public class Quilt { * @param i from/to array index * @param list breakpoints */ - private void getRange(float[] from, float[] to, int i, Flist list) { + private void getRange(final float[] from, final float[] to, final int i, final Flist list) { // DONE - Quilt maps = this; + final Quilt maps = this; from[i] = maps.qspec.get(i).breakpoints[0]; to[i] = maps.qspec.get(i).breakpoints[maps.qspec.get(i).width]; int maxpts = 0; @@ -262,7 +262,7 @@ public class Quilt { * @param slist u direction breakpoints * @param tlist v direction breakpoints */ - public void getRange(float[] from, float[] to, Flist slist, Flist tlist) { + public void getRange(final float[] from, final float[] to, final Flist slist, final Flist tlist) { // DONE getRange(from, to, 0, slist); getRange(from, to, 1, tlist); @@ -275,7 +275,7 @@ public class Quilt { * @param tbrkpts * @param rate */ - public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) { + public void findRates(final Flist sbrkpts, final Flist tbrkpts, final float[] rate) { // TODO Auto-generated method stub // System.out.println("TODO quilt.findrates"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java index 7c636122f..5c180f345 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java @@ -85,7 +85,7 @@ public class Renderhints { * Set property value * @param prop property */ - public void setProperty(Property prop) { + public void setProperty(final Property prop) { switch (prop.type) { case NurbsConsts.N_DISPLAY: display_method = (int) prop.value; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java index f1c779c2f..5e44c3259 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java @@ -44,7 +44,7 @@ public class Splinespec { /** * Dimension */ - private int dim; + private final int dim; /** * Knot vector specs @@ -60,7 +60,7 @@ public class Splinespec { * Makes new Splinespec with given dimension * @param i dimension */ - public Splinespec(int i) { + public Splinespec(final int i) { // DONE this.dim = i; } @@ -69,7 +69,7 @@ public class Splinespec { * Initializes knotspec according to knotvector * @param knotvector basic knotvector */ - public void kspecinit(Knotvector knotvector) { + public void kspecinit(final Knotvector knotvector) { // DONE this.kspec = new Knotspec(); kspec.inkbegin = new CArrayOfFloats(knotvector.knotlist, 0); @@ -85,10 +85,10 @@ public class Splinespec { * @param sknotvector knotvector in u dir * @param tknotvector knotvector in v dir */ - public void kspecinit(Knotvector sknotvector, Knotvector tknotvector) { + public void kspecinit(final Knotvector sknotvector, final Knotvector tknotvector) { // DONE this.kspec = new Knotspec(); - Knotspec tkspec = new Knotspec(); + final Knotspec tkspec = new Knotspec(); kspec.inkbegin = new CArrayOfFloats(sknotvector.knotlist, 0); kspec.inkend = new CArrayOfFloats(sknotvector.knotlist, @@ -121,7 +121,7 @@ public class Splinespec { * Prepares for conversion * @param ncoords number of coords */ - public void layout(int ncoords) { + public void layout(final int ncoords) { // DONE int stride = ncoords; for (Knotspec knotspec = kspec; knotspec != null; knotspec = knotspec.next) { @@ -143,9 +143,9 @@ public class Splinespec { * Prepares quilt for conversion * @param quilt quilt to work with */ - public void setupquilt(Quilt quilt) { + public void setupquilt(final Quilt quilt) { // DONE - CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec); + final CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec); quilt.eqspec = new CArrayOfQuiltspecs(qspec.getArray(), dim); for (Knotspec knotspec = kspec; knotspec != null;) { qspec.get().stride = knotspec.poststride; @@ -159,8 +159,8 @@ public class Splinespec { qspec.get().bdry[1] = (knotspec.kright.getPointer() == knotspec.klast .getPointer()) ? 1 : 0; qspec.get().breakpoints = new float[qspec.get().width + 1]; - CArrayOfFloats k = new CArrayOfFloats(qspec.get().breakpoints, 0); - for (CArrayOfBreakpts bk = new CArrayOfBreakpts(knotspec.bbegin); bk + final CArrayOfFloats k = new CArrayOfFloats(qspec.get().breakpoints, 0); + for (final CArrayOfBreakpts bk = new CArrayOfBreakpts(knotspec.bbegin); bk .getPointer() <= knotspec.bend.getPointer(); bk.pp()) { k.set(bk.get().value); k.pp(); @@ -177,7 +177,7 @@ public class Splinespec { * Copies array of control points to output array * @param ctlarray control points array */ - public void copy(CArrayOfFloats ctlarray) { + public void copy(final CArrayOfFloats ctlarray) { // DONE kspec.copy(ctlarray, outcpts); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java index 4d8296cca..d7c1dbf3c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java @@ -148,7 +148,7 @@ public class Subdivider { /** * Initializes quilt list */ - public void beginQuilts(Backend backend) { + public void beginQuilts(final Backend backend) { // DONE qlist = null; renderhints = new Renderhints(); @@ -162,7 +162,7 @@ public class Subdivider { * Adds quilt to linked list * @param quilt added quilt */ - public void addQuilt(Quilt quilt) { + public void addQuilt(final Quilt quilt) { // DONE if (qlist == null) qlist = quilt; @@ -198,8 +198,8 @@ public class Subdivider { } } - float[] from = new float[2]; - float[] to = new float[2]; + final float[] from = new float[2]; + final float[] to = new float[2]; spbrkpts = new Flist(); tpbrkpts = new Flist(); @@ -215,7 +215,7 @@ public class Subdivider { makeBorderTrim(from, to); } } else { - float[] rate = new float[2]; + final float[] rate = new float[2]; qlist.findRates(spbrkpts, tpbrkpts, rate); // System.out.println("subdivider.drawsurfaces decompose"); } @@ -231,8 +231,8 @@ public class Subdivider { int num_v_steps; for (i = spbrkpts.start; i < spbrkpts.end - 1; i++) { for (j = tpbrkpts.start; j < tpbrkpts.end - 1; j++) { - float[] pta = new float[2]; - float[] ptb = new float[2]; + final float[] pta = new float[2]; + final float[] ptb = new float[2]; pta[0] = spbrkpts.pts[i]; ptb[0] = spbrkpts.pts[i + 1]; @@ -266,7 +266,7 @@ public class Subdivider { * Empty method * @param initialbin2 */ - private void freejarcs(Bin initialbin2) { + private void freejarcs(final Bin initialbin2) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.freejarcs"); } @@ -275,7 +275,7 @@ public class Subdivider { * Subdivide in U direction * @param source Trimming arcs source */ - private void subdivideInS(Bin source) { + private void subdivideInS(final Bin source) { // DONE if (renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM) { outline(source); @@ -294,13 +294,13 @@ public class Subdivider { * @param start breakpoints start * @param end breakpoints end */ - private void splitInS(Bin source, int start, int end) { + private void splitInS(final Bin source, final int start, final int end) { // DONE if (source.isnonempty()) { if (start != end) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); + final int i = start + (end - start) / 2; + final Bin left = new Bin(); + final Bin right = new Bin(); split(source, left, right, 0, spbrkpts.pts[i]); splitInS(left, start, i); @@ -329,15 +329,15 @@ public class Subdivider { * @param start * @param end */ - private void splitInT(Bin source, int start, int end) { + private void splitInT(final Bin source, final int start, final int end) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.splitint"); if (source.isnonempty()) { if (start != end) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); + final int i = start + (end - start) / 2; + final Bin left = new Bin(); + final Bin right = new Bin(); split(source, left, right, 1, tpbrkpts.pts[i + 1]); splitInT(left, start, i); splitInT(right, i + 1, end); @@ -352,8 +352,8 @@ public class Subdivider { setArcTypeBezier(); setDegenerate(); - float[] pta = new float[2]; - float[] ptb = new float[2]; + final float[] pta = new float[2]; + final float[] ptb = new float[2]; pta[0] = spbrkpts.pts[s_index - 1]; pta[1] = tpbrkpts.pts[t_index - 1]; @@ -362,7 +362,7 @@ public class Subdivider { ptb[1] = tpbrkpts.pts[t_index]; qlist.downloadAll(pta, ptb, backend); - Patchlist patchlist = new Patchlist(qlist, pta, ptb); + final Patchlist patchlist = new Patchlist(qlist, pta, ptb); samplingSplit(source, patchlist, renderhints.maxsubdivisions, 0); @@ -381,8 +381,8 @@ public class Subdivider { * @param subdivisions * @param param */ - private void samplingSplit(Bin source, Patchlist patchlist, - int subdivisions, int param) { + private void samplingSplit(final Bin source, final Patchlist patchlist, + final int subdivisions, int param) { // DONE if (!source.isnonempty()) return; @@ -408,13 +408,13 @@ public class Subdivider { else param = 1 - param; - Bin left = new Bin(); - Bin right = new Bin(); + final Bin left = new Bin(); + final Bin right = new Bin(); - float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); + final float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); split(source, left, right, param, mid); - Patchlist subpatchlist = new Patchlist(patchlist, param, mid); + final Patchlist subpatchlist = new Patchlist(patchlist, param, mid); samplingSplit(left, subpatchlist, subdivisions - 1, param); samplingSplit(right, subpatchlist, subdivisions - 1, param); } else { @@ -433,18 +433,18 @@ public class Subdivider { * @param subdivisions * @param param */ - private void nonSamplingSplit(Bin source, Patchlist patchlist, - int subdivisions, int param) { + private void nonSamplingSplit(final Bin source, final Patchlist patchlist, + final int subdivisions, int param) { // DONE if (patchlist.needsNonSamplingSubdivision() && subdivisions > 0) { param = 1 - param; - Bin left = new Bin(); - Bin right = new Bin(); + final Bin left = new Bin(); + final Bin right = new Bin(); - float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); + final float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); split(source, left, right, param, mid); - Patchlist subpatchlist = new Patchlist(patchlist, param, mid); + final Patchlist subpatchlist = new Patchlist(patchlist, param, mid); if (left.isnonempty()) { if (subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT) freejarcs(left); @@ -483,7 +483,7 @@ public class Subdivider { * @param start * @param end */ - private void monosplitInS(Bin source, int start, int end) { + private void monosplitInS(final Bin source, final int start, final int end) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.monosplitins"); } @@ -492,7 +492,7 @@ public class Subdivider { * Not used * @param source */ - private void findIrregularS(Bin source) { + private void findIrregularS(final Bin source) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.findIrregularS"); } @@ -510,7 +510,7 @@ public class Subdivider { * @param source * @param patchlist */ - private void tesselation(Bin source, Patchlist patchlist) { + private void tesselation(final Bin source, final Patchlist patchlist) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.tesselation"); } @@ -531,19 +531,19 @@ public class Subdivider { * @param param * @param value */ - private void split(Bin bin, Bin left, Bin right, int param, float value) { + private void split(final Bin bin, final Bin left, final Bin right, final int param, final float value) { // DONE - Bin intersections = new Bin(); - Bin unknown = new Bin(); + final Bin intersections = new Bin(); + final Bin unknown = new Bin(); partition(bin, left, intersections, right, unknown, param, value); - int count = intersections.numarcs(); + final int count = intersections.numarcs(); // TODO jumpbuffer ?? if (count % 2 == 0) { - Arc[] arclist = new Arc[MAXARCS]; + final Arc[] arclist = new Arc[MAXARCS]; CArrayOfArcs list; if (count >= MAXARCS) { list = new CArrayOfArcs(new Arc[count]); @@ -559,7 +559,7 @@ public class Subdivider { last.set(jarc); if (param == 0) {// sort into incrasing t order - ArcSdirSorter sorter = new ArcSdirSorter(this); + final ArcSdirSorter sorter = new ArcSdirSorter(this); sorter.qsort(list, count); for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last @@ -578,7 +578,7 @@ public class Subdivider { } } else {// sort into decreasing s order - ArcTdirSorter sorter = new ArcTdirSorter(this); + final ArcTdirSorter sorter = new ArcTdirSorter(this); sorter.qsort(list, count); for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last @@ -609,7 +609,7 @@ public class Subdivider { * @param arc * @param relative */ - private void join_t(Bin left, Bin right, Arc arc, Arc relative) { + private void join_t(final Bin left, final Bin right, final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.join_t"); } @@ -619,7 +619,7 @@ public class Subdivider { * @param arc * @param relative */ - private void check_t(Arc arc, Arc relative) { + private void check_t(final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.check_t"); } @@ -631,22 +631,22 @@ public class Subdivider { * @param jarc1 * @param jarc2 */ - private void join_s(Bin left, Bin right, Arc jarc1, Arc jarc2) { + private void join_s(final Bin left, final Bin right, Arc jarc1, Arc jarc2) { // DONE if (!jarc1.getitail()) jarc1 = jarc1.next; if (!jarc2.getitail()) jarc2 = jarc2.next; - float s = jarc1.tail()[0]; - float t1 = jarc1.tail()[1]; - float t2 = jarc2.tail()[1]; + final float s = jarc1.tail()[0]; + final float t1 = jarc1.tail()[1]; + final float t2 = jarc2.tail()[1]; if (t1 == t2) { simplelink(jarc1, jarc2); } else { - Arc newright = new Arc(Arc.ARC_RIGHT); - Arc newleft = new Arc(Arc.ARC_LEFT); + final Arc newright = new Arc(Arc.ARC_RIGHT); + final Arc newleft = new Arc(Arc.ARC_LEFT); if (isBezierArcType()) { arctesselator.bezier(newright, s, s, t1, t2); arctesselator.bezier(newleft, s, s, t2, t1); @@ -668,7 +668,7 @@ public class Subdivider { * @param newright * @param newleft */ - private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) { + private void link(final Arc jarc1, final Arc jarc2, final Arc newright, final Arc newleft) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.link"); } @@ -688,7 +688,7 @@ public class Subdivider { * @param jarc1 * @param jarc2 */ - private void simplelink(Arc jarc1, Arc jarc2) { + private void simplelink(final Arc jarc1, final Arc jarc2) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.simplelink"); } @@ -698,7 +698,7 @@ public class Subdivider { * @param arc * @param relative */ - private void check_s(Arc arc, Arc relative) { + private void check_s(final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.check_s"); @@ -714,17 +714,17 @@ public class Subdivider { * @param param * @param value */ - private void partition(Bin bin, Bin left, Bin intersections, Bin right, - Bin unknown, int param, float value) { + private void partition(final Bin bin, final Bin left, final Bin intersections, final Bin right, + final Bin unknown, final int param, final float value) { - Bin headonleft = new Bin(); - Bin headonright = new Bin(); - Bin tailonleft = new Bin(); - Bin tailonright = new Bin(); + final Bin headonleft = new Bin(); + final Bin headonright = new Bin(); + final Bin tailonleft = new Bin(); + final Bin tailonright = new Bin(); for (Arc jarc = bin.removearc(); jarc != null; jarc = bin.removearc()) { - float tdiff = jarc.tail()[param] - value; - float hdiff = jarc.head()[param] - value; + final float tdiff = jarc.tail()[param] - value; + final float hdiff = jarc.head()[param] - value; if (tdiff > 0) { if (hdiff > 0) { @@ -732,7 +732,7 @@ public class Subdivider { } else if (hdiff == 0) { tailonright.addarc(jarc); } else { - Arc jtemp; + final Arc jtemp; switch (arc_split(jarc, param, value, 0)) { case 2: tailonright.addarc(jarc); @@ -785,8 +785,8 @@ public class Subdivider { * @param right * @param value */ - private void classify_tailonright_t(Bin tailonright, Bin intersections, - Bin right, float value) { + private void classify_tailonright_t(final Bin tailonright, final Bin intersections, + final Bin right, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_tailonright_t"); @@ -799,14 +799,14 @@ public class Subdivider { * @param out * @param val */ - private void classify_tailonleft_s(Bin bin, Bin in, Bin out, float val) { + private void classify_tailonleft_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.clearitail(); - float diff = j.next.head()[0] - val; + final float diff = j.next.head()[0] - val; if (diff > 0) { in.addarc(j); } else if (diff < 0) { @@ -831,13 +831,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonright_s(Bin bin, Bin in, Bin out, float val) { + private void classify_headonright_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[0] - val; + final float diff = j.prev.tail()[0] - val; if (diff > 0) { if (ccwTurn_sr(j.prev, j)) out.addarc(j); @@ -860,7 +860,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_sr(Arc prev, Arc j) { + private boolean ccwTurn_sr(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO ccwTurn_sr"); return false; @@ -873,8 +873,8 @@ public class Subdivider { * @param right * @param value */ - private void classify_headonright_t(Bin headonright, Bin intersections, - Bin right, float value) { + private void classify_headonright_t(final Bin headonright, final Bin intersections, + final Bin right, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_headonright_t"); } @@ -886,8 +886,8 @@ public class Subdivider { * @param left * @param value */ - private void classify_tailonleft_t(Bin tailonleft, Bin intersections, - Bin left, float value) { + private void classify_tailonleft_t(final Bin tailonleft, final Bin intersections, + final Bin left, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_tailonleft_t"); } @@ -899,13 +899,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonleft_t(Bin bin, Bin in, Bin out, float val) { + private void classify_headonleft_t(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[1] - val; + final float diff = j.prev.tail()[1] - val; if (diff > 0) { out.addarc(j); } else if (diff < 0) { @@ -928,7 +928,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_tl(Arc prev, Arc j) { + private boolean ccwTurn_tl(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.ccwTurn_tl"); return false; @@ -941,13 +941,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_tailonright_s(Bin bin, Bin in, Bin out, float val) { + private void classify_tailonright_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.clearitail(); - float diff = j.next.head()[0] - val; + final float diff = j.next.head()[0] - val; if (diff > 0) { if (ccwTurn_sr(j, j.next)) out.addarc(j); @@ -972,13 +972,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonleft_s(Bin bin, Bin in, Bin out, float val) { + private void classify_headonleft_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[0] - val; + final float diff = j.prev.tail()[0] - val; if (diff > 0) { out.addarc(j); } else if (diff < 0) { @@ -1002,7 +1002,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_sl(Arc prev, Arc j) { + private boolean ccwTurn_sl(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.ccwTurn_sl"); return false; @@ -1016,7 +1016,7 @@ public class Subdivider { * @param i * @return 0 */ - private int arc_split(Arc jarc, int param, float value, int i) { + private int arc_split(final Arc jarc, final int param, final float value, final int i) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.arc_split"); return 0; @@ -1043,7 +1043,7 @@ public class Subdivider { * Not used * @param source */ - private void outline(Bin source) { + private void outline(final Bin source) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.outline"); } @@ -1053,13 +1053,13 @@ public class Subdivider { * @param from range beginnings * @param to range ends */ - private void makeBorderTrim(float[] from, float[] to) { + private void makeBorderTrim(final float[] from, final float[] to) { // DONE - float smin = from[0]; - float smax = to[0]; + final float smin = from[0]; + final float smax = to[0]; - float tmin = from[1]; - float tmax = to[1]; + final float tmin = from[1]; + final float tmax = to[1]; pjarc = null; Arc jarc = null; @@ -1092,10 +1092,10 @@ public class Subdivider { */ public void drawCurves() { // DONE - float[] from = new float[1]; - float[] to = new float[1]; + final float[] from = new float[1]; + final float[] to = new float[1]; - Flist bpts = new Flist(); + final Flist bpts = new Flist(); qlist.getRange(from, to, bpts); renderhints.init(); @@ -1103,13 +1103,13 @@ public class Subdivider { backend.bgncurv(); for (int i = bpts.start; i < bpts.end - 1; i++) { - float[] pta = new float[1]; - float[] ptb = new float[1]; + final float[] pta = new float[1]; + final float[] ptb = new float[1]; pta[0] = bpts.pts[i]; ptb[0] = bpts.pts[i + 1]; qlist.downloadAll(pta, ptb, backend); - Curvelist curvelist = new Curvelist(qlist, pta, ptb); + final Curvelist curvelist = new Curvelist(qlist, pta, ptb); samplingSplit(curvelist, renderhints.maxsubdivisions); } backend.endcurv(); @@ -1120,7 +1120,7 @@ public class Subdivider { * @param curvelist list of curves * @param maxsubdivisions maximum number of subdivisions */ - private void samplingSplit(Curvelist curvelist, int maxsubdivisions) { + private void samplingSplit(final Curvelist curvelist, final int maxsubdivisions) { if (curvelist.cullCheck() == CULL_TRIVIAL_REJECT) return; @@ -1130,7 +1130,7 @@ public class Subdivider { // TODO kód // System.out.println("TODO subdivider-needsSamplingSubdivision"); } else { - int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); + final int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); backend.curvgrid(curvelist.range[0], curvelist.range[1], nu); backend.curvmesh(0, nu); } @@ -1142,7 +1142,7 @@ public class Subdivider { * @param d new domain_distance_u_rate value */ - public void set_domain_distance_u_rate(double d) { + public void set_domain_distance_u_rate(final double d) { // DONE domain_distance_u_rate = (float) d; } @@ -1151,7 +1151,7 @@ public class Subdivider { * Sets new domain_distance_v_rate value * @param d new domain_distance_v_rate value */ - public void set_domain_distance_v_rate(double d) { + public void set_domain_distance_v_rate(final double d) { // DONE domain_distance_v_rate = (float) d; } @@ -1160,7 +1160,7 @@ public class Subdivider { * Sets new is_domain_distance_sampling value * @param i new is_domain_distance_sampling value */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE this.is_domain_distance_sampling = i; } diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java index 9c8523e51..5cae679a2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java +++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java @@ -56,7 +56,7 @@ public class Registry { public Registry() { } - public static String gluGetString(int name) { + public static String gluGetString(final int name) { if( name == GLU.GLU_VERSION ) { return( "1.3" ); } else if( name == GLU.GLU_EXTENSIONS ) { @@ -65,7 +65,7 @@ public class Registry { return( null ); } - public static boolean gluCheckExtension( String extName, String extString ) { + public static boolean gluCheckExtension( final String extName, final String extString ) { if( extName == null || extString == null ) { return( false ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java index 3ac9df67a..3bb759359 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java @@ -60,8 +60,8 @@ class Dict { private Dict() { } - static Dict dictNewDict(Object frame, DictLeq leq) { - Dict dict = new Dict(); + static Dict dictNewDict(final Object frame, final DictLeq leq) { + final Dict dict = new Dict(); dict.head = new DictNode(); dict.head.key = null; @@ -74,22 +74,22 @@ class Dict { return dict; } - static void dictDeleteDict(Dict dict) { + static void dictDeleteDict(final Dict dict) { dict.head = null; dict.frame = null; dict.leq = null; } - static DictNode dictInsert(Dict dict, Object key) { + static DictNode dictInsert(final Dict dict, final Object key) { return dictInsertBefore(dict, dict.head, key); } - static DictNode dictInsertBefore(Dict dict, DictNode node, Object key) { + static DictNode dictInsertBefore(final Dict dict, DictNode node, final Object key) { do { node = node.prev; } while (node.key != null && !dict.leq.leq(dict.frame, node.key, key)); - DictNode newNode = new DictNode(); + final DictNode newNode = new DictNode(); newNode.key = key; newNode.next = node.next; node.next.prev = newNode; @@ -99,32 +99,32 @@ class Dict { return newNode; } - static Object dictKey(DictNode aNode) { + static Object dictKey(final DictNode aNode) { return aNode.key; } - static DictNode dictSucc(DictNode aNode) { + static DictNode dictSucc(final DictNode aNode) { return aNode.next; } - static DictNode dictPred(DictNode aNode) { + static DictNode dictPred(final DictNode aNode) { return aNode.prev; } - static DictNode dictMin(Dict aDict) { + static DictNode dictMin(final Dict aDict) { return aDict.head.next; } - static DictNode dictMax(Dict aDict) { + static DictNode dictMax(final Dict aDict) { return aDict.head.prev; } - static void dictDelete(Dict dict, DictNode node) { + static void dictDelete(final Dict dict, final DictNode node) { node.next.prev = node.prev; node.prev.next = node.next; } - static DictNode dictSearch(Dict dict, Object key) { + static DictNode dictSearch(final Dict dict, final Object key) { DictNode node = dict.head; do { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java index 29944f9b2..a849058c8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java @@ -65,7 +65,7 @@ class GLUhalfEdge { public int winding; /* change in winding number when crossing */ public boolean first; - public GLUhalfEdge(boolean first) { + public GLUhalfEdge(final boolean first) { this.first = first; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java index d594cb3eb..6f89a95f2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java @@ -177,11 +177,11 @@ public class GLUtessellatorImpl implements GLUtessellator { mesh = null; } - private void requireState(int newState) { + private void requireState(final int newState) { if (state != newState) gotoState(newState); } - private void gotoState(int newState) { + private void gotoState(final int newState) { while (state != newState) { /* We change the current state one level at a time, to get to * the desired state. @@ -211,7 +211,7 @@ public class GLUtessellatorImpl implements GLUtessellator { requireState(TessState.T_DORMANT); } - public void gluTessProperty(int which, double value) { + public void gluTessProperty(final int which, final double value) { switch (which) { case GLU.GLU_TESS_TOLERANCE: if (value < 0.0 || value > 1.0) break; @@ -219,7 +219,7 @@ public class GLUtessellatorImpl implements GLUtessellator { return; case GLU.GLU_TESS_WINDING_RULE: - int windingRule = (int) value; + final int windingRule = (int) value; if (windingRule != value) break; /* not an integer */ switch (windingRule) { @@ -250,7 +250,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } /* Returns tessellator property */ - public void gluGetTessProperty(int which, double[] value, int value_offset) { + public void gluGetTessProperty(final int which, final double[] value, final int value_offset) { switch (which) { case GLU.GLU_TESS_TOLERANCE: /* tolerance should be in range [0..1] */ @@ -279,13 +279,13 @@ public class GLUtessellatorImpl implements GLUtessellator { } } /* gluGetTessProperty() */ - public void gluTessNormal(double x, double y, double z) { + public void gluTessNormal(final double x, final double y, final double z) { normal[0] = x; normal[1] = y; normal[2] = z; } - public void gluTessCallback(int which, GLUtessellatorCallback aCallback) { + public void gluTessCallback(final int which, final GLUtessellatorCallback aCallback) { switch (which) { case GLU.GLU_TESS_BEGIN: callBegin = aCallback == null ? NULL_CB : aCallback; @@ -340,7 +340,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } } - private boolean addVertex(double[] coords, Object vertexData) { + private boolean addVertex(final double[] coords, final Object vertexData) { GLUhalfEdge e; e = lastEdge; @@ -377,12 +377,12 @@ public class GLUtessellatorImpl implements GLUtessellator { return true; } - private void cacheVertex(double[] coords, Object vertexData) { + private void cacheVertex(final double[] coords, final Object vertexData) { if (cache[cacheCount] == null) { cache[cacheCount] = new CachedVertex(); } - CachedVertex v = cache[cacheCount]; + final CachedVertex v = cache[cacheCount]; v.data = vertexData; v.coords[0] = coords[0]; @@ -393,13 +393,13 @@ public class GLUtessellatorImpl implements GLUtessellator { private boolean flushCache() { - CachedVertex[] v = cache; + final CachedVertex[] v = cache; mesh = Mesh.__gl_meshNewMesh(); if (mesh == null) return false; for (int i = 0; i < cacheCount; i++) { - CachedVertex vertex = v[i]; + final CachedVertex vertex = v[i]; if (!addVertex(vertex.coords, vertex.data)) return false; } cacheCount = 0; @@ -408,11 +408,11 @@ public class GLUtessellatorImpl implements GLUtessellator { return true; } - public void gluTessVertex(double[] coords, int coords_offset, Object vertexData) { + public void gluTessVertex(final double[] coords, final int coords_offset, final Object vertexData) { int i; boolean tooLarge = false; double x; - double[] clamped = new double[3]; + final double[] clamped = new double[3]; requireState(TessState.T_IN_CONTOUR); @@ -456,7 +456,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } - public void gluTessBeginPolygon(Object data) { + public void gluTessBeginPolygon(final Object data) { requireState(TessState.T_DORMANT); state = TessState.T_IN_POLYGON; @@ -573,7 +573,7 @@ public class GLUtessellatorImpl implements GLUtessellator { Mesh.__gl_meshDeleteMesh(mesh); polygonData = null; mesh = null; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); } @@ -590,7 +590,7 @@ public class GLUtessellatorImpl implements GLUtessellator { /*ARGSUSED*/ - public void gluNextContour(int type) { + public void gluNextContour(final int type) { gluTessEndContour(); gluTessBeginContour(); } @@ -601,21 +601,21 @@ public class GLUtessellatorImpl implements GLUtessellator { gluTessEndPolygon(); } - void callBeginOrBeginData(int a) { + void callBeginOrBeginData(final int a) { if (callBeginData != NULL_CB) callBeginData.beginData(a, polygonData); else callBegin.begin(a); } - void callVertexOrVertexData(Object a) { + void callVertexOrVertexData(final Object a) { if (callVertexData != NULL_CB) callVertexData.vertexData(a, polygonData); else callVertex.vertex(a); } - void callEdgeFlagOrEdgeFlagData(boolean a) { + void callEdgeFlagOrEdgeFlagData(final boolean a) { if (callEdgeFlagData != NULL_CB) callEdgeFlagData.edgeFlagData(a, polygonData); else @@ -629,14 +629,14 @@ public class GLUtessellatorImpl implements GLUtessellator { callEnd.end(); } - void callCombineOrCombineData(double[] coords, Object[] vertexData, float[] weights, Object[] outData) { + void callCombineOrCombineData(final double[] coords, final Object[] vertexData, final float[] weights, final Object[] outData) { if (callCombineData != NULL_CB) callCombineData.combineData(coords, vertexData, weights, outData, polygonData); else callCombine.combine(coords, vertexData, weights, outData); } - void callErrorOrErrorData(int a) { + void callErrorOrErrorData(final int a) { if (callErrorData != NULL_CB) callErrorData.errorData(a, polygonData); else diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java index 3da2d267e..493052f79 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java @@ -66,7 +66,7 @@ class Geom { * let r be the negated result (this evaluates (uw)(v->s)), then * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). */ - static double EdgeEval(GLUvertex u, GLUvertex v, GLUvertex w) { + static double EdgeEval(final GLUvertex u, final GLUvertex v, final GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); @@ -85,7 +85,7 @@ class Geom { return 0; } - static double EdgeSign(GLUvertex u, GLUvertex v, GLUvertex w) { + static double EdgeSign(final GLUvertex u, final GLUvertex v, final GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); @@ -105,7 +105,7 @@ class Geom { * Define versions of EdgeSign, EdgeEval with s and t transposed. */ - static double TransEval(GLUvertex u, GLUvertex v, GLUvertex w) { + static double TransEval(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), * evaluates the t-coord of the edge uw at the s-coord of the vertex v. * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. @@ -134,7 +134,7 @@ class Geom { return 0; } - static double TransSign(GLUvertex u, GLUvertex v, GLUvertex w) { + static double TransSign(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* Returns a number whose sign matches TransEval(u,v,w) but which * is cheaper to evaluate. Returns > 0, == 0 , or < 0 * as v is above, on, or below the edge uw. @@ -154,7 +154,7 @@ class Geom { } - static boolean VertCCW(GLUvertex u, GLUvertex v, GLUvertex w) { + static boolean VertCCW(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* For almost-degenerate situations, the results are not reliable. * Unless the floating-point arithmetic can be performed without * rounding errors, *any* implementation will give incorrect results @@ -172,7 +172,7 @@ class Geom { * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate * even when a and b differ greatly in magnitude. */ - static double Interpolate(double a, double x, double b, double y) { + static double Interpolate(double a, final double x, double b, final double y) { a = (a < 0) ? 0 : a; b = (b < 0) ? 0 : b; if (a <= b) { @@ -188,7 +188,7 @@ class Geom { static void EdgeIntersect(GLUvertex o1, GLUvertex d1, GLUvertex o2, GLUvertex d2, - GLUvertex v) + final GLUvertex v) /* Given edges (o1,d1) and (o2,d2), compute their point of intersection. * The computed point is guaranteed to lie in the intersection of the * bounding rectangles defined by each edge. @@ -204,12 +204,12 @@ class Geom { */ if (!VertLeq(o1, d1)) { - GLUvertex temp = o1; + final GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!VertLeq(o2, d2)) { - GLUvertex temp = o2; + final GLUvertex temp = o2; o2 = d2; d2 = temp; } @@ -248,12 +248,12 @@ class Geom { /* Now repeat the process for t */ if (!TransLeq(o1, d1)) { - GLUvertex temp = o1; + final GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!TransLeq(o2, d2)) { - GLUvertex temp = o2; + final GLUvertex temp = o2; o2 = d2; d2 = temp; } @@ -290,29 +290,29 @@ class Geom { } } - static boolean VertEq(GLUvertex u, GLUvertex v) { + static boolean VertEq(final GLUvertex u, final GLUvertex v) { return u.s == v.s && u.t == v.t; } - static boolean VertLeq(GLUvertex u, GLUvertex v) { + static boolean VertLeq(final GLUvertex u, final GLUvertex v) { return u.s < v.s || (u.s == v.s && u.t <= v.t); } /* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ - static boolean TransLeq(GLUvertex u, GLUvertex v) { + static boolean TransLeq(final GLUvertex u, final GLUvertex v) { return u.t < v.t || (u.t == v.t && u.s <= v.s); } - static boolean EdgeGoesLeft(GLUhalfEdge e) { + static boolean EdgeGoesLeft(final GLUhalfEdge e) { return VertLeq(e.Sym.Org, e.Org); } - static boolean EdgeGoesRight(GLUhalfEdge e) { + static boolean EdgeGoesRight(final GLUhalfEdge e) { return VertLeq(e.Org, e.Sym.Org); } - static double VertL1dist(GLUvertex u, GLUvertex v) { + static double VertL1dist(final GLUvertex u, final GLUvertex v) { return Math.abs(u.s - v.s) + Math.abs(u.t - v.t); } @@ -320,13 +320,13 @@ class Geom { // Compute the cosine of the angle between the edges between o and // v1 and between o and v2 - static double EdgeCos(GLUvertex o, GLUvertex v1, GLUvertex v2) { - double ov1s = v1.s - o.s; - double ov1t = v1.t - o.t; - double ov2s = v2.s - o.s; - double ov2t = v2.t - o.t; + static double EdgeCos(final GLUvertex o, final GLUvertex v1, final GLUvertex v2) { + final double ov1s = v1.s - o.s; + final double ov1t = v1.t - o.t; + final double ov2s = v2.s - o.s; + final double ov2t = v2.t - o.t; double dotp = ov1s * ov2s + ov1t * ov2t; - double len = Math.sqrt(ov1s * ov1s + ov1t * ov1t) * Math.sqrt(ov2s * ov2s + ov2t * ov2t); + final double len = Math.sqrt(ov1s * ov1s + ov1t * ov1t) * Math.sqrt(ov2s * ov2s + ov2t * ov2t); if (len > 0.0) { dotp /= len; } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java index eb48aa5a4..e855a5531 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java @@ -115,9 +115,9 @@ class Mesh { * depending on whether a and b belong to different face or vertex rings. * For more explanation see __gl_meshSplice() below. */ - static void Splice(jogamp.opengl.glu.tessellator.GLUhalfEdge a, jogamp.opengl.glu.tessellator.GLUhalfEdge b) { - jogamp.opengl.glu.tessellator.GLUhalfEdge aOnext = a.Onext; - jogamp.opengl.glu.tessellator.GLUhalfEdge bOnext = b.Onext; + static void Splice(final jogamp.opengl.glu.tessellator.GLUhalfEdge a, final jogamp.opengl.glu.tessellator.GLUhalfEdge b) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge aOnext = a.Onext; + final jogamp.opengl.glu.tessellator.GLUhalfEdge bOnext = b.Onext; aOnext.Sym.Lnext = b; bOnext.Sym.Lnext = a; @@ -131,11 +131,11 @@ class Mesh { * the new vertex *before* vNext so that algorithms which walk the vertex * list will not see the newly created vertices. */ - static void MakeVertex(jogamp.opengl.glu.tessellator.GLUvertex newVertex, - jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, jogamp.opengl.glu.tessellator.GLUvertex vNext) { + static void MakeVertex(final jogamp.opengl.glu.tessellator.GLUvertex newVertex, + final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, final jogamp.opengl.glu.tessellator.GLUvertex vNext) { jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUvertex vPrev; - jogamp.opengl.glu.tessellator.GLUvertex vNew = newVertex; + final jogamp.opengl.glu.tessellator.GLUvertex vNew = newVertex; assert (vNew != null); @@ -164,10 +164,10 @@ class Mesh { * the new face *before* fNext so that algorithms which walk the face * list will not see the newly created faces. */ - static void MakeFace(jogamp.opengl.glu.tessellator.GLUface newFace, jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, jogamp.opengl.glu.tessellator.GLUface fNext) { + static void MakeFace(final jogamp.opengl.glu.tessellator.GLUface newFace, final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, final jogamp.opengl.glu.tessellator.GLUface fNext) { jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUface fPrev; - jogamp.opengl.glu.tessellator.GLUface fNew = newFace; + final jogamp.opengl.glu.tessellator.GLUface fNew = newFace; assert (fNew != null); @@ -218,8 +218,9 @@ class Mesh { /* KillVertex( vDel ) destroys a vertex and removes it from the global * vertex list. It updates the vertex loop to point to a given new vertex. */ - static void KillVertex(jogamp.opengl.glu.tessellator.GLUvertex vDel, jogamp.opengl.glu.tessellator.GLUvertex newOrg) { - jogamp.opengl.glu.tessellator.GLUhalfEdge e, eStart = vDel.anEdge; + static void KillVertex(final jogamp.opengl.glu.tessellator.GLUvertex vDel, final jogamp.opengl.glu.tessellator.GLUvertex newOrg) { + jogamp.opengl.glu.tessellator.GLUhalfEdge e; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = vDel.anEdge; jogamp.opengl.glu.tessellator.GLUvertex vPrev, vNext; /* change the origin of all affected edges */ @@ -239,8 +240,9 @@ class Mesh { /* KillFace( fDel ) destroys a face and removes it from the global face * list. It updates the face loop to point to a given new face. */ - static void KillFace(jogamp.opengl.glu.tessellator.GLUface fDel, jogamp.opengl.glu.tessellator.GLUface newLface) { - jogamp.opengl.glu.tessellator.GLUhalfEdge e, eStart = fDel.anEdge; + static void KillFace(final jogamp.opengl.glu.tessellator.GLUface fDel, final jogamp.opengl.glu.tessellator.GLUface newLface) { + jogamp.opengl.glu.tessellator.GLUhalfEdge e; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fDel.anEdge; jogamp.opengl.glu.tessellator.GLUface fPrev, fNext; /* change the left face of all affected edges */ @@ -263,10 +265,10 @@ class Mesh { /* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). * The loop consists of the two new half-edges. */ - public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUvertex newVertex1 = new jogamp.opengl.glu.tessellator.GLUvertex(); - jogamp.opengl.glu.tessellator.GLUvertex newVertex2 = new jogamp.opengl.glu.tessellator.GLUvertex(); - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUvertex newVertex1 = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex2 = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); jogamp.opengl.glu.tessellator.GLUhalfEdge e; e = MakeEdge(mesh.eHead); @@ -302,7 +304,7 @@ class Mesh { * If eDst == eOrg->Onext, the new vertex will have a single edge. * If eDst == eOrg->Oprev, the old vertex will have a single edge. */ - public static boolean __gl_meshSplice(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { + public static boolean __gl_meshSplice(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, final jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { boolean joiningLoops = false; boolean joiningVertices = false; @@ -323,7 +325,7 @@ class Mesh { Splice(eDst, eOrg); if (!joiningVertices) { - jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); /* We split one vertex into two -- the new vertex is eDst.Org. * Make sure the old vertex points to a valid half-edge. @@ -332,7 +334,7 @@ class Mesh { eOrg.Org.anEdge = eOrg; } if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We split one loop into two -- the new loop is eDst.Lface. * Make sure the old face points to a valid half-edge. @@ -355,8 +357,8 @@ class Mesh { * plus a few calls to memFree, but this would allocate and delete * unnecessary vertices and faces. */ - static boolean __gl_meshDelete(jogamp.opengl.glu.tessellator.GLUhalfEdge eDel) { - jogamp.opengl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym; + static boolean __gl_meshDelete(final jogamp.opengl.glu.tessellator.GLUhalfEdge eDel) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym; boolean joiningLoops = false; /* First step: disconnect the origin vertex eDel.Org. We make all @@ -377,7 +379,7 @@ class Mesh { Splice(eDel, eDel.Sym.Lnext); if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We are splitting one loop into two -- create a new loop for eDel. */ MakeFace(newFace, eDel, eDel.Lface); @@ -415,9 +417,9 @@ class Mesh { * eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex. * eOrg and eNew will have the same left face. */ - static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { + static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNewSym; - jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; @@ -427,7 +429,7 @@ class Mesh { /* Set the vertex and face information */ eNew.Org = eOrg.Sym.Org; { - jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); MakeVertex(newVertex, eNewSym, eNew.Org); } @@ -441,9 +443,9 @@ class Mesh { * such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org. * eOrg and eNew will have the same left face. */ - public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { + public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNew; - jogamp.opengl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); eNew = tempHalfEdge.Sym; @@ -472,10 +474,10 @@ class Mesh { * If (eOrg.Lnext == eDst), the old face is reduced to a single edge. * If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges. */ - static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshConnect(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { + static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshConnect(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, final jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNewSym; boolean joiningLoops = false; - jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; @@ -498,7 +500,7 @@ class Mesh { eOrg.Lface.anEdge = eNewSym; if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We split one loop into two -- the new loop is eNew.Lface */ MakeFace(newFace, eNew, eOrg.Lface); @@ -516,8 +518,8 @@ class Mesh { * An entire mesh can be deleted by zapping its faces, one at a time, * in any order. Zapped faces cannot be used in further mesh operations! */ - static void __gl_meshZapFace(jogamp.opengl.glu.tessellator.GLUface fZap) { - jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge; + static void __gl_meshZapFace(final jogamp.opengl.glu.tessellator.GLUface fZap) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eNext, eSym; jogamp.opengl.glu.tessellator.GLUface fPrev, fNext; @@ -566,7 +568,7 @@ class Mesh { jogamp.opengl.glu.tessellator.GLUface f; jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUhalfEdge eSym; - jogamp.opengl.glu.tessellator.GLUmesh mesh = new jogamp.opengl.glu.tessellator.GLUmesh(); + final jogamp.opengl.glu.tessellator.GLUmesh mesh = new jogamp.opengl.glu.tessellator.GLUmesh(); v = mesh.vHead; f = mesh.fHead; @@ -609,13 +611,13 @@ class Mesh { /* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in * both meshes, and returns the new mesh (the old meshes are destroyed). */ - static jogamp.opengl.glu.tessellator.GLUmesh __gl_meshUnion(jogamp.opengl.glu.tessellator.GLUmesh mesh1, jogamp.opengl.glu.tessellator.GLUmesh mesh2) { - jogamp.opengl.glu.tessellator.GLUface f1 = mesh1.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v1 = mesh1.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead; - jogamp.opengl.glu.tessellator.GLUface f2 = mesh2.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v2 = mesh2.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead; + static jogamp.opengl.glu.tessellator.GLUmesh __gl_meshUnion(final jogamp.opengl.glu.tessellator.GLUmesh mesh1, final jogamp.opengl.glu.tessellator.GLUmesh mesh2) { + final jogamp.opengl.glu.tessellator.GLUface f1 = mesh1.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex v1 = mesh1.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead; + final jogamp.opengl.glu.tessellator.GLUface f2 = mesh2.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex v2 = mesh2.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead; /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ if (f2.next != f2) { @@ -645,8 +647,8 @@ class Mesh { /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ - static void __gl_meshDeleteMeshZap(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; + static void __gl_meshDeleteMeshZap(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; while (fHead.next != fHead) { __gl_meshZapFace(fHead.next); @@ -656,7 +658,7 @@ class Mesh { /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ - public static void __gl_meshDeleteMesh(jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_meshDeleteMesh(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f, fNext; jogamp.opengl.glu.tessellator.GLUvertex v, vNext; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eNext; @@ -677,10 +679,10 @@ class Mesh { /* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. */ - public static void __gl_meshCheckMesh(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; - jogamp.opengl.glu.tessellator.GLUvertex vHead = mesh.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead; + public static void __gl_meshCheckMesh(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = mesh.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead; jogamp.opengl.glu.tessellator.GLUface f, fPrev; jogamp.opengl.glu.tessellator.GLUvertex v, vPrev; jogamp.opengl.glu.tessellator.GLUhalfEdge e, ePrev; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java index 196e6cf27..44668a943 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java @@ -83,11 +83,11 @@ class Normal { } } - private static double Dot(double[] u, double[] v) { + private static double Dot(final double[] u, final double[] v) { return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]); } - static void Normalize(double[] v) { + static void Normalize(final double[] v) { double len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; assert (len > 0); @@ -97,7 +97,7 @@ class Normal { v[2] /= len; } - static int LongAxis(double[] v) { + static int LongAxis(final double[] v) { int i = 0; if (Math.abs(v[1]) > Math.abs(v[0])) { @@ -109,12 +109,12 @@ class Normal { return i; } - static void ComputeNormal(GLUtessellatorImpl tess, double[] norm) { + static void ComputeNormal(final GLUtessellatorImpl tess, final double[] norm) { jogamp.opengl.glu.tessellator.GLUvertex v, v1, v2; double c, tLen2, maxLen2; double[] maxVal, minVal, d1, d2, tNorm; jogamp.opengl.glu.tessellator.GLUvertex[] maxVert, minVert; - jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; int i; maxVal = new double[3]; @@ -192,10 +192,12 @@ class Normal { } } - static void CheckOrientation(GLUtessellatorImpl tess) { + static void CheckOrientation(final GLUtessellatorImpl tess) { double area; - jogamp.opengl.glu.tessellator.GLUface f, fHead = tess.mesh.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + jogamp.opengl.glu.tessellator.GLUface f; + final jogamp.opengl.glu.tessellator.GLUface fHead = tess.mesh.fHead; + jogamp.opengl.glu.tessellator.GLUvertex v; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; jogamp.opengl.glu.tessellator.GLUhalfEdge e; /* When we compute the normal automatically, we choose the orientation @@ -224,10 +226,11 @@ class Normal { /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ - public static void __gl_projectPolygon(GLUtessellatorImpl tess) { - jogamp.opengl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + public static void __gl_projectPolygon(final GLUtessellatorImpl tess) { + jogamp.opengl.glu.tessellator.GLUvertex v; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; double w; - double[] norm = new double[3]; + final double[] norm = new double[3]; double[] sUnit, tUnit; int i; boolean computedNormal = false; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java index 25405ad64..1f9b9e5ed 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java @@ -75,11 +75,11 @@ abstract class PriorityQ { // #else /* Violates modularity, but a little faster */ // #include "geom.h" - public static boolean LEQ(Leq leq, Object x, Object y) { + public static boolean LEQ(final Leq leq, final Object x, final Object y) { return jogamp.opengl.glu.tessellator.Geom.VertLeq((jogamp.opengl.glu.tessellator.GLUvertex) x, (jogamp.opengl.glu.tessellator.GLUvertex) y); } - static PriorityQ pqNewPriorityQ(Leq leq) { + static PriorityQ pqNewPriorityQ(final Leq leq) { return new PriorityQSort(leq); } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java index 1ac0fd438..74d981907 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java @@ -61,7 +61,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { jogamp.opengl.glu.tessellator.PriorityQ.Leq leq; /* really __gl_pqHeapNewPriorityQ */ - public PriorityQHeap(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { + public PriorityQHeap(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { size = 0; max = jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE; nodes = new jogamp.opengl.glu.tessellator.PriorityQ.PQnode[jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE + 1]; @@ -88,8 +88,8 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } void FloatDown(int curr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int hCurr, hChild; int child; @@ -117,8 +117,8 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { void FloatUp(int curr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int hCurr, hParent; int parent; @@ -155,19 +155,19 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapInsert */ /* returns LONG_MAX iff out of memory */ @Override - int pqInsert(Object keyNew) { + int pqInsert(final Object keyNew) { int curr; int free; curr = ++size; if ((curr * 2) > max) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; /* If the heap overflows, double its size. */ max <<= 1; // pq->nodes = (PQnode *)memRealloc( pq->nodes, (size_t) ((pq->max + 1) * sizeof( pq->nodes[0] ))); - PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; + final PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; System.arraycopy( nodes, 0, pqNodes, 0, nodes.length ); for (int i = nodes.length; i < pqNodes.length; i++) { pqNodes[i] = new PQnode(); @@ -179,7 +179,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } // pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); - PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; + final PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; System.arraycopy( handles, 0, pqHandles, 0, handles.length ); for (int i = handles.length; i < pqHandles.length; i++) { pqHandles[i] = new PQhandleElem(); @@ -212,10 +212,10 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapExtractMin */ @Override Object pqExtractMin() { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; - int hMin = n[1].handle; - Object min = h[hMin].key; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final int hMin = n[1].handle; + final Object min = h[hMin].key; if (size > 0) { n[1].handle = n[size].handle; @@ -234,9 +234,9 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapDelete */ @Override - void pqDelete(int hCurr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + void pqDelete(final int hCurr) { + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int curr; assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null); diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java index cf54b15c3..45e994b67 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java @@ -59,7 +59,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { boolean initialized; jogamp.opengl.glu.tessellator.PriorityQ.Leq leq; - public PriorityQSort(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { + public PriorityQSort(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { heap = new jogamp.opengl.glu.tessellator.PriorityQHeap(leq); keys = new Object[jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE]; @@ -78,17 +78,17 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { keys = null; } - private static boolean LT(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) { - return (!jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, y, x)); + private static boolean LT(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, final Object x, final Object y) { + return (!PriorityQ.LEQ(leq, y, x)); } - private static boolean GT(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) { - return (!jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, x, y)); + private static boolean GT(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, final Object x, final Object y) { + return (!PriorityQ.LEQ(leq, x, y)); } - private static void Swap(int[] array, int a, int b) { + private static void Swap(final int[] array, final int a, final int b) { if (true) { - int tmp = array[a]; + final int tmp = array[a]; array[a] = array[b]; array[b] = tmp; } else { @@ -105,7 +105,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { boolean pqInit() { int p, r, i, j; int piv; - Stack[] stack = new Stack[50]; + final Stack[] stack = new Stack[50]; for (int k = 0; k < stack.length; k++) { stack[k] = new Stack(); } @@ -194,7 +194,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqSortInsert */ /* returns LONG_MAX iff out of memory */ @Override - int pqInsert(Object keyNew) { + int pqInsert(final Object keyNew) { int curr; if (initialized) { @@ -202,12 +202,12 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { } curr = size; if (++size >= max) { - Object[] saveKey = keys; + final Object[] saveKey = keys; /* If the heap overflows, double its size. */ max <<= 1; // pq->keys = (PQHeapKey *)memRealloc( pq->keys,(size_t)(pq->max * sizeof( pq->keys[0] ))); - Object[] pqKeys = new Object[max]; + final Object[] pqKeys = new Object[max]; System.arraycopy( keys, 0, pqKeys, 0, keys.length ); keys = pqKeys; if (keys == null) { @@ -254,7 +254,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { sortMin = keys[order[size - 1]]; if (!heap.pqIsEmpty()) { heapMin = heap.pqMinimum(); - if (jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) { + if (PriorityQ.LEQ(leq, heapMin, sortMin)) { return heapMin; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java index a2e973508..6325de8d2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java @@ -73,7 +73,7 @@ class Render { public FaceCount() { } - public FaceCount(long size, jogamp.opengl.glu.tessellator.GLUhalfEdge eStart, renderCallBack render) { + public FaceCount(final long size, final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart, final renderCallBack render) { this.size = size; this.eStart = eStart; this.render = render; @@ -97,7 +97,7 @@ class Render { * * The rendering output is provided as callbacks (see the api). */ - public static void __gl_renderMesh(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_renderMesh(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f; /* Make a list of separate triangles so we can render them all at once */ @@ -124,7 +124,7 @@ class Render { } - static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface fOrig) { + static void RenderMaximumFaceGroup(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUface fOrig) { /* We want to find the largest triangle fan or strip of unmarked faces * which includes the given face fOrig. There are 3 possible fans * passing through fOrig (one centered at each vertex), and 3 possible @@ -132,7 +132,7 @@ class Render { * is to try all of these, and take the primitive which uses the most * triangles (a greedy approach). */ - jogamp.opengl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge; FaceCount max = new FaceCount(); FaceCount newFace = new FaceCount(); @@ -178,11 +178,11 @@ class Render { * more complicated, and we need a general tracking method like the * one here. */ - private static boolean Marked(jogamp.opengl.glu.tessellator.GLUface f) { + private static boolean Marked(final jogamp.opengl.glu.tessellator.GLUface f) { return !f.inside || f.marked; } - private static GLUface AddToTrail(jogamp.opengl.glu.tessellator.GLUface f, jogamp.opengl.glu.tessellator.GLUface t) { + private static GLUface AddToTrail(final jogamp.opengl.glu.tessellator.GLUface f, final jogamp.opengl.glu.tessellator.GLUface t) { f.trail = t; f.marked = true; return f; @@ -199,12 +199,12 @@ class Render { } } - static FaceCount MaximumFan(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { + static FaceCount MaximumFan(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { /* eOrig.Lface is the face we want to render. We want to find the size * of a maximal fan around eOrig.Org. To do this we just walk around * the origin vertex as far as possible in both directions. */ - FaceCount newFace = new FaceCount(0, null, renderFan); + final FaceCount newFace = new FaceCount(0, null, renderFan); jogamp.opengl.glu.tessellator.GLUface trail = null; jogamp.opengl.glu.tessellator.GLUhalfEdge e; @@ -223,11 +223,11 @@ class Render { } - private static boolean IsEven(long n) { + private static boolean IsEven(final long n) { return (n & 0x1L) == 0; } - static FaceCount MaximumStrip(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { + static FaceCount MaximumStrip(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { /* Here we are looking for a maximal strip that contains the vertices * eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the * reverse, such that all triangles are oriented CCW). @@ -238,7 +238,7 @@ class Render { * We walk the strip starting on a side with an even number of triangles; * if both side have an odd number, we are forced to shorten one side. */ - FaceCount newFace = new FaceCount(0, null, renderStrip); + final FaceCount newFace = new FaceCount(0, null, renderStrip); long headSize = 0, tailSize = 0; jogamp.opengl.glu.tessellator.GLUface trail = null; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eTail, eHead; @@ -280,7 +280,7 @@ class Render { private static class RenderTriangle implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUhalfEdge e, final long size) { /* Just add the triangle to a triangle list, so we can render all * the separate triangles at once. */ @@ -290,7 +290,7 @@ class Render { } - static void RenderLonelyTriangles(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface f) { + static void RenderLonelyTriangles(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface f) { /* Now we render all the separate triangles which could not be * grouped into a triangle fan or strip. */ @@ -325,7 +325,7 @@ class Render { private static class RenderFan implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a fan starting from * edge "e". The fan *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). @@ -348,7 +348,7 @@ class Render { private static class RenderStrip implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a strip starting from * edge "e". The strip *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). @@ -381,7 +381,7 @@ class Render { * contour for each face marked "inside". The rendering output is * provided as callbacks (see the api). */ - public static void __gl_renderBoundary(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_renderBoundary(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f; jogamp.opengl.glu.tessellator.GLUhalfEdge e; @@ -403,7 +403,7 @@ class Render { private static final int SIGN_INCONSISTENT = 2; - static int ComputeNormal(GLUtessellatorImpl tess, double[] norm, boolean check) + static int ComputeNormal(final GLUtessellatorImpl tess, final double[] norm, final boolean check) /* * If check==false, we compute the polygon normal and place it in norm[]. * If check==true, we check that each triangle in the fan from v0 has a @@ -412,13 +412,13 @@ class Render { * are degenerate return 0; otherwise (no consistent orientation) return * SIGN_INCONSISTENT. */ { - jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; + final jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; + final int vn = tess.cacheCount; // CachedVertex vc; int vc; double dot, xc, yc, zc, xp, yp, zp; - double[] n = new double[3]; + final double[] n = new double[3]; int sign = 0; /* Find the polygon normal. It is important to get a reasonable @@ -490,13 +490,13 @@ class Render { * Returns true if the polygon was successfully rendered. The rendering * output is provided as callbacks (see the api). */ - public static boolean __gl_renderCache(GLUtessellatorImpl tess) { - jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; + public static boolean __gl_renderCache(final GLUtessellatorImpl tess) { + final jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; + final int vn = tess.cacheCount; // CachedVertex vc; int vc; - double[] norm = new double[3]; + final double[] norm = new double[3]; int sign; if (tess.cacheCount < 3) { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java index d2c0db61e..9cf05378c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java @@ -62,7 +62,7 @@ class Sweep { // #ifdef FOR_TRITE_TEST_PROGRAM // extern void DebugEvent( GLUtessellator *tess ); // #else - private static void DebugEvent(GLUtessellatorImpl tess) { + private static void DebugEvent(final GLUtessellatorImpl tess) { } // #endif @@ -100,21 +100,21 @@ class Sweep { /* When we merge two edges into one, we need to compute the combined * winding of the new edge. */ - private static void AddWinding(GLUhalfEdge eDst, GLUhalfEdge eSrc) { + private static void AddWinding(final GLUhalfEdge eDst, final GLUhalfEdge eSrc) { eDst.winding += eSrc.winding; eDst.Sym.winding += eSrc.Sym.winding; } - private static ActiveRegion RegionBelow(ActiveRegion r) { + private static ActiveRegion RegionBelow(final ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictPred(r.nodeUp))); } - private static ActiveRegion RegionAbove(ActiveRegion r) { + private static ActiveRegion RegionAbove(final ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictSucc(r.nodeUp))); } - static boolean EdgeLeq(GLUtessellatorImpl tess, ActiveRegion reg1, ActiveRegion reg2) + static boolean EdgeLeq(final GLUtessellatorImpl tess, final ActiveRegion reg1, final ActiveRegion reg2) /* * Both edges must be directed from right to left (this is the canonical * direction for the upper edge of each region). @@ -126,7 +126,7 @@ class Sweep { * Special case: if both edge destinations are at the sweep event, * we sort the edges by slope (they would otherwise compare equally). */ { - GLUvertex event = tess.event; + final GLUvertex event = tess.event; GLUhalfEdge e1, e2; double t1, t2; @@ -156,7 +156,7 @@ class Sweep { } - static void DeleteRegion(GLUtessellatorImpl tess, ActiveRegion reg) { + static void DeleteRegion(final GLUtessellatorImpl tess, final ActiveRegion reg) { if (reg.fixUpperEdge) { /* It was created with zero winding number, so it better be * deleted with zero winding number (ie. it better not get merged @@ -169,7 +169,7 @@ class Sweep { } - static boolean FixUpperEdge(ActiveRegion reg, GLUhalfEdge newEdge) + static boolean FixUpperEdge(final ActiveRegion reg, final GLUhalfEdge newEdge) /* * Replace an upper edge which needs fixing (see ConnectRightVertex). */ { @@ -183,7 +183,7 @@ class Sweep { } static ActiveRegion TopLeftRegion(ActiveRegion reg) { - GLUvertex org = reg.eUp.Org; + final GLUvertex org = reg.eUp.Org; GLUhalfEdge e; /* Find the region above the uppermost edge with the same origin */ @@ -204,7 +204,7 @@ class Sweep { } static ActiveRegion TopRightRegion(ActiveRegion reg) { - GLUvertex dst = reg.eUp.Sym.Org; + final GLUvertex dst = reg.eUp.Sym.Org; /* Find the region above the uppermost edge with the same destination */ do { @@ -213,16 +213,16 @@ class Sweep { return reg; } - static ActiveRegion AddRegionBelow(GLUtessellatorImpl tess, - ActiveRegion regAbove, - GLUhalfEdge eNewUp) + static ActiveRegion AddRegionBelow(final GLUtessellatorImpl tess, + final ActiveRegion regAbove, + final GLUhalfEdge eNewUp) /* * Add a new active region to the sweep line, *somewhere* below "regAbove" * (according to where the new edge belongs in the sweep-line dictionary). * The upper edge of the new region will be "eNewUp". * Winding number and "inside" flag are not updated. */ { - ActiveRegion regNew = new ActiveRegion(); + final ActiveRegion regNew = new ActiveRegion(); if (regNew == null) throw new RuntimeException(); regNew.eUp = eNewUp; @@ -237,7 +237,7 @@ class Sweep { return regNew; } - static boolean IsWindingInside(GLUtessellatorImpl tess, int n) { + static boolean IsWindingInside(final GLUtessellatorImpl tess, final int n) { switch (tess.windingRule) { case GLU.GLU_TESS_WINDING_ODD: return (n & 1) != 0; @@ -257,13 +257,13 @@ class Sweep { } - static void ComputeWinding(GLUtessellatorImpl tess, ActiveRegion reg) { + static void ComputeWinding(final GLUtessellatorImpl tess, final ActiveRegion reg) { reg.windingNumber = RegionAbove(reg).windingNumber + reg.eUp.winding; reg.inside = IsWindingInside(tess, reg.windingNumber); } - static void FinishRegion(GLUtessellatorImpl tess, ActiveRegion reg) + static void FinishRegion(final GLUtessellatorImpl tess, final ActiveRegion reg) /* * Delete a region from the sweep line. This happens when the upper * and lower chains of a region meet (at a vertex on the sweep line). @@ -271,8 +271,8 @@ class Sweep { * not do this before -- since the structure of the mesh is always * changing, this face may not have even existed until now). */ { - GLUhalfEdge e = reg.eUp; - GLUface f = e.Lface; + final GLUhalfEdge e = reg.eUp; + final GLUface f = e.Lface; f.inside = reg.inside; f.anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ @@ -280,8 +280,8 @@ class Sweep { } - static GLUhalfEdge FinishLeftRegions(GLUtessellatorImpl tess, - ActiveRegion regFirst, ActiveRegion regLast) + static GLUhalfEdge FinishLeftRegions(final GLUtessellatorImpl tess, + final ActiveRegion regFirst, final ActiveRegion regLast) /* * We are given a vertex with one or more left-going edges. All affected * edges should be in the edge dictionary. Starting at regFirst.eUp, @@ -335,9 +335,9 @@ class Sweep { } - static void AddRightEdges(GLUtessellatorImpl tess, ActiveRegion regUp, - GLUhalfEdge eFirst, GLUhalfEdge eLast, GLUhalfEdge eTopLeft, - boolean cleanUp) + static void AddRightEdges(final GLUtessellatorImpl tess, final ActiveRegion regUp, + final GLUhalfEdge eFirst, final GLUhalfEdge eLast, GLUhalfEdge eTopLeft, + final boolean cleanUp) /* * Purpose: insert right-going edges into the edge dictionary, and update * winding numbers and mesh connectivity appropriately. All right-going @@ -406,16 +406,16 @@ class Sweep { } - static void CallCombine(GLUtessellatorImpl tess, GLUvertex isect, - Object[] data, float[] weights, boolean needed) { - double[] coords = new double[3]; + static void CallCombine(final GLUtessellatorImpl tess, final GLUvertex isect, + final Object[] data, final float[] weights, final boolean needed) { + final double[] coords = new double[3]; /* Copy coord data in case the callback changes it. */ coords[0] = isect.coords[0]; coords[1] = isect.coords[1]; coords[2] = isect.coords[2]; - Object[] outData = new Object[1]; + final Object[] outData = new Object[1]; tess.callCombineOrCombineData(coords, data, weights, outData); isect.data = outData[0]; if (isect.data == null) { @@ -432,14 +432,14 @@ class Sweep { } } - static void SpliceMergeVertices(GLUtessellatorImpl tess, GLUhalfEdge e1, - GLUhalfEdge e2) + static void SpliceMergeVertices(final GLUtessellatorImpl tess, final GLUhalfEdge e1, + final GLUhalfEdge e2) /* * Two vertices with idential coordinates are combined into one. * e1.Org is kept, while e2.Org is discarded. */ { - Object[] data = new Object[4]; - float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; + final Object[] data = new Object[4]; + final float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; data[0] = e1.Org.data; data[1] = e2.Org.data; @@ -447,8 +447,8 @@ class Sweep { if (!Mesh.__gl_meshSplice(e1, e2)) throw new RuntimeException(); } - static void VertexWeights(GLUvertex isect, GLUvertex org, GLUvertex dst, - float[] weights) + static void VertexWeights(final GLUvertex isect, final GLUvertex org, final GLUvertex dst, + final float[] weights) /* * Find some weights which describe how the intersection vertex is * a linear combination of "org" and "dest". Each of the two edges @@ -456,8 +456,8 @@ class Sweep { * splits the weight between its org and dst according to the * relative distance to "isect". */ { - double t1 = Geom.VertL1dist(org, isect); - double t2 = Geom.VertL1dist(dst, isect); + final double t1 = Geom.VertL1dist(org, isect); + final double t2 = Geom.VertL1dist(dst, isect); weights[0] = (float) (0.5 * t2 / (t1 + t2)); weights[1] = (float) (0.5 * t1 / (t1 + t2)); @@ -467,18 +467,18 @@ class Sweep { } - static void GetIntersectData(GLUtessellatorImpl tess, GLUvertex isect, - GLUvertex orgUp, GLUvertex dstUp, - GLUvertex orgLo, GLUvertex dstLo) + static void GetIntersectData(final GLUtessellatorImpl tess, final GLUvertex isect, + final GLUvertex orgUp, final GLUvertex dstUp, + final GLUvertex orgLo, final GLUvertex dstLo) /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the * rendering callbacks. */ { - Object[] data = new Object[4]; - float[] weights = new float[4]; - float[] weights1 = new float[2]; - float[] weights2 = new float[2]; + final Object[] data = new Object[4]; + final float[] weights = new float[4]; + final float[] weights1 = new float[2]; + final float[] weights2 = new float[2]; data[0] = orgUp.data; data[1] = dstUp.data; @@ -494,7 +494,7 @@ class Sweep { CallCombine(tess, isect, data, weights, true); } - static boolean CheckForRightSplice(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForRightSplice(final GLUtessellatorImpl tess, final ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Org is above eLo, or eLo.Org is below eUp (depending on which @@ -520,9 +520,9 @@ class Sweep { * This is a guaranteed solution, no matter how degenerate things get. * Basically this is a combinatorial solution to a numerical problem. */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; if (Geom.VertLeq(eUp.Org, eLo.Org)) { if (Geom.EdgeSign(eLo.Sym.Org, eUp.Org, eLo.Org) > 0) return false; @@ -550,7 +550,7 @@ class Sweep { return true; } - static boolean CheckForLeftSplice(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForLeftSplice(final GLUtessellatorImpl tess, final ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Sym.Org is above eLo, or eLo.Sym.Org is below eUp (depending on which @@ -569,9 +569,9 @@ class Sweep { * We fix the problem by just splicing the offending vertex into the * other edge. */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; GLUhalfEdge e; assert (!Geom.VertEq(eUp.Sym.Org, eLo.Sym.Org)); @@ -599,7 +599,7 @@ class Sweep { } - static boolean CheckForIntersect(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForIntersect(final GLUtessellatorImpl tess, ActiveRegion regUp) /* * Check the upper and lower edges of the given region to see if * they intersect. If so, create the intersection and add it @@ -612,12 +612,12 @@ class Sweep { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; - GLUvertex orgUp = eUp.Org; - GLUvertex orgLo = eLo.Org; - GLUvertex dstUp = eUp.Sym.Org; - GLUvertex dstLo = eLo.Sym.Org; + final GLUvertex orgUp = eUp.Org; + final GLUvertex orgLo = eLo.Org; + final GLUvertex dstUp = eUp.Sym.Org; + final GLUvertex dstLo = eLo.Sym.Org; double tMinUp, tMaxLo; - GLUvertex isect = new GLUvertex(); + final GLUvertex isect = new GLUvertex(); GLUvertex orgMin; GLUhalfEdge e; @@ -752,7 +752,7 @@ class Sweep { return false; } - static void WalkDirtyRegions(GLUtessellatorImpl tess, ActiveRegion regUp) + static void WalkDirtyRegions(final GLUtessellatorImpl tess, ActiveRegion regUp) /* * When the upper or lower edge of any region changes, the region is * marked "dirty". This routine walks through all the dirty regions @@ -837,7 +837,7 @@ class Sweep { } - static void ConnectRightVertex(GLUtessellatorImpl tess, ActiveRegion regUp, + static void ConnectRightVertex(final GLUtessellatorImpl tess, ActiveRegion regUp, GLUhalfEdge eBottomLeft) /* * Purpose: connect a "right" vertex vEvent (one where all edges go left) @@ -872,9 +872,9 @@ class Sweep { */ { GLUhalfEdge eNew; GLUhalfEdge eTopLeft = eBottomLeft.Onext; - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; boolean degenerate = false; if (eUp.Sym.Org != eLo.Sym.Org) { @@ -930,8 +930,8 @@ class Sweep { */ private static final boolean TOLERANCE_NONZERO = false; - static void ConnectLeftDegenerate(GLUtessellatorImpl tess, - ActiveRegion regUp, GLUvertex vEvent) + static void ConnectLeftDegenerate(final GLUtessellatorImpl tess, + ActiveRegion regUp, final GLUvertex vEvent) /* * The event vertex lies exacty on an already-processed edge or vertex. * Adding the new vertex involves splicing it into the already-processed @@ -989,7 +989,7 @@ class Sweep { } - static void ConnectLeftVertex(GLUtessellatorImpl tess, GLUvertex vEvent) + static void ConnectLeftVertex(final GLUtessellatorImpl tess, final GLUvertex vEvent) /* * Purpose: connect a "left" vertex (one where both edges go right) * to the processed portion of the mesh. Let R be the active region @@ -1007,7 +1007,7 @@ class Sweep { */ { ActiveRegion regUp, regLo, reg; GLUhalfEdge eUp, eLo, eNew; - ActiveRegion tmp = new ActiveRegion(); + final ActiveRegion tmp = new ActiveRegion(); /* assert ( vEvent.anEdge.Onext.Onext == vEvent.anEdge ); */ @@ -1035,7 +1035,7 @@ class Sweep { eNew = Mesh.__gl_meshConnect(vEvent.anEdge.Sym, eUp.Lnext); if (eNew == null) throw new RuntimeException(); } else { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); if (tempHalfEdge == null) throw new RuntimeException(); eNew = tempHalfEdge.Sym; @@ -1055,7 +1055,7 @@ class Sweep { } - static void SweepEvent(GLUtessellatorImpl tess, GLUvertex vEvent) + static void SweepEvent(final GLUtessellatorImpl tess, final GLUvertex vEvent) /* * Does everything necessary when the sweep line crosses a vertex. * Updates the mesh and the edge dictionary. @@ -1114,13 +1114,13 @@ class Sweep { */ private static final double SENTINEL_COORD = (4.0 * GLU.GLU_TESS_MAX_COORD); - static void AddSentinel(GLUtessellatorImpl tess, double t) + static void AddSentinel(final GLUtessellatorImpl tess, final double t) /* * We add two sentinel edges above and below all other edges, * to avoid special cases at the top and bottom. */ { GLUhalfEdge e; - ActiveRegion reg = new ActiveRegion(); + final ActiveRegion reg = new ActiveRegion(); if (reg == null) throw new RuntimeException(); e = Mesh.__gl_meshMakeEdge(tess.mesh); @@ -1151,7 +1151,7 @@ class Sweep { /* __gl_dictListNewDict */ tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() { @Override - public boolean leq(Object frame, Object key1, Object key2) { + public boolean leq(final Object frame, final Object key1, final Object key2) { return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2); } }); @@ -1162,7 +1162,7 @@ class Sweep { } - static void DoneEdgeDict(GLUtessellatorImpl tess) { + static void DoneEdgeDict(final GLUtessellatorImpl tess) { ActiveRegion reg; int fixedEdges = 0; @@ -1185,12 +1185,12 @@ class Sweep { } - static void RemoveDegenerateEdges(GLUtessellatorImpl tess) + static void RemoveDegenerateEdges(final GLUtessellatorImpl tess) /* * Remove zero-length edges, and contours with fewer than 3 vertices. */ { GLUhalfEdge e, eNext, eLnext; - GLUhalfEdge eHead = tess.mesh.eHead; + final GLUhalfEdge eHead = tess.mesh.eHead; /*LINTED*/ for (e = eHead.next; e != eHead; e = eNext) { @@ -1222,7 +1222,7 @@ class Sweep { } } - static boolean InitPriorityQ(GLUtessellatorImpl tess) + static boolean InitPriorityQ(final GLUtessellatorImpl tess) /* * Insert all vertices into the priority queue which determines the * order in which vertices cross the sweep line. @@ -1233,7 +1233,7 @@ class Sweep { /* __gl_pqSortNewPriorityQ */ pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() { @Override - public boolean leq(Object key1, Object key2) { + public boolean leq(final Object key1, final Object key2) { return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); } }); @@ -1254,12 +1254,12 @@ class Sweep { } - static void DonePriorityQ(GLUtessellatorImpl tess) { + static void DonePriorityQ(final GLUtessellatorImpl tess) { tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ } - static boolean RemoveDegenerateFaces(GLUmesh mesh) + static boolean RemoveDegenerateFaces(final GLUmesh mesh) /* * Delete any degenerate faces with only two edges. WalkDirtyRegions() * will catch almost all of these, but it won't catch degenerate faces @@ -1292,7 +1292,7 @@ class Sweep { return true; } - public static boolean __gl_computeInterior(GLUtessellatorImpl tess) + public static boolean __gl_computeInterior(final GLUtessellatorImpl tess) /* * __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java index 5db543c80..63994ba82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java @@ -80,7 +80,7 @@ class TessMono { * to the fan is a simple orientation test. By making the fan as large * as possible, we restore the invariant (check it yourself). */ - static boolean __gl_meshTessellateMonoRegion(GLUface face, boolean avoidDegenerateTris) { + static boolean __gl_meshTessellateMonoRegion(final GLUface face, final boolean avoidDegenerateTris) { GLUhalfEdge up, lo; /* All edges are oriented CCW around the boundary of the region. @@ -135,7 +135,7 @@ class TessMono { */ while (lo.Lnext != up && (Geom.EdgeGoesLeft(lo.Lnext) || Geom.EdgeSign(lo.Org, lo.Sym.Org, lo.Lnext.Sym.Org) <= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); mustConnect = false; if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; @@ -145,7 +145,7 @@ class TessMono { /* lo.Org is on the left. We can make CCW triangles from up.Sym.Org. */ while (lo.Lnext != up && (Geom.EdgeGoesRight(up.Onext.Sym) || Geom.EdgeSign(up.Sym.Org, up.Org, up.Onext.Sym.Org) >= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); mustConnect = false; if (tempHalfEdge == null) return false; up = tempHalfEdge.Sym; @@ -159,7 +159,7 @@ class TessMono { */ assert (lo.Lnext != up); while (lo.Lnext.Lnext != up) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; } @@ -172,7 +172,7 @@ class TessMono { * the mesh which is marked "inside" the polygon. Each such region * must be monotone. */ - public static boolean __gl_meshTessellateInterior(GLUmesh mesh, boolean avoidDegenerateTris) { + public static boolean __gl_meshTessellateInterior(final GLUmesh mesh, final boolean avoidDegenerateTris) { GLUface f, next; /*LINTED*/ @@ -193,7 +193,7 @@ class TessMono { * on NULL faces are not allowed, the main purpose is to clean up the * mesh so that exterior loops are not represented in the data structure. */ - public static void __gl_meshDiscardExterior(GLUmesh mesh) { + public static void __gl_meshDiscardExterior(final GLUmesh mesh) { GLUface f, next; /*LINTED*/ @@ -216,7 +216,7 @@ class TessMono { * If keepOnlyBoundary is TRUE, it also deletes all edges which do not * separate an interior region from an exterior one. */ - public static boolean __gl_meshSetWindingNumber(GLUmesh mesh, int value, boolean keepOnlyBoundary) { + public static boolean __gl_meshSetWindingNumber(final GLUmesh mesh, final int value, final boolean keepOnlyBoundary) { GLUhalfEdge e, eNext; for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { |