3
* Mesa 3-D graphics library
5
* Copyright (C) 1995-2000 Brian Paul
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.
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.
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.
24
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
25
* See README2 for more info.
33
#define EPSILON 1e-06 /* epsilon for double precision compares */
37
GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM,
38
GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE
44
GLU_TRIM_NURBS, GLU_TRIM_PWL
67
surface_attribs color;
68
surface_attribs texture;
69
surface_attribs normal;
99
curve_attribs texture;
100
curve_attribs normal;
104
typedef struct trim_list_str
106
GLU_trim_enum trim_type;
109
pwl_curve_attribs pwl_curve;
110
curve_attribs nurbs_curve;
113
struct trim_list_str *next;
117
typedef struct seg_trim_str
120
GLint pt_cnt, seg_array_len;
121
struct seg_trim_str *next;
125
typedef struct nurbs_trim_str
127
trim_list *trim_loop;
128
trim_segments *segments;
129
struct nurbs_trim_str *next;
135
GLfloat model[16], proj[16], viewport[4];
137
culling_and_sampling_str;
143
void (GLCALLBACK * error_callback) (GLenum err);
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;
161
GLfloat *unified_knot;
162
GLint unified_nknots;
166
GLboolean open_at_begin, open_at_end;
175
GLint geom_s_stride, geom_t_stride;
176
GLfloat **geom_offsets;
177
GLint geom_s_pt_cnt, geom_t_pt_cnt;
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;
194
extern void call_user_error(GLUnurbsObj * nobj, GLenum error);
196
extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order);
198
extern GLenum explode_knot(knot_str_type * the_knot);
200
extern GLenum calc_alphas(knot_str_type * the_knot);
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);
206
extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl,
207
GLint n_ctrl, GLint order, GLint dim,
210
extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
211
int **sfactors, GLint ** tfactors);
213
extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
214
int **sfactors, GLint ** tfactors);
216
extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj,
217
new_ctrl_type * new_ctrl,
218
int **sfactors, GLint ** tfactors);
220
extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl,
221
GLint n_ctrl, GLint stride, GLint dim);
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,
228
extern void do_nurbs_curve(GLUnurbsObj * nobj);
230
extern void do_nurbs_surface(GLUnurbsObj * nobj);
232
extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
233
GLint * sfactors, GLint * tfactors);
235
extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src,
236
GLfloat maximal_min_knot,
237
GLfloat minimal_max_knot);
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);
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);