diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/glu/gl2')
3 files changed, 72 insertions, 138 deletions
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); |