diff options
author | Julien Cristau <[email protected]> | 2007-02-01 11:50:36 +0100 |
---|---|---|
committer | Julien Cristau <[email protected]> | 2007-02-01 11:50:36 +0100 |
commit | 2634f06c2095b79d4252bb81c0b0272139dad890 (patch) | |
tree | 855ba634812939982daa999dc44365a4d889d11e /src/glu/mini/nurbs.h | |
parent | 7549426a168f3803d6023622dd9e630a5fa2faf6 (diff) | |
parent | eb667b979bc941f05b8f40a2fc39af6fac960ac5 (diff) |
Merge branch 'upstream-experimental' into debian-experimental
Conflicts:
progs/util/README
progs/util/glstate.c
progs/util/glstate.h
progs/util/sampleMakefile
src/glu/sgi/libnurbs/interface/bezierEval.h
src/glu/sgi/libnurbs/interface/bezierPatch.cc
src/glu/sgi/libnurbs/interface/bezierPatch.h
src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
src/glu/sgi/libnurbs/interface/bezierPatchMesh.h
src/glu/sgi/libnurbs/interface/glcurveval.cc
src/glu/sgi/libnurbs/interface/glimports.h
src/glu/sgi/libnurbs/interface/glinterface.cc
src/glu/sgi/libnurbs/interface/glrenderer.h
src/glu/sgi/libnurbs/interface/incurveeval.cc
src/glu/sgi/libnurbs/interface/insurfeval.cc
src/glu/sgi/libnurbs/interface/mystdio.h
src/glu/sgi/libnurbs/interface/mystdlib.h
src/glu/sgi/libnurbs/internals/arc.h
src/glu/sgi/libnurbs/internals/arcsorter.cc
src/glu/sgi/libnurbs/internals/arcsorter.h
src/glu/sgi/libnurbs/internals/arctess.h
src/glu/sgi/libnurbs/internals/backend.cc
src/glu/sgi/libnurbs/internals/backend.h
src/glu/sgi/libnurbs/internals/basiccrveval.h
src/glu/sgi/libnurbs/internals/basicsurfeval.h
src/glu/sgi/libnurbs/internals/bezierarc.h
src/glu/sgi/libnurbs/internals/bin.cc
src/glu/sgi/libnurbs/internals/bin.h
src/glu/sgi/libnurbs/internals/bufpool.cc
src/glu/sgi/libnurbs/internals/bufpool.h
src/glu/sgi/libnurbs/internals/cachingeval.cc
src/glu/sgi/libnurbs/internals/cachingeval.h
src/glu/sgi/libnurbs/internals/ccw.cc
src/glu/sgi/libnurbs/internals/coveandtiler.h
src/glu/sgi/libnurbs/internals/curve.cc
src/glu/sgi/libnurbs/internals/curve.h
src/glu/sgi/libnurbs/internals/curvelist.cc
src/glu/sgi/libnurbs/internals/curvelist.h
src/glu/sgi/libnurbs/internals/curvesub.cc
src/glu/sgi/libnurbs/internals/dataTransform.cc
src/glu/sgi/libnurbs/internals/dataTransform.h
src/glu/sgi/libnurbs/internals/defines.h
src/glu/sgi/libnurbs/internals/displaylist.cc
src/glu/sgi/libnurbs/internals/displaylist.h
src/glu/sgi/libnurbs/internals/displaymode.h
src/glu/sgi/libnurbs/internals/flist.cc
src/glu/sgi/libnurbs/internals/flist.h
src/glu/sgi/libnurbs/internals/flistsorter.cc
src/glu/sgi/libnurbs/internals/flistsorter.h
src/glu/sgi/libnurbs/internals/gridline.h
src/glu/sgi/libnurbs/internals/gridtrimvertex.h
src/glu/sgi/libnurbs/internals/gridvertex.h
src/glu/sgi/libnurbs/internals/hull.cc
src/glu/sgi/libnurbs/internals/hull.h
src/glu/sgi/libnurbs/internals/intersect.cc
src/glu/sgi/libnurbs/internals/jarcloc.h
src/glu/sgi/libnurbs/internals/knotvector.h
src/glu/sgi/libnurbs/internals/mapdesc.cc
src/glu/sgi/libnurbs/internals/mapdesc.h
src/glu/sgi/libnurbs/internals/mapdescv.cc
src/glu/sgi/libnurbs/internals/maplist.cc
src/glu/sgi/libnurbs/internals/maplist.h
src/glu/sgi/libnurbs/internals/mesher.cc
src/glu/sgi/libnurbs/internals/mesher.h
src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc
src/glu/sgi/libnurbs/internals/monotonizer.cc
src/glu/sgi/libnurbs/internals/monotonizer.h
src/glu/sgi/libnurbs/internals/myassert.h
src/glu/sgi/libnurbs/internals/mycode.cc
src/glu/sgi/libnurbs/internals/mystring.h
src/glu/sgi/libnurbs/internals/nurbsconsts.h
src/glu/sgi/libnurbs/internals/nurbstess.cc
src/glu/sgi/libnurbs/internals/patch.cc
src/glu/sgi/libnurbs/internals/patch.h
src/glu/sgi/libnurbs/internals/patchlist.cc
src/glu/sgi/libnurbs/internals/patchlist.h
src/glu/sgi/libnurbs/internals/pwlarc.h
src/glu/sgi/libnurbs/internals/quilt.cc
src/glu/sgi/libnurbs/internals/quilt.h
src/glu/sgi/libnurbs/internals/reader.cc
src/glu/sgi/libnurbs/internals/reader.h
src/glu/sgi/libnurbs/internals/renderhints.cc
src/glu/sgi/libnurbs/internals/renderhints.h
src/glu/sgi/libnurbs/internals/simplemath.h
src/glu/sgi/libnurbs/internals/slicer.cc
src/glu/sgi/libnurbs/internals/slicer.h
src/glu/sgi/libnurbs/internals/sorter.cc
src/glu/sgi/libnurbs/internals/sorter.h
src/glu/sgi/libnurbs/internals/splitarcs.cc
src/glu/sgi/libnurbs/internals/subdivider.h
src/glu/sgi/libnurbs/internals/tobezier.cc
src/glu/sgi/libnurbs/internals/trimline.cc
src/glu/sgi/libnurbs/internals/trimline.h
src/glu/sgi/libnurbs/internals/trimregion.cc
src/glu/sgi/libnurbs/internals/trimregion.h
src/glu/sgi/libnurbs/internals/trimvertex.h
src/glu/sgi/libnurbs/internals/trimvertpool.cc
src/glu/sgi/libnurbs/internals/trimvertpool.h
src/glu/sgi/libnurbs/internals/types.h
src/glu/sgi/libnurbs/internals/uarray.cc
src/glu/sgi/libnurbs/internals/uarray.h
src/glu/sgi/libnurbs/internals/varray.cc
src/glu/sgi/libnurbs/internals/varray.h
src/glu/sgi/libnurbs/nurbtess/definitions.h
src/glu/sgi/libnurbs/nurbtess/directedLine.h
src/glu/sgi/libnurbs/nurbtess/glimports.h
src/glu/sgi/libnurbs/nurbtess/gridWrap.cc
src/glu/sgi/libnurbs/nurbtess/gridWrap.h
src/glu/sgi/libnurbs/nurbtess/monoChain.cc
src/glu/sgi/libnurbs/nurbtess/monoChain.h
src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc
src/glu/sgi/libnurbs/nurbtess/monoTriangulation.h
src/glu/sgi/libnurbs/nurbtess/mystdio.h
src/glu/sgi/libnurbs/nurbtess/mystdlib.h
src/glu/sgi/libnurbs/nurbtess/partitionX.cc
src/glu/sgi/libnurbs/nurbtess/partitionX.h
src/glu/sgi/libnurbs/nurbtess/partitionY.cc
src/glu/sgi/libnurbs/nurbtess/partitionY.h
src/glu/sgi/libnurbs/nurbtess/polyDBG.h
src/glu/sgi/libnurbs/nurbtess/polyUtil.cc
src/glu/sgi/libnurbs/nurbtess/polyUtil.h
src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc
src/glu/sgi/libnurbs/nurbtess/primitiveStream.h
src/glu/sgi/libnurbs/nurbtess/quicksort.cc
src/glu/sgi/libnurbs/nurbtess/quicksort.h
src/glu/sgi/libnurbs/nurbtess/rectBlock.cc
src/glu/sgi/libnurbs/nurbtess/rectBlock.h
src/glu/sgi/libnurbs/nurbtess/sampleComp.cc
src/glu/sgi/libnurbs/nurbtess/sampleComp.h
src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h
src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc
src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h
src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h
src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc
src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h
src/glu/sgi/libnurbs/nurbtess/sampledLine.cc
src/glu/sgi/libnurbs/nurbtess/sampledLine.h
src/glu/sgi/libnurbs/nurbtess/searchTree.cc
src/glu/sgi/libnurbs/nurbtess/searchTree.h
src/glu/sgi/libnurbs/nurbtess/zlassert.h
src/glu/sgi/libtess/README
src/glu/sgi/libtess/alg-outline
src/glu/sgi/libtess/dict-list.h
src/glu/sgi/libtess/dict.c
src/glu/sgi/libtess/dict.h
src/glu/sgi/libtess/geom.c
src/glu/sgi/libtess/memalloc.c
src/glu/sgi/libtess/memalloc.h
src/glu/sgi/libtess/mesh.c
src/glu/sgi/libtess/mesh.h
src/glu/sgi/libtess/normal.h
src/glu/sgi/libtess/priorityq-heap.c
src/glu/sgi/libtess/priorityq-heap.h
src/glu/sgi/libtess/priorityq-sort.h
src/glu/sgi/libtess/priorityq.c
src/glu/sgi/libtess/priorityq.h
src/glu/sgi/libtess/render.c
src/glu/sgi/libtess/render.h
src/glu/sgi/libtess/sweep.h
src/glu/sgi/libtess/tess.h
src/glu/sgi/libtess/tessmono.c
src/glu/sgi/libtess/tessmono.h
src/glu/sgi/libutil/error.c
src/glu/sgi/libutil/glue.c
src/glu/sgi/libutil/gluint.h
src/glu/sgi/libutil/project.c
src/glu/sgi/libutil/registry.c
Diffstat (limited to 'src/glu/mini/nurbs.h')
-rw-r--r-- | src/glu/mini/nurbs.h | 253 |
1 files changed, 253 insertions, 0 deletions
diff --git a/src/glu/mini/nurbs.h b/src/glu/mini/nurbs.h new file mode 100644 index 00000000000..c9c9c094f1a --- /dev/null +++ b/src/glu/mini/nurbs.h @@ -0,0 +1,253 @@ +/* $Id: nurbs.h,v 1.2 2003/08/22 20:11:43 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * Copyright (C) 1995-2000 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * NURBS implementation written by Bogdan Sikorski ([email protected]) + * See README2 for more info. + */ + + +#ifndef NURBS_H +#define NURBS_H + + +#define EPSILON 1e-06 /* epsilon for double precision compares */ + +typedef enum +{ + GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM, + GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE +} +GLU_nurbs_enum; + +typedef enum +{ + GLU_TRIM_NURBS, GLU_TRIM_PWL +} +GLU_trim_enum; + +typedef struct +{ + GLint sknot_count; + GLfloat *sknot; + GLint tknot_count; + GLfloat *tknot; + GLint s_stride; + GLint t_stride; + GLfloat *ctrlarray; + GLint sorder; + GLint torder; + GLint dim; + GLenum type; +} +surface_attribs; + +typedef struct +{ + surface_attribs geom; + surface_attribs color; + surface_attribs texture; + surface_attribs normal; +} +nurbs_surface; + +typedef struct +{ + GLint knot_count; + GLfloat *knot; + GLint stride; + GLfloat *ctrlarray; + GLint order; + GLint dim; + GLenum type; +} +curve_attribs; + +typedef struct +{ + GLint pt_count; + GLfloat *ctrlarray; + GLint stride; + GLint dim; + GLenum type; +} +pwl_curve_attribs; + +typedef struct +{ + curve_attribs geom; + curve_attribs color; + curve_attribs texture; + curve_attribs normal; +} +nurbs_curve; + +typedef struct trim_list_str +{ + GLU_trim_enum trim_type; + union + { + pwl_curve_attribs pwl_curve; + curve_attribs nurbs_curve; + } + curve; + struct trim_list_str *next; +} +trim_list; + +typedef struct seg_trim_str +{ + GLfloat *points; + GLint pt_cnt, seg_array_len; + struct seg_trim_str *next; +} +trim_segments; + +typedef struct nurbs_trim_str +{ + trim_list *trim_loop; + trim_segments *segments; + struct nurbs_trim_str *next; +} +nurbs_trim; + +typedef struct +{ + GLfloat model[16], proj[16], viewport[4]; +} +culling_and_sampling_str; + +struct GLUnurbs +{ + GLboolean culling; + GLenum error; + void (GLCALLBACK * error_callback) (GLenum err); + GLenum display_mode; + GLU_nurbs_enum nurbs_type; + GLboolean auto_load_matrix; + culling_and_sampling_str sampling_matrices; + GLenum sampling_method; + GLfloat sampling_tolerance; + GLfloat parametric_tolerance; + GLint u_step, v_step; + nurbs_surface surface; + nurbs_curve curve; + nurbs_trim *trim; +}; + +typedef struct +{ + GLfloat *knot; + GLint nknots; + GLfloat *unified_knot; + GLint unified_nknots; + GLint order; + GLint t_min, t_max; + GLint delta_nknots; + GLboolean open_at_begin, open_at_end; + GLfloat *new_knot; + GLfloat *alpha; +} +knot_str_type; + +typedef struct +{ + GLfloat *geom_ctrl; + GLint geom_s_stride, geom_t_stride; + GLfloat **geom_offsets; + GLint geom_s_pt_cnt, geom_t_pt_cnt; + GLfloat *color_ctrl; + GLint color_s_stride, color_t_stride; + GLfloat **color_offsets; + GLint color_s_pt_cnt, color_t_pt_cnt; + GLfloat *normal_ctrl; + GLint normal_s_stride, normal_t_stride; + GLfloat **normal_offsets; + GLint normal_s_pt_cnt, normal_t_pt_cnt; + GLfloat *texture_ctrl; + GLint texture_s_stride, texture_t_stride; + GLfloat **texture_offsets; + GLint texture_s_pt_cnt, texture_t_pt_cnt; + GLint s_bezier_cnt, t_bezier_cnt; +} +new_ctrl_type; + +extern void call_user_error(GLUnurbsObj * nobj, GLenum error); + +extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order); + +extern GLenum explode_knot(knot_str_type * the_knot); + +extern GLenum calc_alphas(knot_str_type * the_knot); + +extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, + knot_str_type * the_knot, GLint dim, + GLfloat ** new_ctrl, GLint * ncontrol); + +extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl, + GLint n_ctrl, GLint order, GLint dim, + GLint ** factors); + +extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, + int **sfactors, GLint ** tfactors); + +extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, + int **sfactors, GLint ** tfactors); + +extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj, + new_ctrl_type * new_ctrl, + int **sfactors, GLint ** tfactors); + +extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl, + GLint n_ctrl, GLint stride, GLint dim); + +extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl, + GLint s_n_ctrl, GLint t_n_ctrl, + GLint s_stride, GLint t_stride, + GLint dim); + +extern void do_nurbs_curve(GLUnurbsObj * nobj); + +extern void do_nurbs_surface(GLUnurbsObj * nobj); + +extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, + GLint * sfactors, GLint * tfactors); + +extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src, + GLfloat maximal_min_knot, + GLfloat minimal_max_knot); + +extern GLenum select_knot_working_range(GLUnurbsObj * nobj, + knot_str_type * geom_knot, + knot_str_type * color_knot, + knot_str_type * normal_knot, + knot_str_type * texture_knot); + +extern void free_unified_knots(knot_str_type * geom_knot, + knot_str_type * color_knot, + knot_str_type * normal_knot, + knot_str_type * texture_knot); + + + +#endif |