1
/* $Id: nurbs.h,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
4
* Mesa 3-D graphics library
6
* Copyright (C) 1995-2000 Brian Paul
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Library General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Library General Public License for more details.
18
* You should have received a copy of the GNU Library General Public
19
* License along with this library; if not, write to the Free
20
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
26
* See README2 for more info.
34
#define EPSILON 1e-06 /* epsilon for double precision compares */
38
GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM,
39
GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE
45
GLU_TRIM_NURBS, GLU_TRIM_PWL
68
surface_attribs color;
69
surface_attribs texture;
70
surface_attribs normal;
100
curve_attribs texture;
101
curve_attribs normal;
105
typedef struct trim_list_str
107
GLU_trim_enum trim_type;
110
pwl_curve_attribs pwl_curve;
111
curve_attribs nurbs_curve;
114
struct trim_list_str *next;
118
typedef struct seg_trim_str
121
GLint pt_cnt, seg_array_len;
122
struct seg_trim_str *next;
126
typedef struct nurbs_trim_str
128
trim_list *trim_loop;
129
trim_segments *segments;
130
struct nurbs_trim_str *next;
136
GLfloat model[16], proj[16], viewport[4];
138
culling_and_sampling_str;
144
void (GLCALLBACK * error_callback) (GLenum err);
146
GLU_nurbs_enum nurbs_type;
147
GLboolean auto_load_matrix;
148
culling_and_sampling_str sampling_matrices;
149
GLenum sampling_method;
150
GLfloat sampling_tolerance;
151
GLfloat parametric_tolerance;
152
GLint u_step, v_step;
153
nurbs_surface surface;
162
GLfloat *unified_knot;
163
GLint unified_nknots;
167
GLboolean open_at_begin, open_at_end;
176
GLint geom_s_stride, geom_t_stride;
177
GLfloat **geom_offsets;
178
GLint geom_s_pt_cnt, geom_t_pt_cnt;
180
GLint color_s_stride, color_t_stride;
181
GLfloat **color_offsets;
182
GLint color_s_pt_cnt, color_t_pt_cnt;
183
GLfloat *normal_ctrl;
184
GLint normal_s_stride, normal_t_stride;
185
GLfloat **normal_offsets;
186
GLint normal_s_pt_cnt, normal_t_pt_cnt;
187
GLfloat *texture_ctrl;
188
GLint texture_s_stride, texture_t_stride;
189
GLfloat **texture_offsets;
190
GLint texture_s_pt_cnt, texture_t_pt_cnt;
191
GLint s_bezier_cnt, t_bezier_cnt;
195
extern void call_user_error(GLUnurbsObj * nobj, GLenum error);
197
extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order);
199
extern GLenum explode_knot(knot_str_type * the_knot);
201
extern GLenum calc_alphas(knot_str_type * the_knot);
203
extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride,
204
knot_str_type * the_knot, GLint dim,
205
GLfloat ** new_ctrl, GLint * ncontrol);
207
extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl,
208
GLint n_ctrl, GLint order, GLint dim,
211
extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
212
int **sfactors, GLint ** tfactors);
214
extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
215
int **sfactors, GLint ** tfactors);
217
extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj,
218
new_ctrl_type * new_ctrl,
219
int **sfactors, GLint ** tfactors);
221
extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl,
222
GLint n_ctrl, GLint stride, GLint dim);
224
extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl,
225
GLint s_n_ctrl, GLint t_n_ctrl,
226
GLint s_stride, GLint t_stride,
229
extern void do_nurbs_curve(GLUnurbsObj * nobj);
231
extern void do_nurbs_surface(GLUnurbsObj * nobj);
233
extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
234
GLint * sfactors, GLint * tfactors);
236
extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src,
237
GLfloat maximal_min_knot,
238
GLfloat minimal_max_knot);
240
extern GLenum select_knot_working_range(GLUnurbsObj * nobj,
241
knot_str_type * geom_knot,
242
knot_str_type * color_knot,
243
knot_str_type * normal_knot,
244
knot_str_type * texture_knot);
246
extern void free_unified_knots(knot_str_type * geom_knot,
247
knot_str_type * color_knot,
248
knot_str_type * normal_knot,
249
knot_str_type * texture_knot);