1 /* $Id: nurbs.h,v 1.2 1999/11/11 03:21:43 kendallb Exp $ */
4 * Mesa 3-D graphics library
6 * Copyright (C) 1995-1999 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.
26 * Revision 1.2 1999/11/11 03:21:43 kendallb
28 * . Updated GL/gl.h with GLCALLACKP and GLAPIENTRYP macros for compatibility
29 * with the IBM VisualAge C++ compiler. Eventually some more code will be
30 * needed in the headers to enable the reversal of (__stdcall*) to (*__stdcall)
31 * for the IBM compilers, however we currently build using our own header files
32 * that already handle this.
34 * . Changed instances of (GLCALLBACK*) to GLCALLBACKP for compatibility
35 * with the IBM VisualAge C++ compiler in src-glu.
37 * . Misc cleanups for warnings generated with Watcom C++ in src-glu. Compiles
38 * with 0 warnings now.
40 * . tess_hash.c: line 244 - Why is this function stubbed out? I removed the
41 * code with a #if 0 to avoid a compiler warning, but it looks dangerous.
43 * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
46 * Revision 1.5 1999/02/27 13:55:31 brianp
47 * fixed BeOS-related GLU typedef problems
49 * Revision 1.4 1999/01/03 03:23:15 brianp
50 * now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
52 * Revision 1.3 1997/05/27 03:18:23 brianp
55 * Revision 1.2 1997/05/27 03:00:16 brianp
56 * incorporated Bogdan's new NURBS code
58 * Revision 1.1 1996/09/27 01:19:39 brianp
65 * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
66 * See README2 for more info.
74 #define EPSILON 1e-06 /* epsilon for double precision compares */
78 GLU_NURBS_CURVE
, GLU_NURBS_SURFACE
, GLU_NURBS_TRIM
, GLU_NURBS_NO_TRIM
,
79 GLU_NURBS_TRIM_DONE
, GLU_NURBS_NONE
84 GLU_TRIM_NURBS
, GLU_TRIM_PWL
104 surface_attribs geom
;
105 surface_attribs color
;
106 surface_attribs texture
;
107 surface_attribs normal
;
134 curve_attribs texture
;
135 curve_attribs normal
;
138 typedef struct trim_list_str
140 GLU_trim_enum trim_type
;
143 pwl_curve_attribs pwl_curve
;
144 curve_attribs nurbs_curve
;
146 struct trim_list_str
*next
;
149 typedef struct seg_trim_str
152 GLint pt_cnt
,seg_array_len
;
153 struct seg_trim_str
*next
;
156 typedef struct nurbs_trim_str
158 trim_list
*trim_loop
;
159 trim_segments
*segments
;
160 struct nurbs_trim_str
*next
;
165 GLfloat model
[16],proj
[16],viewport
[4];
166 } culling_and_sampling_str
;
171 void (GLCALLBACKP error_callback
)( GLenum err
);
173 GLU_nurbs_enum nurbs_type
;
174 GLboolean auto_load_matrix
;
175 culling_and_sampling_str
177 GLenum sampling_method
;
178 GLfloat sampling_tolerance
;
179 GLfloat parametric_tolerance
;
180 GLint u_step
, v_step
;
181 nurbs_surface surface
;
190 GLfloat
*unified_knot
;
191 GLint unified_nknots
;
195 GLboolean open_at_begin
,open_at_end
;
203 GLint geom_s_stride
,geom_t_stride
;
204 GLfloat
**geom_offsets
;
205 GLint geom_s_pt_cnt
,geom_t_pt_cnt
;
207 GLint color_s_stride
,color_t_stride
;
208 GLfloat
**color_offsets
;
209 GLint color_s_pt_cnt
,color_t_pt_cnt
;
210 GLfloat
*normal_ctrl
;
211 GLint normal_s_stride
,normal_t_stride
;
212 GLfloat
**normal_offsets
;
213 GLint normal_s_pt_cnt
,normal_t_pt_cnt
;
214 GLfloat
*texture_ctrl
;
215 GLint texture_s_stride
,texture_t_stride
;
216 GLfloat
**texture_offsets
;
217 GLint texture_s_pt_cnt
,texture_t_pt_cnt
;
218 GLint s_bezier_cnt
,t_bezier_cnt
;
221 extern void call_user_error( GLUnurbsObj
*nobj
, GLenum error
);
223 extern GLenum
test_knot(GLint nknots
, GLfloat
*knot
, GLint order
);
225 extern GLenum
explode_knot(knot_str_type
*the_knot
);
227 extern GLenum
calc_alphas(knot_str_type
*the_knot
);
229 extern GLenum
calc_new_ctrl_pts(GLfloat
*ctrl
,GLint stride
,knot_str_type
*the_knot
,
230 GLint dim
,GLfloat
**new_ctrl
,GLint
*ncontrol
);
232 extern GLenum
glu_do_sampling_crv(GLUnurbsObj
*nobj
, GLfloat
*new_ctrl
,GLint n_ctrl
,
233 GLint order
,GLint dim
,GLint
**factors
);
235 extern GLenum
glu_do_sampling_3D(GLUnurbsObj
*nobj
, new_ctrl_type
*new_ctrl
,
236 int **sfactors
, GLint
**tfactors
);
238 extern GLenum
glu_do_sampling_uv(GLUnurbsObj
*nobj
, new_ctrl_type
*new_ctrl
,
239 int **sfactors
, GLint
**tfactors
);
241 extern GLenum
glu_do_sampling_param_3D(GLUnurbsObj
*nobj
, new_ctrl_type
*new_ctrl
,
242 int **sfactors
, GLint
**tfactors
);
244 extern GLboolean
fine_culling_test_2D(GLUnurbsObj
*nobj
, GLfloat
*ctrl
, GLint n_ctrl
,
245 GLint stride
, GLint dim
);
247 extern GLboolean
fine_culling_test_3D(GLUnurbsObj
*nobj
, GLfloat
*ctrl
,
248 GLint s_n_ctrl
, GLint t_n_ctrl
, GLint s_stride
, GLint t_stride
, GLint dim
);
250 extern void do_nurbs_curve( GLUnurbsObj
*nobj
);
252 extern void do_nurbs_surface( GLUnurbsObj
*nobj
);
254 extern GLenum
patch_trimming(GLUnurbsObj
*nobj
,new_ctrl_type
*new_ctrl
,
255 GLint
*sfactors
, GLint
*tfactors
);
257 extern void collect_unified_knot(knot_str_type
*dest
, knot_str_type
*src
,
258 GLfloat maximal_min_knot
, GLfloat minimal_max_knot
);
260 extern GLenum
select_knot_working_range(GLUnurbsObj
*nobj
,knot_str_type
*geom_knot
,
261 knot_str_type
*color_knot
, knot_str_type
*normal_knot
,
262 knot_str_type
*texture_knot
);
264 extern void free_unified_knots(knot_str_type
*geom_knot
, knot_str_type
*color_knot
,
265 knot_str_type
*normal_knot
, knot_str_type
*texture_knot
);