~ubuntu-branches/ubuntu/jaunty/mesa/jaunty

« back to all changes in this revision

Viewing changes to src/glu/mesa/nurbs.h

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-01-31 12:38:44 UTC
  • mfrom: (1.2.15 upstream) (3.1.4 experimental)
  • Revision ID: james.westby@ubuntu.com-20090131123844-ncib2eu1l01b1et0
Tags: 7.3-1ubuntu1
* Merge with Debian experimental.
* Drop 102_remove_flip.diff, included in 7.3..

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/*
3
 
 * Mesa 3-D graphics library
4
 
 * Version:  3.3
5
 
 * Copyright (C) 1995-2000  Brian Paul
6
 
 *
7
 
 * This library is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU Library General Public
9
 
 * License as published by the Free Software Foundation; either
10
 
 * version 2 of the License, or (at your option) any later version.
11
 
 *
12
 
 * This library is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
 * Library General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU Library General Public
18
 
 * License along with this library; if not, write to the Free
19
 
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
 
 */
21
 
 
22
 
 
23
 
/*
24
 
 * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
25
 
 * See README2 for more info.
26
 
 */
27
 
 
28
 
 
29
 
#ifndef NURBS_H
30
 
#define NURBS_H
31
 
 
32
 
 
33
 
#define EPSILON 1e-06           /* epsilon for double precision compares */
34
 
 
35
 
typedef enum
36
 
{
37
 
   GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM,
38
 
   GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE
39
 
}
40
 
GLU_nurbs_enum;
41
 
 
42
 
typedef enum
43
 
{
44
 
   GLU_TRIM_NURBS, GLU_TRIM_PWL
45
 
}
46
 
GLU_trim_enum;
47
 
 
48
 
typedef struct
49
 
{
50
 
   GLint sknot_count;
51
 
   GLfloat *sknot;
52
 
   GLint tknot_count;
53
 
   GLfloat *tknot;
54
 
   GLint s_stride;
55
 
   GLint t_stride;
56
 
   GLfloat *ctrlarray;
57
 
   GLint sorder;
58
 
   GLint torder;
59
 
   GLint dim;
60
 
   GLenum type;
61
 
}
62
 
surface_attribs;
63
 
 
64
 
typedef struct
65
 
{
66
 
   surface_attribs geom;
67
 
   surface_attribs color;
68
 
   surface_attribs texture;
69
 
   surface_attribs normal;
70
 
}
71
 
nurbs_surface;
72
 
 
73
 
typedef struct
74
 
{
75
 
   GLint knot_count;
76
 
   GLfloat *knot;
77
 
   GLint stride;
78
 
   GLfloat *ctrlarray;
79
 
   GLint order;
80
 
   GLint dim;
81
 
   GLenum type;
82
 
}
83
 
curve_attribs;
84
 
 
85
 
typedef struct
86
 
{
87
 
   GLint pt_count;
88
 
   GLfloat *ctrlarray;
89
 
   GLint stride;
90
 
   GLint dim;
91
 
   GLenum type;
92
 
}
93
 
pwl_curve_attribs;
94
 
 
95
 
typedef struct
96
 
{
97
 
   curve_attribs geom;
98
 
   curve_attribs color;
99
 
   curve_attribs texture;
100
 
   curve_attribs normal;
101
 
}
102
 
nurbs_curve;
103
 
 
104
 
typedef struct trim_list_str
105
 
{
106
 
   GLU_trim_enum trim_type;
107
 
   union
108
 
   {
109
 
      pwl_curve_attribs pwl_curve;
110
 
      curve_attribs nurbs_curve;
111
 
   }
112
 
   curve;
113
 
   struct trim_list_str *next;
114
 
}
115
 
trim_list;
116
 
 
117
 
typedef struct seg_trim_str
118
 
{
119
 
   GLfloat *points;
120
 
   GLint pt_cnt, seg_array_len;
121
 
   struct seg_trim_str *next;
122
 
}
123
 
trim_segments;
124
 
 
125
 
typedef struct nurbs_trim_str
126
 
{
127
 
   trim_list *trim_loop;
128
 
   trim_segments *segments;
129
 
   struct nurbs_trim_str *next;
130
 
}
131
 
nurbs_trim;
132
 
 
133
 
typedef struct
134
 
{
135
 
   GLfloat model[16], proj[16], viewport[4];
136
 
}
137
 
culling_and_sampling_str;
138
 
 
139
 
struct GLUnurbs
140
 
{
141
 
   GLboolean culling;
142
 
   GLenum error;
143
 
   void (GLCALLBACK * error_callback) (GLenum err);
144
 
   GLenum display_mode;
145
 
   GLU_nurbs_enum nurbs_type;
146
 
   GLboolean auto_load_matrix;
147
 
     culling_and_sampling_str sampling_matrices;
148
 
   GLenum sampling_method;
149
 
   GLfloat sampling_tolerance;
150
 
   GLfloat parametric_tolerance;
151
 
   GLint u_step, v_step;
152
 
   nurbs_surface surface;
153
 
   nurbs_curve curve;
154
 
   nurbs_trim *trim;
155
 
};
156
 
 
157
 
typedef struct
158
 
{
159
 
   GLfloat *knot;
160
 
   GLint nknots;
161
 
   GLfloat *unified_knot;
162
 
   GLint unified_nknots;
163
 
   GLint order;
164
 
   GLint t_min, t_max;
165
 
   GLint delta_nknots;
166
 
   GLboolean open_at_begin, open_at_end;
167
 
   GLfloat *new_knot;
168
 
   GLfloat *alpha;
169
 
}
170
 
knot_str_type;
171
 
 
172
 
typedef struct
173
 
{
174
 
   GLfloat *geom_ctrl;
175
 
   GLint geom_s_stride, geom_t_stride;
176
 
   GLfloat **geom_offsets;
177
 
   GLint geom_s_pt_cnt, geom_t_pt_cnt;
178
 
   GLfloat *color_ctrl;
179
 
   GLint color_s_stride, color_t_stride;
180
 
   GLfloat **color_offsets;
181
 
   GLint color_s_pt_cnt, color_t_pt_cnt;
182
 
   GLfloat *normal_ctrl;
183
 
   GLint normal_s_stride, normal_t_stride;
184
 
   GLfloat **normal_offsets;
185
 
   GLint normal_s_pt_cnt, normal_t_pt_cnt;
186
 
   GLfloat *texture_ctrl;
187
 
   GLint texture_s_stride, texture_t_stride;
188
 
   GLfloat **texture_offsets;
189
 
   GLint texture_s_pt_cnt, texture_t_pt_cnt;
190
 
   GLint s_bezier_cnt, t_bezier_cnt;
191
 
}
192
 
new_ctrl_type;
193
 
 
194
 
extern void call_user_error(GLUnurbsObj * nobj, GLenum error);
195
 
 
196
 
extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order);
197
 
 
198
 
extern GLenum explode_knot(knot_str_type * the_knot);
199
 
 
200
 
extern GLenum calc_alphas(knot_str_type * the_knot);
201
 
 
202
 
extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride,
203
 
                                knot_str_type * the_knot, GLint dim,
204
 
                                GLfloat ** new_ctrl, GLint * ncontrol);
205
 
 
206
 
extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl,
207
 
                                  GLint n_ctrl, GLint order, GLint dim,
208
 
                                  GLint ** factors);
209
 
 
210
 
extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
211
 
                                 int **sfactors, GLint ** tfactors);
212
 
 
213
 
extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
214
 
                                 int **sfactors, GLint ** tfactors);
215
 
 
216
 
extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj,
217
 
                                       new_ctrl_type * new_ctrl,
218
 
                                       int **sfactors, GLint ** tfactors);
219
 
 
220
 
extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl,
221
 
                                      GLint n_ctrl, GLint stride, GLint dim);
222
 
 
223
 
extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl,
224
 
                                      GLint s_n_ctrl, GLint t_n_ctrl,
225
 
                                      GLint s_stride, GLint t_stride,
226
 
                                      GLint dim);
227
 
 
228
 
extern void do_nurbs_curve(GLUnurbsObj * nobj);
229
 
 
230
 
extern void do_nurbs_surface(GLUnurbsObj * nobj);
231
 
 
232
 
extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
233
 
                             GLint * sfactors, GLint * tfactors);
234
 
 
235
 
extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src,
236
 
                                 GLfloat maximal_min_knot,
237
 
                                 GLfloat minimal_max_knot);
238
 
 
239
 
extern GLenum select_knot_working_range(GLUnurbsObj * nobj,
240
 
                                        knot_str_type * geom_knot,
241
 
                                        knot_str_type * color_knot,
242
 
                                        knot_str_type * normal_knot,
243
 
                                        knot_str_type * texture_knot);
244
 
 
245
 
extern void free_unified_knots(knot_str_type * geom_knot,
246
 
                               knot_str_type * color_knot,
247
 
                               knot_str_type * normal_knot,
248
 
                               knot_str_type * texture_knot);
249
 
 
250
 
 
251
 
 
252
 
#endif