Imported Upstream version 9.0.0
[platform/upstream/libGLU.git] / src / 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  */
35
36 #ifndef __glureader_h_
37 #define __glureader_h_
38
39 #include "bufpool.h"
40 #include "types.h"
41
42 enum Curvetype { ct_nurbscurve, ct_pwlcurve, ct_none };
43     
44 struct Property;
45 struct O_surface;
46 struct O_nurbssurface;
47 struct O_trim;
48 class O_pwlcurve;
49 struct O_nurbscurve;
50 struct O_curve;
51 class  Quilt;
52 class TrimVertex;
53
54
55 struct O_curve : public PooledObj {
56     union {
57         O_nurbscurve    *o_nurbscurve;
58         O_pwlcurve      *o_pwlcurve;
59     } curve;
60     Curvetype           curvetype;      /* arc type: pwl or nurbs       */
61     O_curve *           next;           /* next arc in loop             */
62     O_surface *         owner;          /* owning surface               */
63     int                 used;           /* curve called in cur surf     */
64     int                 save;           /* 1 if in display list         */
65     long                nuid;
66                         O_curve() { next = 0; used = 0; owner = 0; 
67                                     curve.o_pwlcurve = 0; curvetype = ct_none; save = 0; nuid = 0; }
68     };
69
70 struct O_nurbscurve : public PooledObj {
71     Quilt               *bezier_curves; /* array of bezier curves       */
72     long                type;           /* range descriptor             */
73     REAL                tesselation;    /* tesselation tolerance        */
74     int                 method;         /* tesselation method           */
75     O_nurbscurve *      next;           /* next curve in list           */
76     int                 used;           /* curve called in cur surf     */
77     int                 save;           /* 1 if in display list         */
78     O_curve *           owner;          /* owning curve                 */
79                         O_nurbscurve( long _type ) 
80                            { bezier_curves = 0; type = _type; tesselation = 0; method = 0; next = 0; used = 0; save = 0; owner = 0; }
81     };
82  
83 class O_pwlcurve : public PooledObj {
84 public:
85     TrimVertex          *pts;           /* array of trim vertices       */
86     int                 npts;           /* number of trim vertices      */
87     O_pwlcurve *        next;           /* next curve in list           */
88     int                 used;           /* curve called in cur surf     */
89     int                 save;           /* 1 if in display list         */
90     O_curve *           owner;          /* owning curve                 */
91                         O_pwlcurve( long, long, INREAL *, long, TrimVertex * );
92     };
93
94 struct O_trim : public PooledObj {
95     O_curve             *o_curve;       /* closed trim loop             */
96     O_trim *            next;           /* next loop along trim         */
97     int                 save;           /* 1 if in display list         */
98                         O_trim() { next = 0; o_curve = 0; save = 0; }
99     };
100
101 struct O_nurbssurface : public PooledObj {
102     Quilt *             bezier_patches;/* array of bezier patches       */
103     long                type;           /* range descriptor             */
104     O_surface *         owner;          /* owning surface               */
105     O_nurbssurface *    next;           /* next surface in chain        */
106     int                 save;           /* 1 if in display list         */
107     int                 used;           /* 1 if prev called in block    */
108                         O_nurbssurface( long _type ) 
109                            { bezier_patches = 0; type = _type; owner = 0; next = 0; save = 0; used = 0; }
110     };
111
112 struct O_surface : public PooledObj {
113     O_nurbssurface *    o_nurbssurface; /* linked list of surfaces      */
114     O_trim *            o_trim;         /* list of trim loops           */
115     int                 save;           /* 1 if in display list         */
116     long                nuid;
117                         O_surface() { o_trim = 0; o_nurbssurface = 0; save = 0; nuid = 0; }
118     };
119
120 struct Property : public PooledObj {
121     long                type;
122     long                tag;
123     REAL                value;
124     int                 save;           /* 1 if in display list         */
125                         Property( long _type, long _tag, INREAL _value )
126                         { type = _type; tag = _tag; value = (REAL) _value; save = 0; }
127                         Property( long _tag, INREAL _value )
128                         { type = 0; tag = _tag; value = (REAL) _value; save = 0; }
129     };
130
131 class NurbsTessellator;
132 #endif /* __glureader_h_ */