Kstars

src/tess.h
1 /*
2 ** Author: Eric Veach, July 1994.
3 **
4 */
5 
6 #ifndef __tess_h_
7 #define __tess_h_
8 
9 #include "glu.h"
10 #include <setjmp.h>
11 #include "mesh.h"
12 #include "dict.h"
13 #include "priorityq.h"
14 
15 /* The begin/end calls must be properly nested. We keep track of
16  * the current state to enforce the ordering.
17  */
18 enum TessState
19 {
20  T_DORMANT,
21  T_IN_POLYGON,
22  T_IN_CONTOUR
23 };
24 
25 /* We cache vertex data for single-contour polygons so that we can
26  * try a quick-and-dirty decomposition first.
27  */
28 #define TESS_MAX_CACHE 100
29 
30 typedef struct CachedVertex
31 {
32  GLdouble coords[3];
33  void *data;
34 } CachedVertex;
35 
36 struct GLUtesselator
37 {
38  /*** state needed for collecting the input data ***/
39 
40  enum TessState state; /* what begin/end calls have we seen? */
41 
42  GLUhalfEdge *lastEdge; /* lastEdge->Org is the most recent vertex */
43  GLUmesh *mesh; /* stores the input contours, and eventually
44  the tessellation itself */
45 
46  void(GLAPIENTRY *callError)(GLenum errnum);
47 
48  /*** state needed for projecting onto the sweep plane ***/
49 
50  GLdouble normal[3]; /* user-specified normal (if provided) */
51  GLdouble sUnit[3]; /* unit vector in s-direction (debugging) */
52  GLdouble tUnit[3]; /* unit vector in t-direction (debugging) */
53 
54  /*** state needed for the line sweep ***/
55 
56  GLdouble relTolerance; /* tolerance for merging features */
57  GLenum windingRule; /* rule for determining polygon interior */
58  GLboolean fatalError; /* fatal error: needed combine callback */
59 
60  Dict *dict; /* edge dictionary for sweep line */
61  PriorityQ *pq; /* priority queue of vertex events */
62  GLUvertex *event; /* current sweep event being processed */
63 
64  void(GLAPIENTRY *callCombine)(GLdouble coords[3], void *data[4], GLfloat weight[4], void **outData);
65 
66  /*** state needed for rendering callbacks (see render.c) ***/
67 
68  GLboolean flagBoundary; /* mark boundary edges (use EdgeFlag) */
69  GLboolean boundaryOnly; /* Extract contours, not triangles */
70  GLUface *lonelyTriList;
71  /* list of triangles which could not be rendered as strips or fans */
72 
73  void(GLAPIENTRY *callBegin)(GLenum type);
74  void(GLAPIENTRY *callEdgeFlag)(GLboolean boundaryEdge);
75  void(GLAPIENTRY *callVertex)(void *data);
76  void(GLAPIENTRY *callEnd)(void);
77  void(GLAPIENTRY *callMesh)(GLUmesh *mesh);
78 
79  /*** state needed to cache single-contour polygons for renderCache() */
80 
81  GLboolean emptyCache; /* empty cache on next vertex() call */
82  int cacheCount; /* number of cached vertices */
83  CachedVertex cache[TESS_MAX_CACHE]; /* the vertex data */
84 
85  /*** rendering callbacks that also pass polygon data ***/
86  void(GLAPIENTRY *callBeginData)(GLenum type, void *polygonData);
87  void(GLAPIENTRY *callEdgeFlagData)(GLboolean boundaryEdge, void *polygonData);
88  void(GLAPIENTRY *callVertexData)(void *data, void *polygonData);
89  void(GLAPIENTRY *callEndData)(void *polygonData);
90  void(GLAPIENTRY *callErrorData)(GLenum errnum, void *polygonData);
91  void(GLAPIENTRY *callCombineData)(GLdouble coords[3], void *data[4], GLfloat weight[4], void **outData,
92  void *polygonData);
93 
94  jmp_buf env; /* place to jump to when memAllocs fail */
95 
96  void *polygonData; /* client data for current polygon */
97 };
98 
99 void GLAPIENTRY __gl_noBeginData(GLenum type, void *polygonData);
100 void GLAPIENTRY __gl_noEdgeFlagData(GLboolean boundaryEdge, void *polygonData);
101 void GLAPIENTRY __gl_noVertexData(void *data, void *polygonData);
102 void GLAPIENTRY __gl_noEndData(void *polygonData);
103 void GLAPIENTRY __gl_noErrorData(GLenum errnum, void *polygonData);
104 void GLAPIENTRY __gl_noCombineData(GLdouble coords[3], void *data[4], GLfloat weight[4], void **outData,
105  void *polygonData);
106 
107 #define CALL_BEGIN_OR_BEGIN_DATA(a) \
108  if (tess->callBeginData != &__gl_noBeginData) \
109  (*tess->callBeginData)((a), tess->polygonData); \
110  else \
111  (*tess->callBegin)((a));
112 
113 #define CALL_VERTEX_OR_VERTEX_DATA(a) \
114  if (tess->callVertexData != &__gl_noVertexData) \
115  (*tess->callVertexData)((a), tess->polygonData); \
116  else \
117  (*tess->callVertex)((a));
118 
119 #define CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA(a) \
120  if (tess->callEdgeFlagData != &__gl_noEdgeFlagData) \
121  (*tess->callEdgeFlagData)((a), tess->polygonData); \
122  else \
123  (*tess->callEdgeFlag)((a));
124 
125 #define CALL_END_OR_END_DATA() \
126  if (tess->callEndData != &__gl_noEndData) \
127  (*tess->callEndData)(tess->polygonData); \
128  else \
129  (*tess->callEnd)();
130 
131 #define CALL_COMBINE_OR_COMBINE_DATA(a, b, c, d) \
132  if (tess->callCombineData != &__gl_noCombineData) \
133  (*tess->callCombineData)((a), (b), (c), (d), tess->polygonData); \
134  else \
135  (*tess->callCombine)((a), (b), (c), (d));
136 
137 #define CALL_ERROR_OR_ERROR_DATA(a) \
138  if (tess->callErrorData != &__gl_noErrorData) \
139  (*tess->callErrorData)((a), tess->polygonData); \
140  else \
141  (*tess->callError)((a));
142 
143 #endif
Type type(const QSqlDatabase &db)
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 15 2022 04:04:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.