Merge branch 'upstream-gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / glu / mesa / tess.h
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 * This file is part of the polygon tesselation code contributed by
25 * Bogdan Sikorski
26 */
27
28
29 #ifndef TESS_H
30 #define TESS_H
31
32
33 #include "gluP.h"
34
35 #define EPSILON 1e-06 /* epsilon for double precision compares */
36
37 typedef enum
38 {
39 OXY,
40 OYZ,
41 OXZ
42 }
43 projection_type;
44
45 typedef struct callbacks_str
46 {
47 void (GLCALLBACK * begin) (GLenum mode);
48 void (GLCALLBACK * edgeFlag) (GLboolean flag);
49 void (GLCALLBACK * vertex) (GLvoid * v);
50 void (GLCALLBACK * end) (void);
51 void (GLCALLBACK * error) (GLenum err);
52 }
53 tess_callbacks;
54
55 typedef struct vertex_str
56 {
57 void *data;
58 GLdouble location[3];
59 GLdouble x, y;
60 GLboolean edge_flag;
61 struct vertex_str *shadow_vertex;
62 struct vertex_str *next, *previous;
63 }
64 tess_vertex;
65
66 typedef struct contour_str
67 {
68 GLenum type;
69 GLuint vertex_cnt;
70 GLdouble area;
71 GLenum orientation;
72 struct vertex_str *vertices, *last_vertex;
73 struct contour_str *next, *previous;
74 }
75 tess_contour;
76
77 typedef struct polygon_str
78 {
79 GLuint vertex_cnt;
80 GLdouble A, B, C, D;
81 GLdouble area;
82 GLenum orientation;
83 struct vertex_str *vertices, *last_vertex;
84 }
85 tess_polygon;
86
87 struct GLUtesselator
88 {
89 tess_contour *contours, *last_contour;
90 GLuint contour_cnt;
91 tess_callbacks callbacks;
92 tess_polygon *current_polygon;
93 GLenum error;
94 GLdouble A, B, C, D;
95 projection_type projection;
96 };
97
98
99 extern void tess_call_user_error(GLUtriangulatorObj *, GLenum);
100 extern void tess_test_polygon(GLUtriangulatorObj *);
101 extern void tess_find_contour_hierarchies(GLUtriangulatorObj *);
102 extern void tess_handle_holes(GLUtriangulatorObj *);
103 extern void tess_tesselate(GLUtriangulatorObj *);
104 extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *);
105
106
107 #endif