Update to SGI FreeB 2.0.
[mesa.git] / src / glu / sgi / libnurbs / internals / reader.h
1 /*
2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
29 */
30
31 /*
32 * reader.h
33 *
34 * $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
35 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/reader.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
36 */
37
38 #ifndef __glureader_h_
39 #define __glureader_h_
40
41 #include "bufpool.h"
42 #include "types.h"
43
44 enum Curvetype { ct_nurbscurve, ct_pwlcurve, ct_none };
45
46 struct Property;
47 struct O_surface;
48 struct O_nurbssurface;
49 struct O_trim;
50 class O_pwlcurve;
51 struct O_nurbscurve;
52 struct O_curve;
53 class Quilt;
54 class TrimVertex;
55
56
57 struct O_curve : public PooledObj {
58 union {
59 O_nurbscurve *o_nurbscurve;
60 O_pwlcurve *o_pwlcurve;
61 } curve;
62 Curvetype curvetype; /* arc type: pwl or nurbs */
63 O_curve * next; /* next arc in loop */
64 O_surface * owner; /* owning surface */
65 int used; /* curve called in cur surf */
66 int save; /* 1 if in display list */
67 long nuid;
68 O_curve() { next = 0; used = 0; owner = 0;
69 curve.o_pwlcurve = 0; }
70 };
71
72 struct O_nurbscurve : public PooledObj {
73 Quilt *bezier_curves; /* array of bezier curves */
74 long type; /* range descriptor */
75 REAL tesselation; /* tesselation tolerance */
76 int method; /* tesselation method */
77 O_nurbscurve * next; /* next curve in list */
78 int used; /* curve called in cur surf */
79 int save; /* 1 if in display list */
80 O_curve * owner; /* owning curve */
81 O_nurbscurve( long _type )
82 { type = _type; owner = 0; next = 0; used = 0; }
83 };
84
85 class O_pwlcurve : public PooledObj {
86 public:
87 TrimVertex *pts; /* array of trim vertices */
88 int npts; /* number of trim vertices */
89 O_pwlcurve * next; /* next curve in list */
90 int used; /* curve called in cur surf */
91 int save; /* 1 if in display list */
92 O_curve * owner; /* owning curve */
93 O_pwlcurve( long, long, INREAL *, long, TrimVertex * );
94 };
95
96 struct O_trim : public PooledObj {
97 O_curve *o_curve; /* closed trim loop */
98 O_trim * next; /* next loop along trim */
99 int save; /* 1 if in display list */
100 O_trim() { next = 0; o_curve = 0; }
101 };
102
103 struct O_nurbssurface : public PooledObj {
104 Quilt * bezier_patches;/* array of bezier patches */
105 long type; /* range descriptor */
106 O_surface * owner; /* owning surface */
107 O_nurbssurface * next; /* next surface in chain */
108 int save; /* 1 if in display list */
109 int used; /* 1 if prev called in block */
110 O_nurbssurface( long _type )
111 { type = _type; owner = 0; next = 0; used = 0; }
112 };
113
114 struct O_surface : public PooledObj {
115 O_nurbssurface * o_nurbssurface; /* linked list of surfaces */
116 O_trim * o_trim; /* list of trim loops */
117 int save; /* 1 if in display list */
118 long nuid;
119 O_surface() { o_trim = 0; o_nurbssurface = 0; }
120 };
121
122 struct Property : public PooledObj {
123 long type;
124 long tag;
125 REAL value;
126 int save; /* 1 if in display list */
127 Property( long _type, long _tag, INREAL _value )
128 { type = _type; tag = _tag; value = (REAL) _value; }
129 Property( long _tag, INREAL _value )
130 { type = 0; tag = _tag; value = (REAL) _value; }
131 };
132
133 class NurbsTessellator;
134 #endif /* __glureader_h_ */