aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/impl/glu/nurbs
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-03-16 15:10:57 +0000
committerSven Gothel <[email protected]>2009-03-16 15:10:57 +0000
commit3b83ea25d64ab2c92822265f2eb74b35eddab722 (patch)
treea041ed8697b747fec0e198578df1c6cfbfc6adda /src/jogl/classes/com/sun/opengl/impl/glu/nurbs
parentaf88a8948eb945fdf97d8553f339effc2349fd24 (diff)
repair
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1872 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/glu/nurbs')
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java258
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java63
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java60
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java90
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java217
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java44
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java155
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java59
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java194
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java130
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java195
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java160
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java238
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java86
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java121
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java56
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java130
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java557
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java179
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java442
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java122
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java184
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java63
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java80
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java79
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java44
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java52
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java44
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java54
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java145
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java75
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java47
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java71
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java282
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java85
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt59
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java128
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java204
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java1167
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java111
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java56
41 files changed, 6586 insertions, 0 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java
new file mode 100755
index 000000000..e96aa83f8
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java
@@ -0,0 +1,258 @@
+package com.sun.opengl.impl.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 1.1 (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.
+*/
+
+/**
+ * Trimming arc
+ * @author Tomas Hrasky
+ *
+ */
+public class Arc {
+ /**
+ * Corresponding picewise-linear arc
+ */
+ public PwlArc pwlArc;
+
+ /**
+ * Arc type
+ */
+ private long type;
+
+ /**
+ * Arc link in linked list
+ */
+ public Arc link;
+
+ /**
+ * Previous arc
+ */
+ Arc prev;
+
+ /**
+ * Next arc
+ */
+ Arc next;
+
+ /**
+ * Corresponding berizer type arc
+ */
+ private BezierArc bezierArc;
+
+ /**
+ * Makes new arc at specified side
+ *
+ * @param side
+ * which side doeas this arc form
+ */
+ public Arc(int side) {
+ bezierArc = null;
+ pwlArc = null;
+ type = 0;
+ setside(side);
+ // nuid=_nuid
+ }
+
+ /**
+ * Sets side the arc is at
+ *
+ * @param side
+ * arc side
+ */
+ private void setside(int side) {
+ // DONE
+ clearside();
+ type |= side << 8;
+ }
+
+ /**
+ * Unsets side
+ */
+ private void clearside() {
+ // DONE
+ type &= ~(0x7 << 8);
+ }
+
+ // this one replaces enum arc_side
+ /**
+ * Side not specified
+ */
+ public static final int ARC_NONE = 0;
+
+ /**
+ * Arc on right
+ */
+ public static final int ARC_RIGHT = 1;
+
+ /**
+ * Arc on top
+ */
+ public static final int ARC_TOP = 2;
+
+ /**
+ * Arc on left
+ */
+ public static final int ARC_LEFT = 3;
+
+ /**
+ * Arc on bottom
+ */
+ public static final int ARC_BOTTOM = 4;
+
+ /**
+ * Bezier type flag
+ */
+ private static final long BEZIER_TAG = 1 << 13;
+
+ /**
+ * Arc type flag
+ */
+ private static final long ARC_TAG = 1 << 3;
+
+ /**
+ * Tail type tag
+ */
+ private static final long TAIL_TAG = 1 << 6;
+
+ /**
+ * Appends arc to the list
+ *
+ * @param jarc
+ * arc to be append
+ * @return this
+ */
+ public Arc append(Arc jarc) {
+ // DONE
+ if (jarc != null) {
+ next = jarc.next;
+ prev = jarc;
+ next.prev = this;
+ prev.next = this;
+ } else {
+ next = this;
+ prev = this;
+ }
+
+ return this;
+ }
+
+ /**
+ * Unused
+ *
+ * @return true
+ */
+ public boolean check() {
+ return true;
+ }
+
+ /**
+ * Sets bezier type flag
+ */
+ public void setbezier() {
+ // DONE
+ type |= BEZIER_TAG;
+
+ }
+
+ /**
+ * Returns tail of linked list coords
+ *
+ * @return tail coords
+ */
+ public float[] tail() {
+ // DONE
+ return pwlArc.pts[0].param;
+ }
+
+ /**
+ * Returns head of linked list coords
+ *
+ * @return head coords
+ */
+ public float[] head() {
+ // DONE
+ return next.pwlArc.pts[0].param;
+ }
+
+ /**
+ * Returns whether arc is marked with arc_tag
+ *
+ * @return is arc marked with arc_tag
+ */
+ public boolean ismarked() {
+ // DONE
+ return ((type & ARC_TAG) > 0) ? true : false;
+ }
+
+ /**
+ * Cleans arc_tag flag
+ */
+ public void clearmark() {
+ // DONE
+ type &= (~ARC_TAG);
+ }
+
+ /**
+ * Sets arc_tag flag
+ */
+ public void setmark() {
+ // DONE
+ type |= ARC_TAG;
+ }
+
+ /**
+ * sets tail tag
+ */
+ public void setitail() {
+ // DONE
+ type |= TAIL_TAG;
+ }
+
+ /**
+ * Returns whether arc is marked tail
+ *
+ * @return is tail
+ */
+ public boolean getitail() {
+ return false;
+ }
+
+ /**
+ * Unsets tail tag
+ */
+ public void clearitail() {
+ // DONE
+ type &= (~TAIL_TAG);
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java
new file mode 100755
index 000000000..f8fbe2930
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java
@@ -0,0 +1,63 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class for sorting list of Arcs
+ * @author Tomas Hrasky
+ *
+ */
+public class ArcSdirSorter {
+
+ /**
+ * Makes new ArcSdirSorter with Subdivider
+ * @param subdivider subdivider
+ */
+ public ArcSdirSorter(Subdivider subdivider) {
+ //TODO
+ // System.out.println("TODO arcsdirsorter.constructor");
+ }
+
+ /**
+ * Sorts list of arcs
+ * @param list arc list to be sorted
+ * @param count size of list
+ */
+ public void qsort(CArrayOfArcs list, int count) {
+ // TODO
+ // System.out.println("TODO arcsdirsorter.qsort");
+ }
+
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java
new file mode 100755
index 000000000..9e9a10b42
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java
@@ -0,0 +1,60 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class for sorting list of Arcs
+ * @author Tomas Hrasky
+ *
+ */
+public class ArcTdirSorter {
+ /**
+ * Makes new ArcSdirSorter with Subdivider
+ * @param subdivider subdivider
+ */
+ public ArcTdirSorter(Subdivider subdivider) {
+ // TODO Auto-generated constructor stub
+ // System.out.println("TODO arcTsorter.konstruktor");
+ }
+ /**
+ * Sorts list of arcs
+ * @param list arc list to be sorted
+ * @param count size of list
+ */
+ public void qsort(CArrayOfArcs list, int count) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO arcTsorter.qsort");
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java
new file mode 100755
index 000000000..496e8b7d6
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java
@@ -0,0 +1,90 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class for arc tesselation
+ * @author Tomas Hrasky
+ *
+ */
+public class ArcTesselator {
+
+ /**
+ * Makes given arc an bezier arc
+ * @param arc arc to work with
+ * @param s1 minimum s param
+ * @param s2 maximum s param
+ * @param t1 minimum t param
+ * @param t2 maximum s param
+ */
+ public void bezier(Arc arc, float s1, float s2, float t1, float t2) {
+ // DONE
+ TrimVertex[] p = new TrimVertex[2];
+ p[0] = new TrimVertex();
+ p[1] = new TrimVertex();
+ arc.pwlArc = new PwlArc(2, p);
+ p[0].param[0] = s1;
+ p[0].param[1] = s2;
+ p[1].param[0] = t1;
+ p[1].param[1] = t2;
+ arc.setbezier();
+ }
+
+ /**
+ * Empty method
+ * @param newright arc to work with
+ * @param s first tail
+ * @param t2 second tail
+ * @param t1 third tail
+ * @param f stepsize
+ */
+ public void pwl_right(Arc newright, float s, float t1, float t2, float f) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO arctesselator.pwl_right");
+ }
+
+ /**
+ * Empty method
+ * @param newright arc to work with
+ * @param s first tail
+ * @param t2 second tail
+ * @param t1 third tail
+ * @param f stepsize
+ */
+ public void pwl_left(Arc newright, float s, float t2, float t1, float f) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO arctesselator.pwl_left");
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java
new file mode 100755
index 000000000..9467104f5
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java
@@ -0,0 +1,217 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class responsible for rendering
+ * @author Tomas Hrasky
+ *
+ */
+public abstract class Backend {
+
+ /**
+ * Fill surface
+ */
+ public static final int N_MESHFILL = 0;
+
+ /**
+ * Draw surface as wire model
+ */
+ public static final int N_MESHLINE = 1;
+
+ /**
+ * Draw surface with points
+ */
+ public static final int N_MESHPOINT = 2;
+
+ /**
+ * Object rendering curves
+ */
+ protected CurveEvaluator curveEvaluator;
+
+ /**
+ * Object rendering surfaces
+ */
+ protected SurfaceEvaluator surfaceEvaluator;
+
+ /**
+ * Makes new backend
+ */
+ public Backend() {
+ // curveEvaluator = new OpenGLCurveEvaluator();
+ // surfaceEvaluator = new OpenGLSurfaceEvaluator();
+ }
+
+ /**
+ * Begin a curve
+ */
+ public void bgncurv() {
+ // DONE
+ curveEvaluator.bgnmap1f();
+
+ }
+
+ /**
+ * End a curve
+ */
+ public void endcurv() {
+ // DONE
+ curveEvaluator.endmap1f();
+
+ }
+
+ /**
+ * Make cuve with given parameters
+ * @param type curve type
+ * @param ps control points
+ * @param stride control points coordinates number
+ * @param order order of curve
+ * @param ulo smallest u
+ * @param uhi highest u
+ */
+ public void curvpts(int type, CArrayOfFloats ps, int stride, int order,
+ float ulo, float uhi) {
+ // DONE
+ curveEvaluator.map1f(type, ulo, uhi, stride, order, ps);
+ curveEvaluator.enable(type);
+ }
+
+ /**
+ * Draw curve
+ * @param u1 smallest u
+ * @param u2 highest u
+ * @param nu number of pieces
+ */
+ public void curvgrid(float u1, float u2, int nu) {
+ // DONE
+ curveEvaluator.mapgrid1f(nu, u1, u2);
+
+ }
+
+ /**
+ * Evaluates curve mesh
+ * @param from low param
+ * @param n step
+ */
+ public void curvmesh(int from, int n) {
+ // DONE
+ curveEvaluator.mapmesh1f(N_MESHFILL, from, from + n);
+ }
+
+ /**
+ * Begin surface
+ * @param wiretris use triangles
+ * @param wirequads use quads
+ */
+ public void bgnsurf(int wiretris, int wirequads) {
+ // DONE
+ surfaceEvaluator.bgnmap2f();
+
+ if (wiretris > 0)
+ surfaceEvaluator.polymode(NurbsConsts.N_MESHLINE);
+ else
+ surfaceEvaluator.polymode(NurbsConsts.N_MESHFILL);
+ }
+
+ /**
+ * End surface
+ */
+ public void endsurf() {
+ // DONE
+ surfaceEvaluator.endmap2f();
+ }
+
+ /**
+ * Empty method
+ * @param ulo low u param
+ * @param uhi hig u param
+ * @param vlo low v param
+ * @param vhi high v param
+ */
+ public void patch(float ulo, float uhi, float vlo, float vhi) {
+ // DONE
+ surfaceEvaluator.domain2f(ulo, uhi, vlo, vhi);
+ }
+
+ /**
+ * Draw surface
+ * @param u0 lowest u
+ * @param u1 highest u
+ * @param nu number of pieces in u direction
+ * @param v0 lowest v
+ * @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) {
+ // DONE
+ surfaceEvaluator.mapgrid2f(nu, u0, u1, nv, v0, v1);
+
+ }
+
+ /**
+ * Evaluates surface mesh
+ * @param u u param
+ * @param v v param
+ * @param n step in u direction
+ * @param m step in v direction
+ */
+ public void surfmesh(int u, int v, int n, int m) {
+ // System.out.println("TODO backend.surfmesh wireframequads");
+ // TODO wireframequads
+ surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m);
+ }
+
+ /**
+ * Make surface
+ * @param type surface type
+ * @param pts control points
+ * @param ustride control points coordinates in u direction
+ * @param vstride control points coordinates in v direction
+ * @param uorder surface order in u direction
+ * @param vorder surface order in v direction
+ * @param ulo lowest u
+ * @param uhi hightest u
+ * @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) {
+ // DONE
+ surfaceEvaluator.map2f(type, ulo, uhi, ustride, uorder, vlo, vhi,
+ vstride, vorder, pts);
+ surfaceEvaluator.enable(type);
+
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java
new file mode 100755
index 000000000..ef4cf0684
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java
@@ -0,0 +1,44 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Empty class
+ * @author Tomas Hrasky
+ *
+ */
+public class BezierArc {
+
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java
new file mode 100755
index 000000000..0f0806d96
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java
@@ -0,0 +1,155 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding trimming arcs
+ * @author Tomas Hrasky
+ *
+ */
+public class Bin {
+
+ /**
+ * Head of linked list of arcs
+ */
+ private Arc head;
+
+ /**
+ * Current arc
+ */
+ private Arc current;
+
+ /**
+ * Indicates whether there are any Arcs in linked list
+ * @return true if there are any Arcs in linked list
+ */
+ public boolean isnonempty() {
+ // DONE
+ return this.head != null ? true : false;
+ }
+
+ /**
+ * Adds and arc to linked list
+ * @param jarc added arc
+ */
+ public void addarc(Arc jarc) {
+ // DONE
+ // if (head == null)
+ // head = jarc;
+ // else {
+ jarc.link = head;
+ head = jarc;
+ // }
+
+ }
+
+ /**
+ * Returns number of arcs in linked list
+ * @return number of arcs
+ */
+ public int numarcs() {
+ // DONE
+ int count = 0;
+ for (Arc jarc = firstarc(); jarc != null; jarc = nextarc())
+ count++;
+ return count;
+ }
+
+ /**
+ * Removes first arc in list
+ * @return new linked list head
+ */
+ public Arc removearc() {
+ // DONE
+ Arc jarc = head;
+ if (jarc != null)
+ head = jarc.link;
+ return jarc;
+
+ }
+
+ /**
+ * Consolidates linked list
+ */
+ public void adopt() {
+ // DONE
+ markall();
+
+ Arc orphan;
+ while ((orphan = removearc()) != null) {
+ for (Arc parent = orphan.next; !parent.equals(orphan); parent = parent.next) {
+ if (!parent.ismarked()) {
+ orphan.link = parent.link;
+ parent.link = orphan;
+ orphan.clearmark();
+ break;
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Marks all arc in linked list
+ */
+ private void markall() {
+ // DONE
+ for (Arc jarc = firstarc(); jarc != null; jarc = nextarc())
+ jarc.setmark();
+ }
+
+ /**
+ * Returns first arc in linked list
+ * @return first arc in linked list
+ */
+ private Arc firstarc() {
+ // DONE
+ current = head;
+ return nextarc();
+ }
+
+ /**
+ * Returns next arc in linked list
+ * @return next arc
+ *
+ */
+ private Arc nextarc() {
+ // DONE
+ Arc jarc = current;
+ if (jarc != null)
+ current = jarc.link;
+ return jarc;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java
new file mode 100755
index 000000000..9cccc5102
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java
@@ -0,0 +1,59 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding break point parameters
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class Breakpt {
+
+ /**
+ * Breakpoint multiplicity
+ */
+ public int multi;
+
+ /**
+ * Breakpint value
+ */
+ public float value;
+
+ /**
+ * Breakpoint deficit (how many times it has to be added)
+ */
+ public int def;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java
new file mode 100755
index 000000000..3d6e1d47f
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java
@@ -0,0 +1,194 @@
+package com.sun.opengl.impl.glu.nurbs;
+
+/**
+ * Class replacing C language pointer
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class CArrayOfArcs {
+ /**
+ * Underlaying array
+ */
+ private Arc[] array;
+
+ /**
+ * Pointer to array member
+ */
+ private int pointer;
+
+ /**
+ * Don't check for array borders?
+ */
+ private boolean noCheck = true;
+
+ /**
+ * Makes new CArray
+ *
+ * @param array
+ * underlaying array
+ * @param pointer
+ * pointer (index) to array
+ */
+ public CArrayOfArcs(Arc[] array, int pointer) {
+ this.array = array;
+ // this.pointer=pointer;
+ setPointer(pointer);
+ }
+
+ /**
+ * Makes new CArray from other CArray
+ *
+ * @param carray
+ * reference array
+ */
+ public CArrayOfArcs(CArrayOfArcs carray) {
+ this.array = carray.array;
+ // this.pointer=carray.pointer;
+ setPointer(carray.pointer);
+ }
+
+ /**
+ * Makes new CArray with pointer set to 0
+ *
+ * @param ctlarray
+ * underlaying array
+ */
+ public CArrayOfArcs(Arc[] ctlarray) {
+ this.array = ctlarray;
+ this.pointer = 0;
+ }
+
+ /**
+ * Returns element at pointer
+ *
+ * @return element at pointer
+ */
+ public Arc get() {
+ return array[pointer];
+ }
+
+ /**
+ * Increases pointer by one (++)
+ */
+ public void pp() {
+ // pointer++;
+ setPointer(pointer + 1);
+ }
+
+ /**
+ * Sets element at pointer
+ *
+ * @param f
+ * desired value
+ */
+ public void set(Arc f) {
+ array[pointer] = f;
+
+ }
+
+ /**
+ * Returns array element at specified index
+ *
+ * @param i
+ * array index
+ * @return element at index
+ */
+ public Arc get(int i) {
+ return array[i];
+ }
+
+ /**
+ * Returns array element at specified index relatively to pointer
+ *
+ * @param i
+ * relative index
+ * @return element at relative index
+ */
+ public Arc getRelative(int i) {
+ return array[pointer + i];
+ }
+
+ /**
+ * Sets value of element at specified index relatively to pointer
+ *
+ * @param i
+ * relative index
+ * @param value
+ * value to be set
+ */
+ public void setRelative(int i, Arc value) {
+ array[pointer + i] = value;
+ }
+
+ /**
+ * Lessens pointer by value
+ *
+ * @param i
+ * lessen by
+ */
+ public void lessenPointerBy(int i) {
+ // pointer-=i;
+ setPointer(pointer - i);
+ }
+
+ /**
+ * Returns pointer value
+ *
+ * @return pointer value
+ */
+ public int getPointer() {
+ return pointer;
+ }
+
+ /**
+ * Sets ponter value
+ *
+ * @param pointer
+ * pointer value to be set
+ */
+ public void setPointer(int pointer) {
+ if (!noCheck && pointer > array.length)
+ throw new IllegalArgumentException("Pointer " + pointer
+ + " out of bounds " + array.length);
+ this.pointer = pointer;
+ }
+
+ /**
+ * Raises pointer by value
+ *
+ * @param i
+ * raise by
+ */
+ public void raisePointerBy(int i) {
+ // pointer+=i;
+ setPointer(pointer + i);
+ }
+
+ /**
+ * Lessens ponter by one (--)
+ */
+ public void mm() {
+ // pointer--;
+ setPointer(pointer - 1);
+ }
+
+ /**
+ * Returns underlaying array
+ *
+ * @return underlaying array
+ */
+ public Arc[] getArray() {
+ return array;
+ }
+
+ /**
+ * Sets underlaying array
+ *
+ * @param array
+ * underlaying array
+ */
+ public void setArray(Arc[] array) {
+ this.array = array;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java
new file mode 100755
index 000000000..f5932d954
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java
@@ -0,0 +1,130 @@
+package com.sun.opengl.impl.glu.nurbs;
+
+/**
+ * Class replacing C language pointer
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class CArrayOfBreakpts {
+ /**
+ * Underlaying array
+ */
+ private Breakpt[] pole;
+
+ /**
+ * Pointer to array member
+ */
+ private int pointer;
+
+ /**
+ * Makes new CArray
+ *
+ * @param array
+ * underlaying array
+ * @param pointer
+ * pointer (index) to array
+ */
+ public CArrayOfBreakpts(Breakpt[] array, int pointer) {
+ this.pole = array;
+ this.pointer = pointer;
+ }
+
+ /**
+ * Makes new CArray from other CArray
+ *
+ * @param carray
+ * reference array
+ */
+ public CArrayOfBreakpts(CArrayOfBreakpts carray) {
+ this.pole = carray.pole;
+ this.pointer = carray.pointer;
+ }
+
+ /**
+ * Returns element at pointer
+ *
+ * @return element at pointer
+ */
+ public Breakpt get() {
+ return pole[pointer];
+ }
+
+ /**
+ * Increases pointer by one (++)
+ */
+ public void pp() {
+ pointer++;
+ }
+
+ /**
+ * Sets element at pointer
+ *
+ * @param f
+ * desired value
+ */
+ public void set(Breakpt f) {
+ pole[pointer] = f;
+
+ }
+
+ /**
+ * Returns array element at specified index
+ *
+ * @param i
+ * array index
+ * @return element at index
+ */
+ public Breakpt get(int i) {
+ return pole[i];
+ }
+
+ /**
+ * Lessens pointer by value
+ *
+ * @param i
+ * lessen by
+ */
+ public void lessenPointerBy(int i) {
+ pointer -= i;
+
+ }
+
+ /**
+ * Returns pointer value
+ *
+ * @return pointer value
+ */
+ public int getPointer() {
+ return pointer;
+ }
+
+ /**
+ * Sets ponter value
+ *
+ * @param pointer
+ * pointer value to be set
+ */
+ public void setPointer(int pointer) {
+ this.pointer = pointer;
+ }
+
+ /**
+ * Raises pointer by value
+ *
+ * @param i
+ * raise by
+ */
+ public void raisePointerBy(int i) {
+ pointer += i;
+
+ }
+
+ /**
+ * Lessens ponter by one (--)
+ */
+ public void mm() {
+ pointer--;
+
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java
new file mode 100755
index 000000000..fb3fac69b
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java
@@ -0,0 +1,195 @@
+package com.sun.opengl.impl.glu.nurbs;
+
+/**
+ * Class replacing C language pointer
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class CArrayOfFloats {
+
+ /**
+ * Underlaying array
+ */
+ private float[] array;
+
+ /**
+ * Pointer to array member
+ */
+ private int pointer;
+
+ /**
+ * Don't check for array borders?
+ */
+ private boolean noCheck = true;
+
+ /**
+ * Makes new CArray
+ *
+ * @param array
+ * underlaying array
+ * @param pointer
+ * pointer (index) to array
+ */
+ public CArrayOfFloats(float[] array, int pointer) {
+ this.array = array;
+ // this.pointer=pointer;
+ setPointer(pointer);
+ }
+
+ /**
+ * Makes new CArray from other CArray
+ *
+ * @param carray
+ * reference array
+ */
+ public CArrayOfFloats(CArrayOfFloats carray) {
+ this.array = carray.array;
+ // this.pointer=carray.pointer;
+ setPointer(carray.pointer);
+ }
+
+ /**
+ * Makes new CArray with pointer set to 0
+ *
+ * @param ctlarray
+ * underlaying array
+ */
+ public CArrayOfFloats(float[] ctlarray) {
+ this.array = ctlarray;
+ this.pointer = 0;
+ }
+
+ /**
+ * Returns element at pointer
+ *
+ * @return element at pointer
+ */
+ public float get() {
+ return array[pointer];
+ }
+
+ /**
+ * Increases pointer by one (++)
+ */
+ public void pp() {
+ // pointer++;
+ setPointer(pointer + 1);
+ }
+
+ /**
+ * Sets element at pointer
+ *
+ * @param f
+ * desired value
+ */
+ public void set(float f) {
+ array[pointer] = f;
+
+ }
+
+ /**
+ * Returns array element at specified index
+ *
+ * @param i
+ * array index
+ * @return element at index
+ */
+ public float get(int i) {
+ return array[i];
+ }
+
+ /**
+ * Returns array element at specified index relatively to pointer
+ *
+ * @param i
+ * relative index
+ * @return element at relative index
+ */
+ public float getRelative(int i) {
+ return array[pointer + i];
+ }
+
+ /**
+ * Sets value of element at specified index relatively to pointer
+ *
+ * @param i
+ * relative index
+ * @param value
+ * value to be set
+ */
+ public void setRelative(int i, float value) {
+ array[pointer + i] = value;
+ }
+
+ /**
+ * Lessens pointer by value
+ *
+ * @param i
+ * lessen by
+ */
+ public void lessenPointerBy(int i) {
+ // pointer-=i;
+ setPointer(pointer - i);
+ }
+
+ /**
+ * Returns pointer value
+ *
+ * @return pointer value
+ */
+ public int getPointer() {
+ return pointer;
+ }
+
+ /**
+ * Sets ponter value
+ *
+ * @param pointer
+ * pointer value to be set
+ */
+ public void setPointer(int pointer) {
+ if (!noCheck && pointer > array.length)
+ throw new IllegalArgumentException("Pointer " + pointer
+ + " out of bounds " + array.length);
+ this.pointer = pointer;
+ }
+
+ /**
+ * Raises pointer by value
+ *
+ * @param i
+ * raise by
+ */
+ public void raisePointerBy(int i) {
+ // pointer+=i;
+ setPointer(pointer + i);
+ }
+
+ /**
+ * Lessens ponter by one (--)
+ */
+ public void mm() {
+ // pointer--;
+ setPointer(pointer - 1);
+ }
+
+ /**
+ * Returns underlaying array
+ *
+ * @return underlaying array
+ */
+ public float[] getArray() {
+ return array;
+ }
+
+ /**
+ * Sets underlaying array
+ *
+ * @param array
+ * underlaying array
+ */
+ public void setArray(float[] array) {
+ this.array = array;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java
new file mode 100755
index 000000000..fed301895
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java
@@ -0,0 +1,160 @@
+package com.sun.opengl.impl.glu.nurbs;
+
+/**
+ * Class replacing C language pointer
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class CArrayOfQuiltspecs {
+ /**
+ * Underlaying array
+ */
+ private Quiltspec[] array;
+
+ /**
+ * Pointer to array member
+ */
+ private int pointer;
+
+ /**
+ * Makes new CArray
+ *
+ * @param array
+ * underlaying array
+ * @param pointer
+ * pointer (index) to array
+ */
+ public CArrayOfQuiltspecs(Quiltspec[] array, int pointer) {
+ this.array = array;
+ this.pointer = pointer;
+ }
+
+ /**
+ * Makes new CArray from other CArray
+ *
+ * @param carray
+ * reference array
+ */
+ public CArrayOfQuiltspecs(CArrayOfQuiltspecs carray) {
+ this.array = carray.array;
+ this.pointer = carray.pointer;
+ }
+
+ /**
+ * Makes new CArray with pointer set to 0
+ *
+ * @param array
+ * underlaying array
+ */
+ public CArrayOfQuiltspecs(Quiltspec[] array) {
+ this.array = array;
+ this.pointer = 0;
+ }
+
+ /**
+ * Returns element at pointer
+ *
+ * @return element at pointer
+ */
+ public Quiltspec get() {
+ return array[pointer];
+ }
+
+ /**
+ * Increases pointer by one (++)
+ */
+ public void pp() {
+ pointer++;
+ }
+
+ /**
+ * Sets element at pointer
+ *
+ * @param f
+ * desired value
+ */
+ public void set(Quiltspec f) {
+ array[pointer] = f;
+
+ }
+
+ /**
+ * Returns array element at specified index
+ *
+ * @param i
+ * array index
+ * @return element at index
+ */
+ public Quiltspec get(int i) {
+ return array[i];
+ }
+
+ /**
+ * Lessens pointer by value
+ *
+ * @param i
+ * lessen by
+ */
+ public void lessenPointerBy(int i) {
+ pointer -= i;
+
+ }
+
+ /**
+ * Returns pointer value
+ *
+ * @return pointer value
+ */
+ public int getPointer() {
+ return pointer;
+ }
+
+ /**
+ * Sets ponter value
+ *
+ * @param pointer
+ * pointer value to be set
+ */
+ public void setPointer(int pointer) {
+ this.pointer = pointer;
+ }
+
+ /**
+ * Raises pointer by value
+ *
+ * @param i
+ * raise by
+ */
+ public void raisePointerBy(int i) {
+ pointer += i;
+
+ }
+
+ /**
+ * Lessens ponter by one (--)
+ */
+ public void mm() {
+ pointer--;
+
+ }
+
+ /**
+ * Returns underlaying array
+ *
+ * @return underlaying array
+ */
+ public Quiltspec[] getArray() {
+ return array;
+ }
+
+ /**
+ * Sets underlaying array
+ *
+ * @param array
+ * underlaying array
+ */
+ public void setArray(Quiltspec[] array) {
+ this.array = array;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java
new file mode 100755
index 000000000..318c8416c
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java
@@ -0,0 +1,238 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding curve definition
+ * @author Tomáš Hráský
+ *
+ */
+public class Curve {
+
+ /**
+ * Maximum coordinates per control point
+ */
+ private static final int MAXCOORDS = 5;
+
+ /**
+ * Max curve order
+ */
+ private static final int MAXORDER = 24;
+
+ /**
+ * Next curve in linked list
+ */
+ public Curve next;
+
+ /**
+ * OpenGL maps
+ */
+ private Mapdesc mapdesc;
+
+ /**
+ * Does the curve need sampling
+ */
+ private boolean needsSampling;
+
+ /**
+ * Culling
+ */
+ private int cullval;
+
+ /**
+ * Number of coords
+ */
+ private int stride;
+
+ /**
+ * Curve order
+ */
+ private int order;
+
+ /**
+ * Holds conversion range borders
+ */
+ private float[] range;
+
+ /**
+ * Subdivision stepsize
+ */
+ public float stepsize;
+
+ /**
+ * Minimal subdivision stepsize
+ */
+ private float minstepsize;
+
+ /**
+ * Sampling points
+ */
+ float[] spts;
+
+ /**
+ * Makes new Curve
+ *
+ * @param geo
+ * @param pta
+ * @param ptb
+ * @param c
+ * next curve in linked list
+ */
+ public Curve(Quilt geo, float[] pta, float[] ptb, Curve c) {
+
+ spts = new float[MAXORDER * MAXCOORDS];
+
+ mapdesc = geo.mapdesc;
+
+ next = c;
+ needsSampling = mapdesc.isRangeSampling() ? true : false;
+
+ cullval = mapdesc.isCulling() ? Subdivider.CULL_ACCEPT
+ : Subdivider.CULL_TRIVIAL_REJECT;
+ order = geo.qspec.get(0).order;
+ stride = MAXCOORDS;
+
+ // CArrayOfFloats ps = geo.cpts;
+ CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0);
+ CArrayOfQuiltspecs qs = geo.qspec;
+ ps.raisePointerBy(qs.get().offset);
+ ps.raisePointerBy(qs.get().index * qs.get().order * qs.get().stride);
+
+ if (needsSampling) {
+ mapdesc.xformSampling(ps, qs.get().order, qs.get().stride, spts,
+ stride);
+ }
+ if (cullval == Subdivider.CULL_ACCEPT) {
+ // System.out.println("TODO curve.Curve-cullval");
+ // mapdesc.xformCulling(ps,qs.get().order,qs.get().stride,cpts,stride);
+ }
+
+ range = new float[3];
+ range[0] = qs.get().breakpoints[qs.get().index];
+ range[1] = qs.get().breakpoints[qs.get().index + 1];
+ range[2] = range[1] - range[0];
+ // TODO it is necessary to solve problem with "this" pointer here
+ if (range[0] != pta[0]) {
+ // System.out.println("TODO curve.Curve-range0");
+ // Curve lower=new Curve(this,pta,0);
+ // lower.next=next;
+ // this=lower;
+ }
+ if (range[1] != ptb[0]) {
+ // System.out.println("TODO curve.Curve-range1");
+ // Curve lower=new Curve(this,ptb,0);
+ }
+ }
+
+ /**
+ * Checks culling type
+ * @return Subdivider.CULL_ACCEPT
+ */
+ public int cullCheck() {
+ if (cullval == Subdivider.CULL_ACCEPT) {
+ // System.out.println("TODO curve.cullval");
+ // cullval=mapdesc.cullCheck(cpts,order,stride);
+ }
+ // TODO compute cullval and return the computed value
+ // return cullval;
+ return Subdivider.CULL_ACCEPT;
+ }
+
+ /**
+ * Computes subdivision step size
+ */
+ public void getStepSize() {
+ minstepsize = 0;
+ if (mapdesc.isConstantSampling()) {
+ setstepsize(mapdesc.maxrate);
+ } else if (mapdesc.isDomainSampling()) {
+ setstepsize(mapdesc.maxrate * range[2]);
+ } else {
+ assert (order <= MAXORDER);
+
+ float tmp[][] = new float[MAXORDER][MAXCOORDS];
+
+ int tstride = (MAXORDER);
+
+ int val = 0;
+ // mapdesc.project(spts,stride,tmp,tstride,order);
+
+ // System.out.println("TODO curve.getsptepsize mapdesc.project");
+
+ if (val == 0) {
+ setstepsize(mapdesc.maxrate);
+ } else {
+ float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE);
+ if (mapdesc.isParametricDistanceSampling()) {
+ // System.out.println("TODO curve.getstepsize - parametric");
+ } else if (mapdesc.isPathLengthSampling()) {
+ // System.out.println("TODO curve.getstepsize - pathlength");
+ } else {
+ setstepsize(mapdesc.maxrate);
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * Sets maximum subdivision step size
+ * @param max maximum subdivision step size
+ */
+ private void setstepsize(float max) {
+ // DONE
+ stepsize = (max >= 1) ? (range[2] / max) : range[2];
+ minstepsize = stepsize;
+ }
+
+ /**
+ * Clamps the curve
+ */
+ public void clamp() {
+ // DONE
+ if (stepsize < minstepsize)
+ stepsize = mapdesc.clampfactor * minstepsize;
+ }
+
+ /**
+ * Tells whether curve needs subdivision
+ *
+ * @return curve needs subdivison
+ */
+ public boolean needsSamplingSubdivision() {
+ return (stepsize < minstepsize);
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java
new file mode 100755
index 000000000..a6393ddf4
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java
@@ -0,0 +1,86 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class rendering curves with OpenGL
+ * @author Tomáš Hráský
+ *
+ */
+public interface CurveEvaluator {
+ /**
+ * Pushes eval bit
+ */
+ public void bgnmap1f();
+
+ /**
+ * Pops all OpenGL attributes
+ */
+ public void endmap1f() ;
+
+ /**
+ * Initializes opengl evaluator
+ * @param type curve type
+ * @param ulo lowest u
+ * @param uhi highest u
+ * @param stride control point coords
+ * @param order curve order
+ * @param ps control points
+ */
+ public void map1f(int type, float ulo, float uhi, int stride, int order,
+ CArrayOfFloats ps) ;
+
+ /**
+ * Calls opengl enable
+ * @param type what to enable
+ */
+ public void enable(int type) ;
+
+ /**
+ * Calls glMapGrid1f
+ * @param nu steps
+ * @param u1 low u
+ * @param u2 high u
+ */
+ public void mapgrid1f(int nu, float u1, float u2) ;
+
+ /**
+ * Evaluates a curve using glEvalMesh1f
+ * @param style Backend.N_MESHFILL/N_MESHLINE/N_MESHPOINT
+ * @param from lowest param
+ * @param to highest param
+ */
+ public void mapmesh1f(int style, int from, int to) ;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java
new file mode 100755
index 000000000..fdce39b46
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java
@@ -0,0 +1,121 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class for woking with linked list of curves
+ * @author Tomas Hrasky
+ *
+ */
+public class Curvelist {
+
+ /**
+ * Head of linked list
+ */
+ private Curve curve;
+
+ /**
+ * Holds conversion range borders
+ */
+ float[] range;
+
+ /**
+ * Subdivision step size
+ */
+ public float stepsize;
+
+ /**
+ * Do curves need subdivision?
+ */
+ private boolean needsSubdivision;
+
+ /**
+ * Makes new instance on top of specified lis of Quilts
+ * @param qlist underlaying list of quilts
+ * @param pta range start
+ * @param ptb range end
+ */
+ public Curvelist(Quilt qlist, float[] pta, float[] ptb) {
+ // DONE
+ curve = null;
+ range = new float[3];
+
+ for (Quilt q = qlist; q != null; q = q.next) {
+ curve = new Curve(q, pta, ptb, curve);
+ }
+ range[0] = pta[0];
+ range[1] = ptb[0];
+ range[2] = range[1] - range[0];
+ }
+
+ /**
+ * Compute step size
+ */
+ public void getstepsize() {
+ // DONE
+ stepsize = range[2];
+ Curve c;
+ for (c = curve; c != null; c = c.next) {
+ c.getStepSize();
+ c.clamp();
+ stepsize = (c.stepsize < stepsize) ? c.stepsize : stepsize;
+ if (c.needsSamplingSubdivision())
+ break;
+ }
+ needsSubdivision = (c != null) ? true : false;
+
+ }
+
+ /**
+ * Indicates whether curves need subdivision
+ * @return curves need subdivision
+ */
+ public boolean needsSamplingSubdivision() {
+ // DONE
+ return needsSubdivision;
+ }
+
+ /**
+ * Checks for culling
+ * @return Subdivider.CULL_TRIVIAL_REJECT or Subdivider.CULL_ACCEPT
+ */
+ public int cullCheck() {
+ // DONE
+ for (Curve c = curve; c != null; c = c.next)
+ if (c.cullCheck() == Subdivider.CULL_TRIVIAL_REJECT)
+ return Subdivider.CULL_TRIVIAL_REJECT;
+ return Subdivider.CULL_ACCEPT;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java
new file mode 100755
index 000000000..735c36edf
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java
@@ -0,0 +1,56 @@
+package com.sun.opengl.impl.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 1.1 (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 java.lang.reflect.Method;
+
+/**
+ * Display list
+ * @author Tomas Hrasky
+ *
+ */
+public class DisplayList {
+
+ /**
+ * Append action to the display list
+ * @param src source object to invoke method on
+ * @param m invoked method
+ * @param arg method argument
+ */
+ public void append(Object src, Method m, Object arg) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO displaylist append");
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java
new file mode 100755
index 000000000..d9e798854
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java
@@ -0,0 +1,130 @@
+package com.sun.opengl.impl.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 1.1 (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 java.util.Arrays;
+
+/**
+ * List of breakpoints
+ * @author Tomas Hrasky
+ *
+ */
+public class Flist {
+
+ /**
+ * Data elements end index
+ *
+ */
+ public int end;
+
+ /**
+ *Data elements start index
+ */
+ public int start;
+
+ /**
+ * Breakpoint values
+ */
+ public float[] pts;
+
+ /**
+ * Number of array fields
+ */
+ private int npts;
+
+ /**
+ * Grows list
+ * @param maxpts maximum desired size
+ */
+ public void grow(int maxpts) {
+ // DONE
+ if (npts < maxpts) {
+ // npts=2*maxpts;
+ npts = maxpts;
+ pts = new float[npts];
+ }
+ start = 0;
+ end = 0;
+ }
+
+ /**
+ * Removes duplicate array elemnts
+ */
+ public void filter() {
+ // INFO the aim of this method is to remove duplicates from array
+
+ Arrays.sort(pts);
+
+ start = 0;
+
+ int j = 0;
+
+ for (int i = 1; i < end; i++) {
+ if (pts[i] == pts[i - j - 1])
+ j++;
+ pts[i - j] = pts[i];
+ }
+
+ end -= j;
+
+ }
+
+ /**
+ * Sets start and and to real start and end of array elements
+ * @param from start from
+ * @param to end at
+ */
+ public void taper(float from, float to) {
+ // DONE
+
+ while (pts[start] != from) {
+ start++;
+ }
+
+ while (pts[end - 1] != to) {
+ end--;
+ }
+
+ }
+
+ /**
+ * Adds breakpoint value
+ * @param f value
+ */
+ public void add(float f) {
+ //DONE
+ pts[end++] = f;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java
new file mode 100755
index 000000000..bcb55388d
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java
@@ -0,0 +1,557 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Knot vector specification
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class Knotspec {
+
+ /**
+ * Begin of input knots
+ */
+ public CArrayOfFloats inkbegin;
+
+ /**
+ * End of input knots
+ */
+ public CArrayOfFloats inkend;
+
+ /**
+ * Stride before knot operations
+ */
+ public int prestride;
+
+ /**
+ * Curve order
+ */
+ public int order;
+
+ /**
+ * Next knot specification in linked list (used in surfaces)
+ */
+ public Knotspec next;
+
+ /**
+ * Last knot
+ */
+ public CArrayOfFloats klast;
+
+ /**
+ * First knot
+ */
+ CArrayOfFloats kfirst;
+
+ /**
+ * Beginning of breakpoints
+ */
+ CArrayOfBreakpts bbegin;
+
+ /**
+ * End of breakpoints
+ */
+ CArrayOfBreakpts bend;
+
+ /**
+ * Considered left end knot
+ */
+ CArrayOfFloats kleft;
+
+ /**
+ * Considered right end knot
+ */
+ CArrayOfFloats kright;
+
+ /**
+ * Offset before knot operations
+ */
+ int preoffset;
+
+ /**
+ * Control points array Length after knot operations
+ */
+ int postwidth;
+
+ /**
+ * Beginning of coeficients array
+ */
+ private CArrayOfFloats sbegin;
+
+ /**
+ * Beginning of output knots
+ */
+ private CArrayOfFloats outkbegin;
+
+ /**
+ * End of output knots
+ */
+ private CArrayOfFloats outkend;
+
+ /**
+ * Control points aray length before knot operations
+ */
+ int prewidth;
+
+ /**
+ * Offset after knot operations
+ */
+ int postoffset;
+
+ /**
+ * Number of control points' coordinates after knot operations
+ */
+ public int poststride;
+
+ /**
+ * Number of control points' coordinates
+ */
+ public int ncoords;
+
+ /**
+ * Tell whether knotspec has already benn transformed
+ */
+ public boolean istransformed;
+
+ /**
+ * Knotspec to be transformed
+ */
+ public Knotspec kspectotrans;
+
+ /**
+ * Finds knot border of knot insertion and required multiplicities
+ */
+ public void preselect() {
+ // DONE
+ float kval;
+
+ klast = new CArrayOfFloats(inkend);
+ klast.lessenPointerBy(order);
+ for (kval = klast.get(); klast.getPointer() != inkend.getPointer(); klast
+ .pp()) {
+ if (!Knotvector.identical(klast.get(), kval))
+ break;
+ }
+
+ kfirst = new CArrayOfFloats(inkbegin);
+ kfirst.raisePointerBy(order - 1);
+ for (kval = kfirst.get(); kfirst.getPointer() != inkend.getPointer(); kfirst
+ .pp()) {
+ if (!Knotvector.identical(kfirst.get(), kval))
+ break;
+ }
+
+ CArrayOfFloats k = new CArrayOfFloats(kfirst);
+ k.mm();
+
+ for (; k.getPointer() >= inkbegin.getPointer(); k.mm())
+ if (!Knotvector.identical(kval, k.get()))
+ break;
+ k.pp();
+
+ Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst
+ .getPointer()) + 1];
+ for (int i = 0; i < bbeginArray.length; i++)
+ bbeginArray[i] = new Breakpt();
+ bbegin = new CArrayOfBreakpts(bbeginArray, 0);
+ bbegin.get().multi = kfirst.getPointer() - k.getPointer();
+ bbegin.get().value = kval;
+
+ bend = new CArrayOfBreakpts(bbegin);
+ kleft = new CArrayOfFloats(kfirst);
+ kright = new CArrayOfFloats(kfirst);
+
+ }
+
+ /**
+ * Perpares knotspec for transformation
+ */
+ public void select() {
+ // DONE
+ breakpoints();
+ knots();
+ factors();
+
+ preoffset = kleft.getPointer() - (inkbegin.getPointer() + order);
+ postwidth = ((bend.getPointer() - bbegin.getPointer()) * order);
+ prewidth = (outkend.getPointer() - outkbegin.getPointer()) - order;
+ postoffset = (bbegin.get().def > 1) ? (bbegin.get().def - 1) : 0;
+
+ }
+
+ /**
+ * Computes alpha factors for computing new control points
+ */
+ private void factors() {
+ // DONE
+ CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend
+ .getPointer() - 1)
+ - order + bend.get().multi);
+
+ CArrayOfFloats fptr = null;
+ if (sbegin != null)
+ fptr = new CArrayOfFloats(sbegin);
+
+ for (CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt
+ .getPointer() >= bbegin.getPointer(); bpt.mm()) {
+ mid.lessenPointerBy(bpt.get().multi);
+ int def = bpt.get().def - 1;
+ if (def < 0)
+ continue;
+ float kv = bpt.get().value;
+
+ CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid
+ .getPointer() - def)
+ + (order - 1));
+ for (CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf
+ .getPointer()
+ + def); kl.getPointer() != kf.getPointer(); kl.mm()) {
+ CArrayOfFloats kh, kt;
+ for (kt = new CArrayOfFloats(kl), kh = new CArrayOfFloats(mid); kt
+ .getPointer() != kf.getPointer(); kh.mm(), kt.mm()) {
+ fptr.set((kv - kh.get()) / (kt.get() - kh.get()));
+ fptr.pp();
+ }
+ kl.set(kv);
+ }
+ }
+
+ }
+
+ /**
+ * Makes new knot vector
+ */
+ private void knots() {
+ // DONE
+ CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft
+ .getPointer()
+ - order);
+ CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright
+ .getPointer()
+ + bend.get().def);
+
+ outkbegin = new CArrayOfFloats(new float[inkend.getPointer()
+ - inkpt.getPointer()], 0);
+ CArrayOfFloats outkpt;
+ for (outkpt = new CArrayOfFloats(outkbegin); inkpt.getPointer() != inkend
+ .getPointer(); inkpt.pp(), outkpt.pp()) {
+ outkpt.set(inkpt.get());
+ }
+ outkend = new CArrayOfFloats(outkpt);
+ }
+
+ /**
+ * Analyzes breakpoints
+ */
+ private void breakpoints() {
+ // DONE
+ CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin);
+ CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend);
+ int nfactors = 0;
+
+ ubpt.get().value = ubend.get().value;
+ ubpt.get().multi = ubend.get().multi;
+
+ kleft = new CArrayOfFloats(kright);
+
+ for (; kright.getPointer() != klast.getPointer(); kright.pp()) {
+ if (Knotvector.identical(kright.get(), ubpt.get().value)) {
+ ubpt.get().multi++;
+ } else {
+ ubpt.get().def = order - ubpt.get().multi;
+ nfactors += (ubpt.get().def * (ubpt.get().def - 1)) / 2;
+ ubpt.pp();
+ ubpt.get().value = kright.get();
+ ubpt.get().multi = 1;
+ }
+ }
+ ubpt.get().def = order - ubpt.get().multi;
+ nfactors += (ubpt.get().def * (ubpt.get().def - 1)) / 2;
+
+ bend = new CArrayOfBreakpts(ubpt);
+
+ if (nfactors > 0) {
+ sbegin = new CArrayOfFloats(new float[nfactors], 0);
+ } else {
+ sbegin = null;
+ }
+
+ }
+
+ /**
+ * Copies control points
+ *
+ * @param _inpt
+ * input control points
+ * @param _outpt
+ * output control points
+ */
+ public void copy(CArrayOfFloats _inpt, CArrayOfFloats _outpt) {
+ CArrayOfFloats inpt = new CArrayOfFloats(_inpt);
+ CArrayOfFloats outpt = new CArrayOfFloats(_outpt);
+
+ inpt.raisePointerBy(preoffset);
+ if (next != null) {
+ for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(),
+ outpt.getPointer() + prewidth); outpt.getPointer() != lpt
+ .getPointer(); outpt.raisePointerBy(poststride)) {
+ next.copy(inpt, outpt);
+ inpt.raisePointerBy(prestride);
+ }
+
+ } else {
+ for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(),
+ outpt.getPointer() + prewidth); outpt.getPointer() != lpt
+ .getPointer(); outpt.raisePointerBy(poststride)) {
+ pt_io_copy(outpt, inpt);
+ inpt.raisePointerBy(prestride);
+ }
+ }
+
+ }
+
+ /**
+ * Copies one control point to other
+ *
+ * @param topt
+ * source control point
+ * @param frompt
+ * destination control point
+ */
+ private void pt_io_copy(CArrayOfFloats topt, CArrayOfFloats frompt) {
+ // DONE
+ switch (ncoords) {
+ case 4:
+ topt.setRelative(3, frompt.getRelative(3));
+ case 3:
+ topt.setRelative(2, frompt.getRelative(2));
+ case 2:
+ topt.setRelative(1, frompt.getRelative(1));
+ case 1:
+ topt.set(frompt.get());
+ break;
+ default:
+ // TODO break with copying in general case
+ // System.out.println("TODO knotspec.pt_io_copy");
+ break;
+ }
+
+ }
+
+ /**
+ * Inserts a knot
+ *
+ * @param _p
+ * inserted knot
+ */
+ public void transform(CArrayOfFloats _p) {
+ CArrayOfFloats p = new CArrayOfFloats(_p);
+ // DONE
+ if (next != null) {//surface code
+ if (this.equals(kspectotrans)) {
+ next.transform(p);
+ } else {
+ if (istransformed) {
+ p.raisePointerBy(postoffset);
+ for (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
+ .getPointer()
+ + prewidth);
+ for (; p.getPointer() != pend.getPointer(); p
+ .raisePointerBy(poststride))
+ next.transform(p);
+ }
+ }
+
+ } else {//code for curve
+ if (this.equals(kspectotrans)) {
+ insert(p);
+ } else {
+ if (istransformed) {
+ p.raisePointerBy(postoffset);
+ for (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
+ .getPointer()
+ + prewidth);
+ for (; p.getPointer() != pend.getPointer(); p
+ .raisePointerBy(poststride))
+ kspectotrans.insert(p);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Inserts a knot and computes new control points
+ *
+ * @param p
+ * inserted knot
+ */
+ private void insert(CArrayOfFloats p) {
+ // DONE
+ CArrayOfFloats fptr = null;
+ if (sbegin != null)
+ fptr = new CArrayOfFloats(sbegin);
+ 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()
+ + postwidth + postoffset - poststride);
+ // CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), postwidth +
+ // postoffset - poststride);
+ CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend);
+
+ for (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
+ .getPointer()
+ - poststride); p2.getPointer() != pend.getPointer(); p1
+ .setPointer(p2.getPointer()), p2
+ .lessenPointerBy(poststride)) {
+ pt_oo_sum(p1, p1, p2, fptr.get(), 1.0 - fptr.get());
+ fptr.pp();
+ }
+ }
+ bpt.mm();
+ for (; bpt.getPointer() >= bbegin.getPointer(); bpt.mm()) {
+
+ for (int multi = bpt.get().multi; multi > 0; multi--) {
+ pt_oo_copy(dstpt, srcpt);
+ dstpt.lessenPointerBy(poststride);
+ srcpt.lessenPointerBy(poststride);
+ }
+ for (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);
+
+ for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(),
+ srcpt.getPointer() - poststride); p2.getPointer() != pend
+ .getPointer(); p1.setPointer(p2.getPointer()), p2
+ .lessenPointerBy(poststride)) {
+ pt_oo_sum(p1, p1, p2, fptr.get(), 1.0 - fptr.get());
+ fptr.pp();
+ }
+ }
+ }
+ }
+
+ /**
+ * Copies one control point to another
+ *
+ * @param topt
+ * source ctrl point
+ * @param frompt
+ * distance ctrl point
+ */
+ private void pt_oo_copy(CArrayOfFloats topt, CArrayOfFloats frompt) {
+ // DONE
+ // this is a "trick" with case - "break" is omitted so it comes through all cases
+ switch (ncoords) {
+ case 4:
+ topt.setRelative(3, frompt.getRelative(3));
+ case 3:
+ topt.setRelative(2, frompt.getRelative(2));
+ case 2:
+ topt.setRelative(1, frompt.getRelative(1));
+ case 1:
+ topt.setRelative(0, frompt.getRelative(0));
+ break;
+ default:
+ // default uses memcpy but it is not needed (we probably won't have more than 4 coords)
+ // TODO not sure about it
+ break;
+ }
+
+ }
+
+ /**
+ * Computes new control point
+ *
+ * @param x
+ * first point
+ * @param y
+ * second point
+ * @param z
+ * third pont
+ * @param a
+ * alpha
+ * @param b
+ * 1 - alpha
+ */
+ private void pt_oo_sum(CArrayOfFloats x, CArrayOfFloats y,
+ CArrayOfFloats z, float a, double b) {
+ // DONE
+ switch (ncoords) {
+ case 4:
+ x.setRelative(3, (float) (a * y.getRelative(3) + b
+ * z.getRelative(3)));
+ case 3:
+ x.setRelative(2, (float) (a * y.getRelative(2) + b
+ * z.getRelative(2)));
+ case 2:
+ x.setRelative(1, (float) (a * y.getRelative(1) + b
+ * z.getRelative(1)));
+ case 1:
+ x.setRelative(0, (float) (a * y.getRelative(0) + b
+ * z.getRelative(0)));
+ break;
+ default:
+ //no need of default - see previous method and its case statement
+ // System.out.println("TODO pt_oo_sum default");
+ break;
+ }
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java
new file mode 100755
index 000000000..c7c3d4578
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java
@@ -0,0 +1,179 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Knot vector used in curve specification
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class Knotvector {
+
+ /**
+ * Tolerance used when comparing knots - when difference is smaller, knots
+ * are considered equal
+ */
+ public static final float TOLERANCE = 1.0e-5f;
+
+ /**
+ * Maximum curve order
+ */
+ private static final int MAXORDER = 24;
+
+ /**
+ * Number of knots
+ */
+ int knotcount;
+
+ /**
+ * Number of control points' coordinates
+ */
+ int stride;
+
+ /**
+ * Curve order
+ */
+ int order;
+
+ /**
+ * Knots
+ */
+ float[] knotlist;
+
+ /**
+ * Makes new knotvector
+ *
+ * @param nknots
+ * number of knots
+ * @param stride
+ * number of ctrl points' corrdinates
+ * @param order
+ * curve order
+ * @param knot
+ * knots
+ */
+ public Knotvector(int nknots, int stride, int order, float[] knot) {
+ // DONE
+ init(nknots, stride, order, knot);
+ }
+
+ /**
+ * Initializes knotvector
+ *
+ * @param nknots
+ * number of knots
+ * @param stride
+ * number of ctrl points' corrdinates
+ * @param order
+ * curve order
+ * @param knot
+ * knots
+ */
+ public void init(int nknots, int stride, int order, float[] knot) {
+ // DONE
+ this.knotcount = nknots;
+ this.stride = stride;
+ this.order = order;
+ this.knotlist = new float[nknots];
+ for (int i = 0; i < nknots; i++) {
+ this.knotlist[i] = knot[i];
+ }
+
+ }
+
+ /**
+ * Validates knot vector parameters
+ *
+ * @return knot vector validity
+ */
+ public int validate() {
+ int kindex = knotcount - 1;
+ if (order < 1 || order > MAXORDER) {
+ return 1;
+ }
+ if (knotcount < 2 * order) {
+ return 2;
+ }
+ if (identical(knotlist[kindex - (order - 1)], knotlist[order - 1])) {
+ return 3;
+ }
+ for (int i = 0; i < kindex; i++) {
+ if (knotlist[i] > knotlist[i + 1])
+ return 4;
+ }
+ int multi = 1;
+ for (; kindex >= 1; kindex--) {
+ if (knotlist[kindex] - knotlist[kindex - 1] < TOLERANCE) {
+ multi++;
+ continue;
+ }
+ if (multi > order) {
+ return 5;
+ }
+ multi = 1;
+ }
+ if (multi > order) {
+ return 5;
+ }
+
+ return 0;
+ }
+
+ /**
+ * Show specified message
+ *
+ * @param msg
+ * message to be shown
+ */
+ public void show(String msg) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO knotvector.show");
+
+ }
+
+ /**
+ * Compares two knots for equality
+ *
+ * @param a
+ * first knot
+ * @param b
+ * second knot
+ * @return knots are/are not equal
+ */
+ public static boolean identical(float a, float b) {
+ return ((a - b) < TOLERANCE) ? true : false;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java
new file mode 100755
index 000000000..8b52a4a8a
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java
@@ -0,0 +1,442 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding properties of OpenGL map
+ * @author Tomas Hrasky
+ *
+ */
+public class Mapdesc {
+
+ /**
+ * Maximum control point coords
+ */
+ private static final int MAXCOORDS = 5;
+
+ /**
+ * Next description in list
+ */
+ public Mapdesc next;
+
+ /**
+ * Is map rational
+ */
+ public int isrational;
+
+ /**
+ * Number of control point coords
+ */
+ public int ncoords;
+
+ /**
+ * Map type
+ */
+ private int type;
+
+ /**
+ * Number of homogenous coords
+ */
+ private int hcoords;
+
+ /**
+ * Number of inhomogenous coords
+ */
+ private int inhcoords;
+
+ /**
+ * Not used
+ */
+ private int mask;
+
+ /**
+ * Value of N_PIXEL_TOLERANCE property
+ */
+ private float pixel_tolerance;
+
+ /**
+ * Value of N_ERROR_TOLERANCE property
+ */
+ private float error_tolerance;
+
+ /**
+ * Value of N_BBOX_SUBDIVIDING property
+ */
+ private float bbox_subdividing;
+
+ /**
+ * Value of N_CULLING property
+ */
+ private float culling_method;
+
+ /**
+ * Value of N_SAMPLINGMETHOD property
+ */
+ private float sampling_method;
+
+ /**
+ * Value of N_CLAMPFACTOR property
+ */
+ float clampfactor;
+
+ /**
+ * Value of N_MINSAVINGS property
+ */
+ private float minsavings;
+
+ /**
+ * Steps in u direction
+ */
+ private float s_steps;
+
+ /**
+ * Steps in v direction
+ */
+ private float t_steps;
+
+ /**
+ * Maximal step
+ */
+ float maxrate;
+
+ /**
+ * Maximal u direction step
+ */
+ private float maxsrate;
+
+ /**
+ * Maximal v direction step
+ */
+ private float maxtrate;
+
+ /**
+ * Not used
+ */
+ private float[][] bmat;
+
+ /**
+ * Sampling matrix
+ */
+ private float[][] smat;
+
+ /**
+ * Not used
+ */
+ private float[][] cmat;
+
+ /**
+ * Not used
+ */
+ private float[] bboxsize;
+
+ /**
+ * Makes new mapdesc
+ * @param type map type
+ * @param rational is rational
+ * @param ncoords number of control points coords
+ * @param backend backend object
+ */
+ public Mapdesc(int type, int rational, int ncoords, Backend backend) {
+ // DONE
+ this.type = type;
+ this.isrational = rational;
+ this.ncoords = ncoords;
+ this.hcoords = ncoords + (isrational > 0 ? 0 : 1);
+ this.inhcoords = ncoords - (isrational > 0 ? 1 : 0);
+ this.mask = ((1 << (inhcoords * 2)) - 1);
+ next = null;
+
+ assert (hcoords <= MAXCOORDS);
+ assert (inhcoords >= 1);
+
+ pixel_tolerance = 1f;
+ error_tolerance = 1f;
+ bbox_subdividing = NurbsConsts.N_NOBBOXSUBDIVISION;
+ culling_method = NurbsConsts.N_NOCULLING;
+ sampling_method = NurbsConsts.N_NOSAMPLING;
+ clampfactor = NurbsConsts.N_NOCLAMPING;
+ minsavings = NurbsConsts.N_NOSAVINGSSUBDIVISION;
+ s_steps = 0f;
+ t_steps = 0f;
+
+ maxrate = (s_steps < 0) ? 0 : s_steps;
+ maxsrate = (s_steps < 0) ? 0 : s_steps;
+ maxtrate = (t_steps < 0) ? 0 : t_steps;
+ bmat = new float[MAXCOORDS][MAXCOORDS];
+ cmat = new float[MAXCOORDS][MAXCOORDS];
+ smat = new float[MAXCOORDS][MAXCOORDS];
+
+ identify(bmat);
+ identify(cmat);
+ identify(smat);
+ bboxsize = new float[MAXCOORDS];
+ for (int i = 0; i < inhcoords; i++)
+ bboxsize[i] = 1;
+ }
+
+ /**
+ * Make matrix identity matrix
+ * @param arr matrix
+ */
+ private void identify(float[][] arr) {
+ // DONE
+ for (int i = 0; i < MAXCOORDS; i++)
+ for (int j = 0; j < MAXCOORDS; j++)
+ arr[i][j] = 0;
+ for (int i = 0; i < MAXCOORDS; i++)
+ arr[i][i] = 1;
+
+ }
+
+ /**
+ * Tells whether tag is property tag
+ * @param tag property tag
+ * @return is/is not property
+ */
+ public boolean isProperty(int tag) {
+ boolean ret;
+ switch (tag) {
+ case NurbsConsts.N_PIXEL_TOLERANCE:
+ case NurbsConsts.N_ERROR_TOLERANCE:
+ case NurbsConsts.N_CULLING:
+ case NurbsConsts.N_BBOX_SUBDIVIDING:
+ case NurbsConsts.N_S_STEPS:
+ case NurbsConsts.N_T_STEPS:
+ case NurbsConsts.N_SAMPLINGMETHOD:
+ case NurbsConsts.N_CLAMPFACTOR:
+ case NurbsConsts.N_MINSAVINGS:
+ ret = true;
+ break;
+ default:
+ ret = false;
+ break;
+ }
+ return ret;
+ }
+
+ /**
+ * Returns number of control points' coords
+ * @return number of control points' coords
+ */
+ public int getNCoords() {
+ return ncoords;
+ }
+
+ /**
+ * Returns map type
+ * @return map type
+ */
+ public int getType() {
+ return type;
+ }
+
+ /**
+ * Tells whether map is range sampling
+ * @return is map range sampling
+ */
+ public boolean isRangeSampling() {
+ // DONE
+ return (isParametricDistanceSampling() || isPathLengthSampling()
+ || isSurfaceAreaSampling() || isObjectSpaceParaSampling() || isObjectSpacePathSampling());
+ }
+
+ /**
+ * Tells whether map is object space sampling
+ * @return is map object space sampling
+ */
+ private boolean isObjectSpacePathSampling() {
+ // DONE
+ return sampling_method == NurbsConsts.N_OBJECTSPACE_PATH;
+ }
+
+ /**
+ * Tells whether map is object space parasampling
+ * @return is map object space parasampling
+ */
+ private boolean isObjectSpaceParaSampling() {
+ // DONE
+ return sampling_method == NurbsConsts.N_OBJECTSPACE_PARA;
+ }
+
+ /**
+ * Tells whether map is area sampling surface
+ * @return is map area sampling surface
+ */
+ private boolean isSurfaceAreaSampling() {
+ // DONE
+ return sampling_method == NurbsConsts.N_SURFACEAREA;
+ }
+
+ /**
+ * Tells whether map is path length sampling
+ * @return is map path length sampling
+ */
+ boolean isPathLengthSampling() {
+ // DONE
+ return sampling_method == NurbsConsts.N_PATHLENGTH;
+ }
+
+ /**
+ * Tells whether map is parametric distance sampling
+ * @return is map parametric distance sampling
+ */
+ boolean isParametricDistanceSampling() {
+ // DONE
+ return sampling_method == NurbsConsts.N_PARAMETRICDISTANCE;
+ }
+
+ /**
+ * Tells whether map is culling
+ * @return is map culling
+ */
+ public boolean isCulling() {
+ // DONE
+ return culling_method != NurbsConsts.N_NOCULLING ? true : false;
+ }
+
+ /**
+ * Tells whether map is constantly sampling
+ * @return is map constant sampling
+ */
+ public boolean isConstantSampling() {
+ return (sampling_method == NurbsConsts.N_FIXEDRATE) ? true : false;
+ }
+
+ /**
+ * Tells whether map is domain sampling
+ * @return is map domain sampling
+ */
+ public boolean isDomainSampling() {
+ return (sampling_method == NurbsConsts.N_DOMAINDISTANCE) ? true : false;
+ }
+
+ /**
+ * Returns property of specified tag value
+ * @param tag property tag
+ * @return property value
+ */
+ public float getProperty(int tag) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO mapdesc.getproperty");
+ return 0;
+ }
+
+ /**
+ * Sets property with given tag
+ * @param tag property tag
+ * @param value desired value
+ */
+ public void setProperty(int tag, float value) {
+ // TODO Auto-generated method stub
+ switch (tag) {
+ case NurbsConsts.N_PIXEL_TOLERANCE:
+ pixel_tolerance = value;
+ break;
+ case NurbsConsts.N_ERROR_TOLERANCE:
+ error_tolerance = value;
+ break;
+ case NurbsConsts.N_CULLING:
+ culling_method = value;
+ break;
+ case NurbsConsts.N_BBOX_SUBDIVIDING:
+ if (value <= 0)
+ value = NurbsConsts.N_NOBBOXSUBDIVISION;
+ bbox_subdividing = value;
+ break;
+ case NurbsConsts.N_S_STEPS:
+ if (value < 0)
+ value = 0;
+ s_steps = value;
+ maxrate = value;
+ maxsrate = value;
+ break;
+ case NurbsConsts.N_T_STEPS:
+ if (value < 0)
+ value = 0;
+ t_steps = value;
+ maxtrate = value;
+ break;
+ case NurbsConsts.N_SAMPLINGMETHOD:
+ sampling_method = value;
+ break;
+ case NurbsConsts.N_CLAMPFACTOR:
+ if (value < 0)
+ value = 0;
+ clampfactor = value;
+ break;
+ case NurbsConsts.N_MINSAVINGS:
+ if (value <= 0)
+ value = NurbsConsts.N_NOSAVINGSSUBDIVISION;
+ minsavings = value;
+ break;
+ }
+ }
+
+ /**
+ * Samples curve
+ * @param pts control points
+ * @param order curve order
+ * @param stride number of control points' coordinates
+ * @param sp breakpoints
+ * @param outstride output number of control points' coordinates
+ */
+ public void xformSampling(CArrayOfFloats pts, int order, int stride,
+ float[] sp, int outstride) {
+ // DONE
+ xFormMat(smat, pts, order, stride, sp, outstride);
+ }
+
+ /**
+ * Empty method
+ * @param mat sampling matrix
+ * @param pts ontrol points
+ * @param order curve order
+ * @param stride number of control points' coordinates
+ * @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) {
+ // TODO Auto-generated method stub
+
+ // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats");
+
+ if (isrational > 0) {
+
+ } else {
+
+ }
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java
new file mode 100755
index 000000000..3b6e22ea5
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java
@@ -0,0 +1,122 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding list of Mapdescs
+ * @author Tomáš Hráský
+ *
+ */
+public class Maplist {
+ /**
+ * Head of linked list
+ */
+ private Mapdesc maps;
+
+ /**
+ * Backend class
+ */
+ private Backend backend;
+
+ /**
+ * Makes new Maplist
+ * @param backend Backend class
+ */
+ public Maplist(Backend backend) {
+ this.backend = backend;
+ }
+
+ /**
+ * Sets linked list beginning to null
+ */
+ public void initialize() {
+ // TODO mapdespool.clear ?
+ maps = null;
+ }
+
+ /**
+ * Defines new Mapdesc if it is not defined and appends it to linked list
+ * @param type map type
+ * @param rational is map rational
+ * @param ncoords number of coords
+ */
+ public void define(int type, int rational, int ncoords) {
+ // DONE
+ Mapdesc m = locate(type);
+ assert (m == null || (m.isrational == rational && m.ncoords == ncoords));
+ add(type, rational, ncoords);
+
+ }
+
+ /**
+ * Adds new Mapdesc to linked list
+ * @param type map type
+ * @param rational is map rational
+ * @param ncoords number of coords
+ */
+ private void add(int type, int rational, int ncoords) {
+ // DONE
+ Mapdesc map = new Mapdesc(type, rational, ncoords, backend);
+ if (maps == null) {
+ maps = map;
+ } else {
+ map.next = maps;
+ maps = map;
+ }
+ }
+
+ /**
+ * Tries to find Mapdesc in linked list
+ * @param type map type
+ * @return Mapdesc of type or null if there is no such map
+ */
+ public Mapdesc locate(int type) {
+ // DONE
+ Mapdesc m = null;
+ for (m = maps; m != null; m = m.next)
+ if (m.getType() == type)
+ break;
+ return m;
+ }
+
+ /**
+ * Alias for locate
+ * @param type maptype
+ * @return Mapdesc of type or null if there is no such map
+ */
+ public Mapdesc find(int type) {
+ return locate(type);
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java
new file mode 100755
index 000000000..c98e74b7c
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java
@@ -0,0 +1,184 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class hodling NURBS constants as seen in OpenGL GLU documentation
+ * @author JOGL project
+ *
+ */
+public class NurbsConsts {
+ /*
+ * NURBS Properties - one set per map, each takes a single INREAL arg
+ */
+ public static final int N_SAMPLING_TOLERANCE = 1;
+
+ public static final int N_S_RATE = 6;
+
+ public static final int N_T_RATE = 7;
+
+ public static final int N_CLAMPFACTOR = 13;
+
+ public static final float N_NOCLAMPING = 0.0f;
+
+ public static final int N_MINSAVINGS = 14;
+
+ public static final float N_NOSAVINGSSUBDIVISION = 0.0f;
+
+ /*
+ * NURBS Properties - one set per map, each takes an enumerated value
+ */
+ public static final int N_CULLING = 2;
+
+ public static final float N_NOCULLING = 0.0f;
+
+ public static final float N_CULLINGON = 1.0f;
+
+ public static final int N_SAMPLINGMETHOD = 10;
+
+ public static final float N_NOSAMPLING = 0.0f;
+
+ public static final float N_FIXEDRATE = 3.0f;
+
+ public static final float N_DOMAINDISTANCE = 2.0f;
+
+ public static final float N_PARAMETRICDISTANCE = 5.0f;
+
+ public static final float N_PATHLENGTH = 6.0f;
+
+ public static final float N_SURFACEAREA = 7.0f;
+
+ public static final float N_OBJECTSPACE_PARA = 8.0f;
+
+ public static final float N_OBJECTSPACE_PATH = 9.0f;
+
+ public static final int N_BBOX_SUBDIVIDING = 17;
+
+ public static final float N_NOBBOXSUBDIVISION = 0.0f;
+
+ public static final float N_BBOXTIGHT = 1.0f;
+
+ public static final float N_BBOXROUND = 2.0f;
+
+ /*
+ * NURBS Rendering Properties - one set per renderer each takes an
+ * enumerated value
+ */
+ public static final int N_DISPLAY = 3;
+
+ public static final int N_FILL = 1;
+
+ public static final int N_OUTLINE_POLY = 2;
+
+ public static final int N_OUTLINE_TRI = 3;
+
+ public static final int N_OUTLINE_QUAD = 4;
+
+ public static final int N_OUTLINE_PATCH = 5;
+
+ public static final int N_OUTLINE_PARAM = 6;
+
+ public static final int N_OUTLINE_PARAM_S = 7;
+
+ public static final int N_OUTLINE_PARAM_ST = 8;
+
+ public static final int N_OUTLINE_SUBDIV = 9;
+
+ public static final int N_OUTLINE_SUBDIV_S = 10;
+
+ public static final int N_OUTLINE_SUBDIV_ST = 11;
+
+ public static final int N_ISOLINE_S = 12;
+
+ public static final int N_ERRORCHECKING = 4;
+
+ public static final int N_NOMSG = 0;
+
+ public static final int N_MSG = 1;
+
+ /* GL 4.0 propeties not defined above */
+
+ public static final int N_PIXEL_TOLERANCE = N_SAMPLING_TOLERANCE;
+
+ public static final int N_ERROR_TOLERANCE = 20;
+
+ public static final int N_SUBDIVISIONS = 5;
+
+ public static final int N_TILES = 8;
+
+ public static final int N_TMP1 = 9;
+
+ public static final int N_TMP2 = N_SAMPLINGMETHOD;
+
+ public static final int N_TMP3 = 11;
+
+ public static final int N_TMP4 = 12;
+
+ public static final int N_TMP5 = N_CLAMPFACTOR;
+
+ public static final int N_TMP6 = N_MINSAVINGS;
+
+ public static final int N_S_STEPS = N_S_RATE;
+
+ public static final int N_T_STEPS = N_T_RATE;
+
+ /*
+ * NURBS Rendering Properties - one set per map, each takes an INREAL matrix
+ * argument
+ */
+ public static final int N_CULLINGMATRIX = 1;
+
+ public static final int N_SAMPLINGMATRIX = 2;
+
+ public static final int N_BBOXMATRIX = 3;
+
+ /*
+ * NURBS Rendering Properties - one set per map, each takes an INREAL vector
+ * argument
+ */
+ public static final int N_BBOXSIZE = 4;
+
+ /* type argument for trimming curves */
+
+ public static final int N_P2D = 0x8;
+
+ public static final int N_P2DR = 0xd;
+
+ public static final int N_MESHLINE = 1;
+
+ public static final int N_MESHFILL = 0;
+
+ public static final int N_MESHPOINT = 2;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java
new file mode 100755
index 000000000..b130226c4
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java
@@ -0,0 +1,63 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Struct holding curve links
+ * @author Tomáš Hráský
+ *
+ */
+public class O_curve {
+
+ /**
+ * Curve type
+ */
+ public int curvetype;
+
+ /**
+ * Next curve in linked list
+ */
+ public O_curve next;
+
+ /**
+ * Curve of picewiselinear type
+ */
+ public O_pwlcurve o_pwlcurve;
+
+ /**
+ * NURBS curve
+ */
+ public O_nurbscurve o_nurbscurve;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java
new file mode 100755
index 000000000..68bf60b27
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java
@@ -0,0 +1,80 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * NURBS curve object
+ * @author Tomáš Hráský
+ *
+ */
+public class O_nurbscurve {
+
+ /**
+ * List of bezier curves
+ */
+ public Quilt bezier_curves;
+
+ /**
+ * Curve type
+ */
+ public int type;
+
+ /**
+ * Was curve used ?
+ */
+ public boolean used;
+
+ /**
+ * Parent curve
+ */
+ public O_curve owner;
+
+ /**
+ * Next curve in list
+ */
+ public O_nurbscurve next;
+
+ /**
+ * Makes new O_nurbscurve
+ * @param realType type of curve
+ */
+ public O_nurbscurve(int realType) {
+ // DONE
+ this.type = realType;
+ this.owner = null;
+ this.next = null;
+ this.used = false;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java
new file mode 100755
index 000000000..1cbaa6ccc
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java
@@ -0,0 +1,79 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * NURBS surface object
+ * @author Tomáš Hráský
+ *
+ */
+public class O_nurbssurface {
+
+ /**
+ * List of bezier patches forming NURBS surface
+ */
+ public Quilt bezier_patches;
+
+ /**
+ * Was surface used
+ */
+ public boolean used;
+
+ /**
+ * Parent O_surface
+ */
+ public O_surface owner;
+
+ /**
+ * Next surface in list
+ */
+ public O_nurbssurface next;
+
+ /**
+ * Surface type
+ */
+ private int type;
+
+ /**
+ * Makes new O_nurbssurface of type
+ * @param type surface type
+ */
+ public O_nurbssurface(int type) {
+ this.type = type;
+ this.owner = null;
+ this.next = null;
+ this.used = false;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java
new file mode 100755
index 000000000..4dec066d6
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java
@@ -0,0 +1,44 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Empty class
+ * @author Tomáš Hráský
+ *
+ */
+public class O_pwlcurve {
+
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java
new file mode 100755
index 000000000..4ef680c2f
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java
@@ -0,0 +1,52 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Surface object
+ * @author Tomáš Hráský
+ *
+ */
+public class O_surface {
+ /**
+ * NURBS surface
+ */
+ public O_nurbssurface o_nurbssurface;
+
+ /**
+ * Trims
+ */
+ public O_trim o_trim;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java
new file mode 100755
index 000000000..c1f61ebab
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java
@@ -0,0 +1,44 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Empty class
+ * @author Tomáš Hráský
+ *
+ */
+public class O_trim {
+
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java
new file mode 100755
index 000000000..f15ad1f92
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java
@@ -0,0 +1,54 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Empty class
+ * @author Tomas Hrasky
+ *
+ */
+public class Patch {
+
+ /**
+ * Empty constructor
+ * @param q
+ * @param pta
+ * @param ptb
+ * @param patch
+ */
+ public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) {
+ // System.out.println("TODO patch.constructor");
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java
new file mode 100755
index 000000000..b2b9033ec
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java
@@ -0,0 +1,145 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * List of patches
+ * @author Tomáš Hráský
+ *
+ */
+public class Patchlist {
+
+ /**
+ * Array of ranges
+ */
+ public Pspec[] pspec;
+
+ /**
+ * head of list of patches
+ */
+ private Patch patch;
+
+ /**
+ * Makes new list of patches
+ * @param quilts list of quilts
+ * @param pta low border
+ * @param ptb high border
+ */
+ public Patchlist(Quilt quilts, float[] pta, float[] ptb) {
+ // DONE
+ patch = null;
+
+ for (Quilt q = quilts; q != null; q = q.next)
+ patch = new Patch(q, pta, ptb, patch);
+ pspec[0] = new Pspec();
+ pspec[0].range[0] = pta[0];
+ pspec[0].range[1] = ptb[0];
+ pspec[0].range[2] = ptb[0] - pta[0];
+ pspec[1] = new Pspec();
+ pspec[1].range[0] = pta[1];
+ pspec[1].range[1] = ptb[1];
+ pspec[1].range[2] = ptb[1] - pta[1];
+
+ }
+
+ /**
+ * Empty constructor
+ * @param patchlist
+ * @param param
+ * @param mid
+ */
+ public Patchlist(Patchlist patchlist, int param, float mid) {
+ // TODO Auto-generated constructor stub
+ // System.out.println("TODO patchlist.konstruktor 2");
+ }
+
+ /**
+ * Empty method
+ * @return 0
+ */
+ public int cullCheck() {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO patchlist.cullcheck");
+ return 0;
+ }
+
+ /**
+ * Empty method
+ */
+ public void getstepsize() {
+ // System.out.println("TODO patchlist.getsptepsize");
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Empty method
+ * @return false
+ */
+ public boolean needsSamplingSubdivision() {
+ // TODO Auto-generated method stub
+ // System.out.println("patchlist.needsSamplingSubdivision");
+ return false;
+ }
+
+ /**
+ * Empty method
+ * @param i
+ * @return false
+ */
+ public boolean needsSubdivision(int i) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO patchlist.needsSubdivision");
+ return false;
+ }
+
+ /**
+ * Empty method
+ * @return false
+ */
+ public boolean needsNonSamplingSubdivision() {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO patchlist.needsNonSamplingSubdivision");
+ return false;
+ }
+
+ /**
+ * Empty method
+ */
+ public void bbox() {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO patchlist.bbox");
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java
new file mode 100755
index 000000000..e0ad1dd32
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java
@@ -0,0 +1,75 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class representing property
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class Property {
+
+ /**
+ * Property type
+ */
+ public int type;
+
+ /**
+ * Property id
+ */
+ public int tag;
+
+ /**
+ * Property value
+ */
+ public float value;
+
+ /**
+ * Makes new property with given parameters
+ *
+ * @param type
+ * property type
+ * @param tag
+ * property id
+ * @param value
+ * property value
+ */
+ public Property(int type, int tag, float value) {
+ this.type = type;
+ this.tag = tag;
+ this.value = value;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java
new file mode 100755
index 000000000..5fc66fa82
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java
@@ -0,0 +1,47 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding range
+ * @author Tomáš Hráský
+ *
+ */
+public class Pspec {
+ /**
+ * Range
+ */
+ public float[] range;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java
new file mode 100755
index 000000000..6b8255d85
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java
@@ -0,0 +1,71 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Picewiselinar trimming arc
+ * @author Tomáš Hráský
+ *
+ */
+public class PwlArc {
+
+ /**
+ * Number of points
+ */
+ private int npts;
+
+ /**
+ * Vertexes
+ */
+ public TrimVertex[] pts;
+
+ /**
+ * Arc type
+ */
+ private int type;
+
+ /**
+ * Makes new trimming arc
+ * @param i num ber of vertexes
+ * @param p trimming vertexes array
+ */
+ public PwlArc(int i, TrimVertex[] p) {
+ // DONE
+ this.npts = i;
+ this.pts = p;
+ type = NurbsConsts.N_P2D;
+
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java
new file mode 100755
index 000000000..bc058b093
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java
@@ -0,0 +1,282 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class for converting NURBS curves and surfaces to list of bezier arcs or patches repectively
+ * @author Tomáš Hráský
+ *
+ */
+public class Quilt {
+ /**
+ * Maximum quilt dimension
+ */
+ private static final int MAXDIM = 2;
+
+ /**
+ * List of map descriptions
+ */
+ Mapdesc mapdesc;
+
+ /**
+ * Array of quiltspecs pointer
+ */
+ public CArrayOfQuiltspecs qspec;
+
+ /**
+ * End array of quilt specs pointer
+ */
+ public CArrayOfQuiltspecs eqspec;
+
+ /**
+ * Control points
+ */
+ public CArrayOfFloats cpts;
+
+ /**
+ * Next quilt in list
+ */
+ public Quilt next;
+
+ /**
+ * Makes new quilt with mapdesc
+ * @param mapdesc map description
+ */
+ public Quilt(Mapdesc mapdesc) {
+ // DONE
+ this.mapdesc = mapdesc;
+ Quiltspec[] tmpquilts = new Quiltspec[MAXDIM];
+ for (int i = 0; i < tmpquilts.length; i++)
+ tmpquilts[i] = new Quiltspec();
+ this.qspec = new CArrayOfQuiltspecs(tmpquilts);
+
+ }
+
+ /**
+ * Converts NURBS surface to bezier patches
+ * @param sknotvector knots in u direction
+ * @param tknotvector knots in v direction
+ * @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);
+ spline.kspecinit(sknotvector, tknotvector);
+ spline.select();
+ spline.layout(coords);
+ spline.setupquilt(this);
+ spline.copy(ctrlarr);
+ spline.transform();
+ }
+
+ /**
+ * Converts NURBS curve to list of bezier curves
+ * @param knots knot vector
+ * @param ctlarray control points
+ * @param ncoords number of coordinates
+ */
+ public void toBezier(Knotvector knots, CArrayOfFloats ctlarray, int ncoords) {
+ // DONE
+ Splinespec spline = new Splinespec(1);
+ spline.kspecinit(knots);
+ spline.select();
+ spline.layout(ncoords);
+ spline.setupquilt(this);
+ spline.copy(ctlarray);
+ spline.transform();
+ }
+
+ /**
+ * Walks thru all arcs/patches
+ * @param pta low border
+ * @param ptb high border
+ * @param backend Backend
+ */
+ public void downloadAll(float[] pta, float[] ptb, Backend backend) {
+ // DONE
+ for (Quilt m = this; m != null; m = m.next) {
+ m.select(pta, ptb);
+ m.download(backend);
+ }
+
+ }
+
+ /**
+ * Renders arcs/patches
+ * @param backend Backend for rendering
+ */
+ private void download(Backend backend) {
+ // DONE
+ if (getDimension() == 2) {
+
+ 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
+ * qspec.get(0).stride);
+ ps.raisePointerBy(qspec.get(1).index * qspec.get(1).order
+ * qspec.get(1).stride);
+
+ backend.surfpts(mapdesc.getType(), ps, qspec.get(0).stride, qspec
+ .get(1).stride, qspec.get(0).order, qspec.get(1).order,
+ qspec.get(0).breakpoints[qspec.get(0).index],
+ qspec.get(0).breakpoints[qspec.get(0).index + 1], qspec
+ .get(1).breakpoints[qspec.get(1).index], qspec
+ .get(1).breakpoints[qspec.get(1).index + 1]);
+
+ } else {// code for curves
+ // CArrayOfFloats ps=new CArrayOfFloats(cpts);
+ 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);
+ backend.curvpts(mapdesc.getType(), ps, qspec.get(0).stride, qspec
+ .get(0).order,
+ qspec.get(0).breakpoints[qspec.get(0).index],
+ qspec.get(0).breakpoints[qspec.get(0).index + 1]);
+ }
+
+ }
+
+ /**
+ * Returns quilt dimension
+ * @return quilt dimesion
+ */
+ private int getDimension() {
+ // DONE
+ return eqspec.getPointer() - qspec.getPointer();
+ }
+
+ /**
+ * Finds Quiltspec.index
+ * @param pta range
+ * @param ptb range
+ */
+ private void select(float[] pta, float[] ptb) {
+ // DONE
+ 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--)
+ if (qspec.get(i).breakpoints[j] <= pta[i]
+ && ptb[i] <= qspec.get(i).breakpoints[j + 1])
+ break;
+ assert (j != -1);
+ qspec.get(i).index = j;
+ }
+ }
+
+ /**
+ * Find range according to breakpoints
+ * @param from low param
+ * @param to high param
+ * @param bpts breakpoints
+ */
+ public void getRange(float[] from, float[] to, Flist bpts) {
+ // DONE
+ getRange(from, to, 0, bpts);
+
+ }
+
+ /**
+ * Find range according to breakpoints
+ * @param from low param
+ * @param to high param
+ * @param i from/to array index
+ * @param list breakpoints
+ */
+ private void getRange(float[] from, float[] to, int i, Flist list) {
+ // DONE
+ 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;
+ Quilt m;
+ for (m = maps; m != null; m = m.next) {
+ if (m.qspec.get(i).breakpoints[0] > from[i])
+ from[i] = m.qspec.get(i).breakpoints[0];
+ if (m.qspec.get(i).breakpoints[m.qspec.get(i).width] < to[i])
+ to[i] = m.qspec.get(i).breakpoints[m.qspec.get(i).width];
+ maxpts += m.qspec.get(i).width + 1;
+ }
+ list.grow(maxpts);
+ for (m = maps; m != null; m = m.next) {
+ for (int j = 0; j <= m.qspec.get(i).width; j++) {
+ list.add(m.qspec.get(i).breakpoints[j]);
+ }
+ }
+ list.filter();
+ list.taper(from[i], to[i]);
+ }
+
+ /**
+ * Is this quilt culled
+ * @return 0 or Subdivider.CULL_ACCEPT
+ */
+ public int isCulled() {
+ if (mapdesc.isCulling()) {
+ // System.out.println("TODO quilt.isculled mapdesc.isculling");
+ return 0;
+ } else {
+ return Subdivider.CULL_ACCEPT;
+ }
+ }
+
+ /**
+ * Finds range for surface
+ * @param from low param
+ * @param to high param
+ * @param slist u direction breakpoints
+ * @param tlist v direction breakpoints
+ */
+ public void getRange(float[] from, float[] to, Flist slist, Flist tlist) {
+ // DONE
+ getRange(from, to, 0, slist);
+ getRange(from, to, 1, tlist);
+
+ }
+
+ /**
+ * Empty method
+ * @param sbrkpts
+ * @param tbrkpts
+ * @param rate
+ */
+ public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO quilt.findrates");
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java
new file mode 100755
index 000000000..d94986a03
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java
@@ -0,0 +1,85 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Quilt definition
+ * @author Tomas Hrasky
+ *
+ */
+public class Quiltspec {
+
+ /**
+ * Stride between control points
+ */
+ public int stride;
+
+ /**
+ * Quilt width in breakpoints
+ */
+ public int width;
+
+ /**
+ * Quilt order
+ */
+ public int order;
+
+ /**
+ * Start offset
+ */
+ public int offset;
+
+ /**
+ * Breakpoint index
+ */
+ public int index;
+
+ /**
+ * Boundary
+ */
+ public int[] bdry;
+
+ /**
+ * Breakpoints
+ */
+ public float[] breakpoints;
+
+ /**
+ * Makes new quiltspec
+ */
+ public Quiltspec() {
+ this.bdry = new int[2];
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt
new file mode 100755
index 000000000..89630c71e
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt
@@ -0,0 +1,59 @@
+Unimplemented functionality
+ - tesselation and callbacks
+ - trimming
+ - setting NURBS properties (-> sampling etc.)
+Differences from C++ source
+ - no pooling
+ - pointers to arrays are replaced by CArrayOf... classes and their methods
+Unimplemented or incomplete "calltree top" methods (according to glu.def in Mesa 6.5)
+ gluBeginTrim
+ gluDeleteNurbsRenderer - won't be needed
+ gluEndTrim
+ gluGetNurbsProperty
+ gluLoadSamplingMatrices
+ gluNurbsCallback
+ gluNurbsCallbackData
+ gluNurbsCallbackDataEXT
+ gluNurbsCurve - TODO type switch
+ gluNurbsProperty
+ gluPwlCurve
+ gluQuadricCallback - not a NURBS method
+As of files
+ - Arc[ST]dirSorter.java - unimplemented (part of tesselation)
+ - Backend.java:194 - wireframe quads - part of tesselation/callback
+ - Curve.java:141-204 - culling
+ - DisplayList.java:57 - append to DL - not sure whether it will be needed
+ - GLUnurbs.java :443,484 - error values
+ :445 - trimming
+ :512 - error handling (callback)
+ :530 - loadGLmatrices
+ :786 - nuid - nurbs object id - won't be needed I think
+ :803 - end trim
+ - GLUwNURBS.java:68,176 - NUBRS properties
+ - Knotspec.java :371 - copying in general case (more than 4 coords)
+ :517 - copying with more than 4 coords
+ :556 - pt_oo_sum default
+ - Knotvector.java:165 - show method (probably debugging)
+ - Mapdesc.java :354 - get property
+ :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality
+ - Maplist.java:68 - clear ?
+ - OpenGLCurveEvaluator.java :132 - tess./callback code
+ :168 - mapgrid1f
+ :190 - tess./callback code (output triangles)
+ - OpenGLSurfaceEvaluator.java :77 . tess./callback code
+ :81 - glGetIntegerValue
+ :114 - tess./callback code
+ :117 - Level of detail
+ :144,161,201 - tess./callback code - output triangles
+ - Patch.java:55 - constructor stuff ?
+ - Patchlist.java:55 - constructor stuff ?
+ :97 - cull check
+ :105 - step size
+ :115 - need of sampling subdivision
+ :126 - need of subdivision
+ :137 - need of non sampling subd.
+ :146 - bbox (??)
+ -Quilt.java :254 - culling
+ :282 - rates
+ -Subdivider.java - all TODOs - it's stuff about trimming probably
+ :545 - jumpbuffer - not sure purpose it exactly served in original source
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java
new file mode 100755
index 000000000..c571d9d88
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java
@@ -0,0 +1,128 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class holding rendering params
+ * @author Tomas Hrasky
+ *
+ */
+public class Renderhints {
+
+ /**
+ * Check for errors
+ */
+ public int errorchecking;
+
+ /**
+ * Maximum subdivisions
+ */
+ public int maxsubdivisions;
+
+ /**
+ * Number of subdivisions
+ */
+ private int subdivisions;
+
+ /**
+ * Display method
+ */
+ int display_method;
+
+ /**
+ * Output triangles
+ */
+ int wiretris;
+
+ /**
+ * Output quads
+ */
+ int wirequads;
+
+ /**
+ * Makes new Renderinghints
+ */
+ public Renderhints() {
+ display_method = NurbsConsts.N_FILL;
+ errorchecking = NurbsConsts.N_MSG;
+ subdivisions = 6;
+ // tmp1=0;
+ }
+
+ /**
+ * Set property value
+ * @param prop property
+ */
+ public void setProperty(Property prop) {
+ switch (prop.type) {
+ case NurbsConsts.N_DISPLAY:
+ display_method = (int) prop.value;
+ break;
+ case NurbsConsts.N_ERRORCHECKING:
+ errorchecking = (int) prop.value;
+ break;
+ case NurbsConsts.N_SUBDIVISIONS:
+ subdivisions = (int) prop.value;
+ break;
+ default:
+ // abort - end program
+ break;
+ }
+ }
+
+ /**
+ * Initialization
+ */
+ public void init() {
+ // DONE
+ maxsubdivisions = subdivisions;
+ if (maxsubdivisions < 0)
+ maxsubdivisions = 0;
+
+ if (display_method == NurbsConsts.N_FILL) {
+ wiretris = 0;
+ wirequads = 0;
+ } else if (display_method == NurbsConsts.N_OUTLINE_TRI) {
+ wiretris = 1;
+ wirequads = 0;
+ } else if (display_method == NurbsConsts.N_OUTLINE_QUAD) {
+ wiretris = 0;
+ wirequads = 1;
+ } else {
+ wiretris = 1;
+ wirequads = 1;
+ }
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java
new file mode 100755
index 000000000..35288c67d
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java
@@ -0,0 +1,204 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * NURBS definition
+ * @author Tomas Hrasky
+ *
+ */
+public class Splinespec {
+
+ /**
+ * Dimension
+ */
+ private int dim;
+
+ /**
+ * Knot vector specs
+ */
+ private Knotspec kspec;
+
+ /**
+ * Control points after conversion
+ */
+ private CArrayOfFloats outcpts;
+
+ /**
+ * Makes new Splinespec with given dimension
+ * @param i dimension
+ */
+ public Splinespec(int i) {
+ // DONE
+ this.dim = i;
+ }
+
+ /**
+ * Initializes knotspec according to knotvector
+ * @param knotvector basic knotvector
+ */
+ public void kspecinit(Knotvector knotvector) {
+ // DONE
+ this.kspec = new Knotspec();
+ kspec.inkbegin = new CArrayOfFloats(knotvector.knotlist, 0);
+ kspec.inkend = new CArrayOfFloats(knotvector.knotlist,
+ knotvector.knotcount);
+ kspec.prestride = knotvector.stride;
+ kspec.order = knotvector.order;
+ kspec.next = null;
+ }
+
+ /**
+ * Initializes knotspec according to knotvector - SURFACE
+ * @param sknotvector knotvector in u dir
+ * @param tknotvector knotvector in v dir
+ */
+ public void kspecinit(Knotvector sknotvector, Knotvector tknotvector) {
+ // DONE
+ this.kspec = new Knotspec();
+ Knotspec tkspec = new Knotspec();
+
+ kspec.inkbegin = new CArrayOfFloats(sknotvector.knotlist, 0);
+ kspec.inkend = new CArrayOfFloats(sknotvector.knotlist,
+ sknotvector.knotcount);
+ kspec.prestride = sknotvector.stride;
+ kspec.order = sknotvector.order;
+ kspec.next = tkspec;
+
+ tkspec.inkbegin = new CArrayOfFloats(tknotvector.knotlist, 0);
+ tkspec.inkend = new CArrayOfFloats(tknotvector.knotlist,
+ tknotvector.knotcount);
+ tkspec.prestride = tknotvector.stride;
+ tkspec.order = tknotvector.order;
+ tkspec.next = null;
+ }
+
+ /**
+ * Preselect and select knotspecs
+ */
+ public void select() {
+ // DONE
+ for (Knotspec knotspec = kspec; knotspec != null; knotspec = knotspec.next) {
+ knotspec.preselect();
+ knotspec.select();
+ }
+
+ }
+
+ /**
+ * Prepares for conversion
+ * @param ncoords number of coords
+ */
+ public void layout(int ncoords) {
+ // DONE
+ int stride = ncoords;
+ for (Knotspec knotspec = kspec; knotspec != null; knotspec = knotspec.next) {
+ knotspec.poststride = stride;
+ stride *= (knotspec.bend.getPointer() - knotspec.bbegin
+ .getPointer())
+ * knotspec.order + knotspec.postoffset;
+ knotspec.preoffset *= knotspec.prestride;
+ knotspec.prewidth *= knotspec.poststride;
+ knotspec.postwidth *= knotspec.poststride;
+ knotspec.postoffset *= knotspec.poststride;
+ knotspec.ncoords = ncoords;
+ }
+ outcpts = new CArrayOfFloats(new float[stride]);
+
+ }
+
+ /**
+ * Prepares quilt for conversion
+ * @param quilt quilt to work with
+ */
+ public void setupquilt(Quilt quilt) {
+ // DONE
+ CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec);
+ quilt.eqspec = new CArrayOfQuiltspecs(qspec.getArray(), dim);
+ for (Knotspec knotspec = kspec; knotspec != null;) {
+ qspec.get().stride = knotspec.poststride;
+ qspec.get().width = knotspec.bend.getPointer()
+ - knotspec.bbegin.getPointer();
+ qspec.get().order = knotspec.order;
+ qspec.get().offset = knotspec.postoffset;
+ qspec.get().index = 0;
+ qspec.get().bdry[0] = (knotspec.kleft.getPointer() == knotspec.kfirst
+ .getPointer()) ? 1 : 0;
+ 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
+ .getPointer() <= knotspec.bend.getPointer(); bk.pp()) {
+ k.set(bk.get().value);
+ k.pp();
+ }
+ knotspec = knotspec.next;
+ if (knotspec != null)
+ qspec.pp();
+ }
+ quilt.cpts = new CArrayOfFloats(outcpts);
+ quilt.next = null;
+ }
+
+ /**
+ * Copies array of control points to output array
+ * @param ctlarray control points array
+ */
+ public void copy(CArrayOfFloats ctlarray) {
+ // DONE
+ kspec.copy(ctlarray, outcpts);
+
+ }
+
+ /**
+ * Transforms knotspecs - conversion
+ */
+ public void transform() {
+ // DONE
+ Knotspec knotspec;
+ outcpts.setPointer(0);
+ for (knotspec = kspec; knotspec != null; knotspec = knotspec.next)
+ knotspec.istransformed = false;
+
+ for (knotspec = kspec; knotspec != null; knotspec = knotspec.next) {
+ for (Knotspec kspec2 = kspec; kspec2 != null; kspec2 = kspec2.next)
+ kspec2.kspectotrans = knotspec;
+ kspec.transform(outcpts);
+ knotspec.istransformed = true;
+ }
+
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java
new file mode 100755
index 000000000..b1506d6a1
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java
@@ -0,0 +1,1167 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class working with curves and surfaces
+ * @author Tomas Hrasky
+ *
+ */
+public class Subdivider {
+ /**
+ * Cull type
+ */
+ public static final int CULL_TRIVIAL_REJECT = 0;
+
+ /**
+ * Cull type
+ */
+ public static final int CULL_ACCEPT = 1;
+
+ /**
+ * Maximum trimming arcs
+ */
+ private static final int MAXARCS = 10;
+
+ /**
+ * Linked list of Quilts
+ */
+ Quilt qlist;
+
+ /**
+ * Object holding rendering honts information
+ */
+ private Renderhints renderhints;
+
+ /**
+ * Backend object
+ */
+ private Backend backend;
+
+ /**
+ * Number of subdivisions
+ */
+ private int subdivisions;
+
+ /**
+ * U step when using domain distance sampling
+ */
+ private float domain_distance_u_rate;
+
+ /**
+ * Use domain distance sampling
+ */
+ private int is_domain_distance_sampling;
+
+ /**
+ * Initial class holding trimming arcs
+ */
+ private Bin initialbin;
+
+ /**
+ * Not used
+ */
+ private boolean showDegenerate;
+
+ /**
+ * Is triming arc type bezier arc
+ */
+ private boolean isArcTypeBezier;
+
+ /**
+ * Breakpoints in v direction
+ */
+ private Flist tpbrkpts;
+
+ /**
+ * Breakpoints in u direction
+ */
+ private Flist spbrkpts;
+
+ /**
+ * Unused
+ */
+ private int s_index;
+
+ /**
+ * Head of linked list of trimming arcs
+ */
+ private Arc pjarc;
+
+ /**
+ * Class tesselating trimming arcs
+ */
+ private ArcTesselator arctesselator;
+
+ /**
+ * Unused
+ */
+ private int t_index;
+
+ /**
+ * Breakpoints
+ */
+ private Flist smbrkpts;
+
+ /**
+ * Not used
+ */
+ private float[] stepsizes;
+
+ /**
+ * Domain distance in V direction
+ */
+ private float domain_distance_v_rate;
+
+ /**
+ * Initializes quilt list
+ */
+ public void beginQuilts(Backend backend) {
+ // DONE
+ qlist = null;
+ renderhints = new Renderhints();
+ this.backend = backend;
+
+ initialbin = new Bin();
+ arctesselator = new ArcTesselator();
+ }
+
+ /**
+ * Adds quilt to linked list
+ * @param quilt added quilt
+ */
+ public void addQuilt(Quilt quilt) {
+ // DONE
+ if (qlist == null)
+ qlist = quilt;
+ else {
+ quilt.next = qlist;
+ qlist = quilt;
+ }
+
+ }
+
+ /**
+ * Empty method
+ */
+ public void endQuilts() {
+ // DONE
+ }
+
+ /**
+ * Draws a surface
+ */
+ public void drawSurfaces() {
+ renderhints.init();
+
+ if (qlist == null) {
+ // System.out.println("qlist is null");
+ return;
+ }
+
+ for (Quilt q = qlist; q != null; q = q.next) {
+ if (q.isCulled() == CULL_TRIVIAL_REJECT) {
+ freejarcs(initialbin);
+ return;
+ }
+ }
+
+ float[] from = new float[2];
+ float[] to = new float[2];
+
+ spbrkpts = new Flist();
+ tpbrkpts = new Flist();
+ qlist.getRange(from, to, spbrkpts, tpbrkpts);
+
+ boolean optimize = (is_domain_distance_sampling > 0 && (renderhints.display_method != NurbsConsts.N_OUTLINE_PATCH));
+
+ // TODO decide whether to optimize (when there is gluNurbsProperty implemented)
+ optimize = true;
+
+ if (!initialbin.isnonempty()) {
+ if (!optimize) {
+ makeBorderTrim(from, to);
+ }
+ } else {
+ float[] rate = new float[2];
+ qlist.findRates(spbrkpts, tpbrkpts, rate);
+ // System.out.println("subdivider.drawsurfaces decompose");
+ }
+
+ backend.bgnsurf(renderhints.wiretris, renderhints.wirequads);
+
+ // TODO partition test
+
+ if (!initialbin.isnonempty() && optimize) {
+
+ int i, j;
+ int num_u_steps;
+ 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];
+
+ pta[0] = spbrkpts.pts[i];
+ ptb[0] = spbrkpts.pts[i + 1];
+ pta[1] = tpbrkpts.pts[j];
+ ptb[1] = tpbrkpts.pts[j + 1];
+ qlist.downloadAll(pta, ptb, backend);
+
+ num_u_steps = (int) (domain_distance_u_rate * (ptb[0] - pta[0]));
+ num_v_steps = (int) (domain_distance_v_rate * (ptb[1] - pta[1]));
+
+ if (num_u_steps <= 0)
+ num_u_steps = 1;
+ if (num_v_steps <= 0)
+ num_v_steps = 1;
+
+ backend.surfgrid(pta[0], ptb[0], num_u_steps, ptb[1],
+ pta[1], num_v_steps);
+ backend.surfmesh(0, 0, num_u_steps, num_v_steps);
+
+ }
+ }
+
+ } else
+
+ subdivideInS(initialbin);
+
+ backend.endsurf();
+ }
+
+ /**
+ * Empty method
+ * @param initialbin2
+ */
+ private void freejarcs(Bin initialbin2) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.freejarcs");
+ }
+
+ /**
+ * Subdivide in U direction
+ * @param source Trimming arcs source
+ */
+ private void subdivideInS(Bin source) {
+ // DONE
+ if (renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM) {
+ outline(source);
+ freejarcs(source);
+ } else {
+ setArcTypeBezier();
+ setNonDegenerate();
+ splitInS(source, spbrkpts.start, spbrkpts.end);
+ }
+
+ }
+
+ /**
+ * Split in U direction
+ * @param source Trimming arcs source
+ * @param start breakpoints start
+ * @param end breakpoints end
+ */
+ private void splitInS(Bin source, int start, int end) {
+ // DONE
+ if (source.isnonempty()) {
+ if (start != end) {
+ int i = start + (end - start) / 2;
+ Bin left = new Bin();
+ Bin right = new Bin();
+
+ split(source, left, right, 0, spbrkpts.pts[i]);
+ splitInS(left, start, i);
+ splitInS(right, i + 1, end);
+ } else {
+ if (start == spbrkpts.start || start == spbrkpts.end) {
+ freejarcs(source);
+ } else if (renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM_S) {
+ outline(source);
+ freejarcs(source);
+ } else {
+ setArcTypeBezier();
+ setNonDegenerate();
+ s_index = start;
+ splitInT(source, tpbrkpts.start, tpbrkpts.end);
+ }
+ }
+ } else{
+ // System.out.println("Source is empty - subdivider.splitins");
+ }
+ }
+
+ /**
+ * Split in V direction
+ * @param source
+ * @param start
+ * @param end
+ */
+ private void splitInT(Bin source, int start, 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();
+ split(source, left, right, 1, tpbrkpts.pts[i + 1]);
+ splitInT(left, start, i);
+ splitInT(right, i + 1, end);
+ } else {
+ if (start == tpbrkpts.start || start == tpbrkpts.end) {
+ freejarcs(source);
+ } else if (renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM_ST) {
+ outline(source);
+ freejarcs(source);
+ } else {
+ t_index = start;
+ setArcTypeBezier();
+ setDegenerate();
+
+ float[] pta = new float[2];
+ float[] ptb = new float[2];
+
+ pta[0] = spbrkpts.pts[s_index - 1];
+ pta[1] = tpbrkpts.pts[t_index - 1];
+
+ ptb[0] = spbrkpts.pts[s_index];
+ ptb[1] = tpbrkpts.pts[t_index];
+ qlist.downloadAll(pta, ptb, backend);
+
+ Patchlist patchlist = new Patchlist(qlist, pta, ptb);
+
+ samplingSplit(source, patchlist,
+ renderhints.maxsubdivisions, 0);
+ setNonDegenerate();
+ setArcTypeBezier();
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Sample
+ * @param source
+ * @param patchlist
+ * @param subdivisions
+ * @param param
+ */
+ private void samplingSplit(Bin source, Patchlist patchlist,
+ int subdivisions, int param) {
+ // DONE
+ if (!source.isnonempty())
+ return;
+ if (patchlist.cullCheck() == CULL_TRIVIAL_REJECT) {
+ freejarcs(source);
+ return;
+ }
+
+ patchlist.getstepsize();
+ if (renderhints.display_method == NurbsConsts.N_OUTLINE_PATCH) {
+ tesselation(source, patchlist);
+ outline(source);
+ freejarcs(source);
+ return;
+ }
+
+ tesselation(source, patchlist);
+ if (patchlist.needsSamplingSubdivision() && subdivisions > 0) {
+ if (!patchlist.needsSubdivision(0)) {
+ param = 1;
+ } else if (patchlist.needsSubdivision(1))
+ param = 0;
+ else
+ param = 1 - param;
+
+ Bin left = new Bin();
+ Bin right = new Bin();
+
+ 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);
+ samplingSplit(left, subpatchlist, subdivisions - 1, param);
+ samplingSplit(right, subpatchlist, subdivisions - 1, param);
+ } else {
+ setArcTypePwl();
+ setDegenerate();
+ nonSamplingSplit(source, patchlist, subdivisions, param);
+ setDegenerate();
+ setArcTypeBezier();
+ }
+ }
+
+ /**
+ * Not used
+ * @param source
+ * @param patchlist
+ * @param subdivisions
+ * @param param
+ */
+ private void nonSamplingSplit(Bin source, Patchlist patchlist,
+ int subdivisions, int param) {
+ // DONE
+ if (patchlist.needsNonSamplingSubdivision() && subdivisions > 0) {
+ param = 1 - param;
+
+ Bin left = new Bin();
+ Bin right = new Bin();
+
+ 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);
+ if (left.isnonempty()) {
+ if (subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT)
+ freejarcs(left);
+ else
+ nonSamplingSplit(left, subpatchlist, subdivisions - 1,
+ param);
+ }
+ if (right.isnonempty()) {
+ if (patchlist.cullCheck() == CULL_TRIVIAL_REJECT)
+ freejarcs(right);
+ else
+ nonSamplingSplit(right, subpatchlist, subdivisions - 1,
+ param);
+ }
+ } else {
+ patchlist.bbox();
+ backend.patch(patchlist.pspec[0].range[0],
+ patchlist.pspec[0].range[1], patchlist.pspec[1].range[0],
+ patchlist.pspec[1].range[1]);
+ if (renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV) {
+ outline(source);
+ freejarcs(source);
+ } else {
+ setArcTypePwl();
+ setDegenerate();
+ findIrregularS(source);
+ monosplitInS(source, smbrkpts.start, smbrkpts.end);
+ }
+ }
+
+ }
+
+ /**
+ * Not used
+ * @param source
+ * @param start
+ * @param end
+ */
+ private void monosplitInS(Bin source, int start, int end) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.monosplitins");
+ }
+
+ /**
+ * Not used
+ * @param source
+ */
+ private void findIrregularS(Bin source) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.findIrregularS");
+ }
+
+ /**
+ * Not used
+ */
+ private void setArcTypePwl() {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.setarctypepwl");
+ }
+
+ /**
+ * Not used
+ * @param source
+ * @param patchlist
+ */
+ private void tesselation(Bin source, Patchlist patchlist) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.tesselation");
+ }
+
+ /**
+ * Not used
+ */
+ private void setDegenerate() {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.setdegenerate");
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param left
+ * @param right
+ * @param param
+ * @param value
+ */
+ private void split(Bin bin, Bin left, Bin right, int param, float value) {
+ // DONE
+ Bin intersections = new Bin();
+ Bin unknown = new Bin();
+
+ partition(bin, left, intersections, right, unknown, param, value);
+
+ int count = intersections.numarcs();
+ // TODO jumpbuffer ??
+
+ if (count % 2 == 0) {
+
+ Arc[] arclist = new Arc[MAXARCS];
+ CArrayOfArcs list;
+ if (count >= MAXARCS) {
+ list = new CArrayOfArcs(new Arc[count]);
+ } else {
+ list = new CArrayOfArcs(arclist);
+ }
+
+ CArrayOfArcs last, lptr;
+ Arc jarc;
+
+ for (last = new CArrayOfArcs(list); (jarc = intersections
+ .removearc()) != null; last.pp())
+ last.set(jarc);
+
+ if (param == 0) {// sort into incrasing t order
+ ArcSdirSorter sorter = new ArcSdirSorter(this);
+ sorter.qsort(list, count);
+
+ for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last
+ .getPointer(); lptr.raisePointerBy(2))
+ check_s(lptr.get(), lptr.getRelative(1));
+ for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last
+ .getPointer(); lptr.raisePointerBy(2))
+ join_s(left, right, lptr.get(), lptr.getRelative(1));
+ for (lptr = new CArrayOfArcs(list); lptr.getPointer() != last
+ .getPointer(); lptr.pp()) {
+ if (lptr.get().head()[0] <= value
+ && lptr.get().tail()[0] <= value)
+ left.addarc(lptr.get());
+ else
+ right.addarc(lptr.get());
+ }
+
+ } else {// sort into decreasing s order
+ ArcTdirSorter sorter = new ArcTdirSorter(this);
+ sorter.qsort(list, count);
+
+ for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last
+ .getPointer(); lptr.raisePointerBy(2))
+ check_t(lptr.get(), lptr.getRelative(1));
+ for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last
+ .getPointer(); lptr.raisePointerBy(2))
+ join_t(left, right, lptr.get(), lptr.getRelative(1));
+ for (lptr = new CArrayOfArcs(list); lptr.getPointer() != last
+ .getPointer(); lptr.raisePointerBy(2)) {
+ if (lptr.get().head()[0] <= value
+ && lptr.get().tail()[0] <= value)
+ left.addarc(lptr.get());
+ else
+ right.addarc(lptr.get());
+ }
+
+ }
+
+ unknown.adopt();
+ }
+ }
+
+ /**
+ * Not used
+ * @param left
+ * @param right
+ * @param arc
+ * @param relative
+ */
+ private void join_t(Bin left, Bin right, Arc arc, Arc relative) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.join_t");
+ }
+
+ /**
+ * Not used
+ * @param arc
+ * @param relative
+ */
+ private void check_t(Arc arc, Arc relative) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.check_t");
+ }
+
+ /**
+ * Not used
+ * @param left
+ * @param right
+ * @param jarc1
+ * @param jarc2
+ */
+ private void join_s(Bin left, 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];
+
+ if (t1 == t2) {
+ simplelink(jarc1, jarc2);
+ } else {
+ Arc newright = new Arc(Arc.ARC_RIGHT);
+ Arc newleft = new Arc(Arc.ARC_LEFT);
+ if (isBezierArcType()) {
+ arctesselator.bezier(newright, s, s, t1, t2);
+ arctesselator.bezier(newleft, s, s, t2, t1);
+ } else {
+ arctesselator.pwl_right(newright, s, t1, t2, stepsizes[0]);
+ arctesselator.pwl_left(newright, s, t2, t1, stepsizes[2]);
+ }
+ link(jarc1, jarc2, newright, newleft);
+ left.addarc(newright);
+ right.addarc(newleft);
+ }
+
+ }
+
+ /**
+ * Not used
+ * @param jarc1
+ * @param jarc2
+ * @param newright
+ * @param newleft
+ */
+ private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.link");
+ }
+
+ /**
+ * Not used
+ * @return true
+ */
+ private boolean isBezierArcType() {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.isbezierarc");
+ return true;
+ }
+
+ /**
+ * Not used
+ * @param jarc1
+ * @param jarc2
+ */
+ private void simplelink(Arc jarc1, Arc jarc2) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.simplelink");
+ }
+
+ /**
+ * Not used
+ * @param arc
+ * @param relative
+ */
+ private void check_s(Arc arc, Arc relative) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.check_s");
+
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param left
+ * @param intersections
+ * @param right
+ * @param unknown
+ * @param param
+ * @param value
+ */
+ private void partition(Bin bin, Bin left, Bin intersections, Bin right,
+ Bin unknown, int param, float value) {
+
+ Bin headonleft = new Bin();
+ Bin headonright = new Bin();
+ Bin tailonleft = new Bin();
+ 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;
+
+ if (tdiff > 0) {
+ if (hdiff > 0) {
+ right.addarc(jarc);
+ } else if (hdiff == 0) {
+ tailonright.addarc(jarc);
+ } else {
+ Arc jtemp;
+ switch (arc_split(jarc, param, value, 0)) {
+ case 2:
+ tailonright.addarc(jarc);
+ headonleft.addarc(jarc.next);
+ break;
+ // TODO rest cases
+ default:
+ System.out
+ .println("TODO subdivider.partition rest cases");
+ break;
+ }
+ }
+ } else if (tdiff == 0) {
+ if (hdiff > 0) {
+ headonright.addarc(jarc);
+ } else if (hdiff == 0) {
+ unknown.addarc(jarc);
+ } else {
+ headonright.addarc(jarc);
+ }
+ } else {
+ if (hdiff > 0) {
+ // TODO rest
+ // System.out.println("TODO subdivider.partition rest of else");
+ } else if (hdiff == 0) {
+ tailonleft.addarc(jarc);
+ } else {
+ left.addarc(jarc);
+ }
+ }
+
+ }
+ if (param == 0) {
+ classify_headonleft_s(headonleft, intersections, left, value);
+ classify_tailonleft_s(tailonleft, intersections, left, value);
+ classify_headonright_s(headonright, intersections, right, value);
+ classify_tailonright_s(tailonright, intersections, right, value);
+ } else {
+ classify_headonleft_t(headonleft, intersections, left, value);
+ classify_tailonleft_t(tailonleft, intersections, left, value);
+ classify_headonright_t(headonright, intersections, right, value);
+ classify_tailonright_t(tailonright, intersections, right, value);
+ }
+ }
+
+ /**
+ * Not used
+ * @param tailonright
+ * @param intersections
+ * @param right
+ * @param value
+ */
+ private void classify_tailonright_t(Bin tailonright, Bin intersections,
+ Bin right, float value) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.classify_tailonright_t");
+
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param in
+ * @param out
+ * @param val
+ */
+ private void classify_tailonleft_s(Bin bin, Bin in, Bin out, float val) {
+
+ // DONE
+ Arc j;
+ while ((j = bin.removearc()) != null) {
+ j.clearitail();
+
+ float diff = j.next.head()[0] - val;
+ if (diff > 0) {
+ in.addarc(j);
+ } else if (diff < 0) {
+ if (ccwTurn_sl(j, j.next))
+ out.addarc(j);
+ else
+ in.addarc(j);
+ } else {
+ if (j.next.tail()[1] > j.next.head()[1])
+ in.addarc(j);
+ else
+ out.addarc(j);
+ }
+ }
+
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param in
+ * @param out
+ * @param val
+ */
+ private void classify_headonright_s(Bin bin, Bin in, Bin out, float val) {
+ // DONE
+ Arc j;
+ while ((j = bin.removearc()) != null) {
+ j.setitail();
+
+ float diff = j.prev.tail()[0] - val;
+ if (diff > 0) {
+ if (ccwTurn_sr(j.prev, j))
+ out.addarc(j);
+ else
+ in.addarc(j);
+ } else if (diff < 0) {
+ out.addarc(j);
+ } else {
+ if (j.prev.tail()[1] > j.prev.head()[1])
+ out.addarc(j);
+ else
+ in.addarc(j);
+ }
+ }
+ }
+
+ /**
+ * Not used
+ * @param prev
+ * @param j
+ * @return false
+ */
+ private boolean ccwTurn_sr(Arc prev, Arc j) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO ccwTurn_sr");
+ return false;
+ }
+
+ /**
+ * Not used
+ * @param headonright
+ * @param intersections
+ * @param right
+ * @param value
+ */
+ private void classify_headonright_t(Bin headonright, Bin intersections,
+ Bin right, float value) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.classify_headonright_t");
+ }
+
+ /**
+ * Not used
+ * @param tailonleft
+ * @param intersections
+ * @param left
+ * @param value
+ */
+ private void classify_tailonleft_t(Bin tailonleft, Bin intersections,
+ Bin left, float value) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.classify_tailonleft_t");
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param in
+ * @param out
+ * @param val
+ */
+ private void classify_headonleft_t(Bin bin, Bin in, Bin out, float val) {
+ // DONE
+ Arc j;
+ while ((j = bin.removearc()) != null) {
+ j.setitail();
+
+ float diff = j.prev.tail()[1] - val;
+ if (diff > 0) {
+ out.addarc(j);
+ } else if (diff < 0) {
+ if (ccwTurn_tl(j.prev, j))
+ out.addarc(j);
+ else
+ in.addarc(j);
+ } else {
+ if (j.prev.tail()[0] > j.prev.head()[0])
+ out.addarc(j);
+ else
+ in.addarc(j);
+ }
+ }
+ }
+
+ /**
+ * Not used
+ * @param prev
+ * @param j
+ * @return false
+ */
+ private boolean ccwTurn_tl(Arc prev, Arc j) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.ccwTurn_tl");
+ return false;
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param in
+ * @param out
+ * @param val
+ */
+ private void classify_tailonright_s(Bin bin, Bin in, Bin out, float val) {
+ // DONE
+ Arc j;
+ while ((j = bin.removearc()) != null) {
+ j.clearitail();
+
+ float diff = j.next.head()[0] - val;
+ if (diff > 0) {
+ if (ccwTurn_sr(j, j.next))
+ out.addarc(j);
+ else
+ in.addarc(j);
+ } else if (diff < 0) {
+ in.addarc(j);
+ } else {
+ if (j.next.tail()[1] > j.next.head()[1])
+ out.addarc(j);
+ else
+ in.addarc(j);
+ }
+ }
+
+ }
+
+ /**
+ * Not used
+ * @param bin
+ * @param in
+ * @param out
+ * @param val
+ */
+ private void classify_headonleft_s(Bin bin, Bin in, Bin out, float val) {
+ // DONE
+ Arc j;
+ while ((j = bin.removearc()) != null) {
+ j.setitail();
+
+ float diff = j.prev.tail()[0] - val;
+ if (diff > 0) {
+ out.addarc(j);
+ } else if (diff < 0) {
+ if (ccwTurn_sl(j.prev, j))
+ out.addarc(j);
+ else
+ in.addarc(j);
+ } else {
+ if (j.prev.tail()[1] > j.prev.head()[1])
+ in.addarc(j);
+ else
+ out.addarc(j);
+ }
+ }
+
+ }
+
+ /**
+ * Not used
+ * @param prev
+ * @param j
+ * @return false
+ */
+ private boolean ccwTurn_sl(Arc prev, Arc j) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.ccwTurn_sl");
+ return false;
+ }
+
+ /**
+ * Not used
+ * @param jarc
+ * @param param
+ * @param value
+ * @param i
+ * @return 0
+ */
+ private int arc_split(Arc jarc, int param, float value, int i) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.arc_split");
+ return 0;
+ }
+
+ /**
+ * Not used
+ */
+ private void setNonDegenerate() {
+ // DONE
+ this.showDegenerate = false;
+
+ }
+
+ /**
+ * sets trimming arc default type to bezier
+ */
+ private void setArcTypeBezier() {
+ // DONE
+ isArcTypeBezier = true;
+ }
+
+ /**
+ * Not used
+ * @param source
+ */
+ private void outline(Bin source) {
+ // TODO Auto-generated method stub
+ // System.out.println("TODO subdivider.outline");
+ }
+
+ /**
+ * Makes default trim along surface borders
+ * @param from range beginnings
+ * @param to range ends
+ */
+ private void makeBorderTrim(float[] from, float[] to) {
+ // DONE
+ float smin = from[0];
+ float smax = to[0];
+
+ float tmin = from[1];
+ float tmax = to[1];
+
+ pjarc = null;
+ Arc jarc = null;
+
+ jarc = new Arc(Arc.ARC_BOTTOM);
+ arctesselator.bezier(jarc, smin, smax, tmin, tmin);
+ initialbin.addarc(jarc);
+ pjarc = jarc.append(pjarc);
+
+ jarc = new Arc(Arc.ARC_RIGHT);
+ arctesselator.bezier(jarc, smax, smax, tmin, tmax);
+ initialbin.addarc(jarc);
+ pjarc = jarc.append(pjarc);
+
+ jarc = new Arc(Arc.ARC_TOP);
+ arctesselator.bezier(jarc, smax, smin, tmax, tmax);
+ initialbin.addarc(jarc);
+ pjarc = jarc.append(pjarc);
+
+ jarc = new Arc(Arc.ARC_LEFT);
+ arctesselator.bezier(jarc, smin, smin, tmax, tmin);
+ initialbin.addarc(jarc);
+ jarc = jarc.append(pjarc);
+
+ // assert (jarc.check() == true);
+ }
+
+ /**
+ * Draws NURBS curve
+ */
+ public void drawCurves() {
+ // DONE
+ float[] from = new float[1];
+ float[] to = new float[1];
+
+ Flist bpts = new Flist();
+ qlist.getRange(from, to, bpts);
+
+ renderhints.init();
+
+ backend.bgncurv();
+
+ for (int i = bpts.start; i < bpts.end - 1; i++) {
+ float[] pta = new float[1];
+ 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);
+ samplingSplit(curvelist, renderhints.maxsubdivisions);
+ }
+ backend.endcurv();
+ }
+
+ /**
+ * Samples a curve in case of need, or sends curve to backend
+ * @param curvelist list of curves
+ * @param maxsubdivisions maximum number of subdivisions
+ */
+ private void samplingSplit(Curvelist curvelist, int maxsubdivisions) {
+ if (curvelist.cullCheck() == CULL_TRIVIAL_REJECT)
+ return;
+
+ curvelist.getstepsize();
+
+ if (curvelist.needsSamplingSubdivision() && (subdivisions > 0)) {
+ // TODO kód
+ // System.out.println("TODO subdivider-needsSamplingSubdivision");
+ } else {
+ int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize);
+ backend.curvgrid(curvelist.range[0], curvelist.range[1], nu);
+ backend.curvmesh(0, nu);
+ }
+
+ }
+
+ /**
+ * Sets new domain_distance_u_rate value
+ * @param d new domain_distance_u_rate value
+
+ */
+ public void set_domain_distance_u_rate(double d) {
+ // DONE
+ domain_distance_u_rate = (float) d;
+ }
+
+ /**
+ * Sets new domain_distance_v_rate value
+ * @param d new domain_distance_v_rate value
+ */
+ public void set_domain_distance_v_rate(double d) {
+ // DONE
+ domain_distance_v_rate = (float) d;
+ }
+
+ /**
+ * Sets new is_domain_distance_sampling value
+ * @param i new is_domain_distance_sampling value
+ */
+ public void set_is_domain_distance_sampling(int i) {
+ // DONE
+ this.is_domain_distance_sampling = i;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java
new file mode 100755
index 000000000..feb3bc9a7
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java
@@ -0,0 +1,111 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Class rendering surfaces with OpenGL
+ * @author Tomas Hrasky
+ *
+ */
+public interface SurfaceEvaluator {
+
+ /**
+ * Pushes eval bit
+ */
+ public void bgnmap2f() ;
+
+ /**
+ * Sets glPolygonMode
+ * @param style polygon mode (N_MESHFILL/N_MESHLINE/N_MESHPOINT)
+ */
+ public void polymode(int style) ;
+
+ /**
+ * Pops all attributes
+ */
+ public void endmap2f() ;
+
+ /**
+ * Empty method
+ * @param ulo
+ * @param uhi
+ * @param vlo
+ * @param vhi
+ */
+ public void domain2f(float ulo, float uhi, float vlo, float vhi) ;
+
+ /**
+ * Defines 2D mesh
+ * @param nu number of steps in u direction
+ * @param u0 lowest u
+ * @param u1 highest u
+ * @param nv number of steps in v direction
+ * @param v0 lowest v
+ * @param v1 highest v
+ */
+ public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) ;
+
+ /**
+ * Evaluates surface
+ * @param style surface style
+ * @param umin minimum U
+ * @param umax maximum U
+ * @param vmin minimum V
+ * @param vmax maximum V
+ */
+ public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) ;
+
+ /**
+ * Initializes evaluator
+ * @param type surface type
+ * @param ulo lowest u
+ * @param uhi highest u
+ * @param ustride number of objects between control points in u direction
+ * @param uorder surface order in u direction
+ * @param vlo lowest v
+ * @param vhi highest v
+ * @param vstride number of control points' coords
+ * @param vorder surface order in v direction
+ * @param pts control points
+ */
+ public void map2f(int type, float ulo, float uhi, int ustride, int uorder,
+ float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) ;
+
+ /**
+ * Calls opengl enable
+ * @param type what to enable
+ */
+ public void enable(int type) ;
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java
new file mode 100755
index 000000000..ec3f6fc10
--- /dev/null
+++ b/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java
@@ -0,0 +1,56 @@
+package com.sun.opengl.impl.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 1.1 (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.
+ */
+
+/**
+ * Holds vertex used in trim
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class TrimVertex {
+
+ /**
+ * Trim vertex coords
+ */
+ public float[] param;
+
+ /**
+ * Makes new empty trim vertex
+ */
+ public TrimVertex() {
+ param = new float[2];
+ }
+}