ReactOS 0.4.15-dev-6069-g56a4501
tessmono.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int __gl_meshTessellateMonoRegion (GLUface *face)
 
int __gl_meshTessellateInterior (GLUmesh *mesh)
 
void __gl_meshDiscardExterior (GLUmesh *mesh)
 
int __gl_meshSetWindingNumber (GLUmesh *mesh, int value, GLboolean keepOnlyBoundary)
 

Function Documentation

◆ __gl_meshDiscardExterior()

void __gl_meshDiscardExterior ( GLUmesh mesh)

Definition at line 155 of file tessmono.c.

156{
157 GLUface *f, *next;
158
159 /*LINTED*/
160 for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) {
161 /* Since f will be destroyed, save its next pointer. */
162 next = f->next;
163 if( ! f->inside ) {
165 }
166 }
167}
void __gl_meshZapFace(GLUface *fZap)
Definition: mesh.c:555
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: mesh.h:126
Definition: mesh.c:198

Referenced by gluTessEndPolygon().

◆ __gl_meshSetWindingNumber()

int __gl_meshSetWindingNumber ( GLUmesh mesh,
int  value,
GLboolean  keepOnlyBoundary 
)

Definition at line 179 of file tessmono.c.

181{
182 GLUhalfEdge *e, *eNext;
183
184 for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) {
185 eNext = e->next;
186 if( e->Rface->inside != e->Lface->inside ) {
187
188 /* This is a boundary edge (one side is interior, one is exterior). */
189 e->winding = (e->Lface->inside) ? value : -value;
190 } else {
191
192 /* Both regions are interior, or both are exterior. */
193 if( ! keepOnlyBoundary ) {
194 e->winding = 0;
195 } else {
196 if ( !__gl_meshDelete( e ) ) return 0;
197 }
198 }
199 }
200 return 1;
201}
int __gl_meshDelete(GLUhalfEdge *eDel)
Definition: mesh.c:384
#define e
Definition: ke_i.h:82
struct define * next
Definition: compiler.c:65
Definition: pdh_main.c:94

Referenced by gluTessEndPolygon().

◆ __gl_meshTessellateInterior()

int __gl_meshTessellateInterior ( GLUmesh mesh)

Definition at line 133 of file tessmono.c.

134{
135 GLUface *f, *next;
136
137 /*LINTED*/
138 for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) {
139 /* Make sure we don''t try to tessellate the new triangles. */
140 next = f->next;
141 if( f->inside ) {
142 if ( !__gl_meshTessellateMonoRegion( f ) ) return 0;
143 }
144 }
145
146 return 1;
147}
int __gl_meshTessellateMonoRegion(GLUface *face)
Definition: tessmono.c:72

Referenced by gluTessEndPolygon().

◆ __gl_meshTessellateMonoRegion()

int __gl_meshTessellateMonoRegion ( GLUface face)

Definition at line 72 of file tessmono.c.

73{
74 GLUhalfEdge *up, *lo;
75
76 /* All edges are oriented CCW around the boundary of the region.
77 * First, find the half-edge whose origin vertex is rightmost.
78 * Since the sweep goes from left to right, face->anEdge should
79 * be close to the edge we want.
80 */
81 up = face->anEdge;
82 assert( up->Lnext != up && up->Lnext->Lnext != up );
83
84 for( ; VertLeq( up->Dst, up->Org ); up = up->Lprev )
85 ;
86 for( ; VertLeq( up->Org, up->Dst ); up = up->Lnext )
87 ;
88 lo = up->Lprev;
89
90 while( up->Lnext != lo ) {
91 if( VertLeq( up->Dst, lo->Org )) {
92 /* up->Dst is on the left. It is safe to form triangles from lo->Org.
93 * The EdgeGoesLeft test guarantees progress even when some triangles
94 * are CW, given that the upper and lower chains are truly monotone.
95 */
96 while( lo->Lnext != up && (EdgeGoesLeft( lo->Lnext )
97 || EdgeSign( lo->Org, lo->Dst, lo->Lnext->Dst ) <= 0 )) {
98 GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo );
99 if (tempHalfEdge == NULL) return 0;
100 lo = tempHalfEdge->Sym;
101 }
102 lo = lo->Lprev;
103 } else {
104 /* lo->Org is on the left. We can make CCW triangles from up->Dst. */
105 while( lo->Lnext != up && (EdgeGoesRight( up->Lprev )
106 || EdgeSign( up->Dst, up->Org, up->Lprev->Org ) >= 0 )) {
107 GLUhalfEdge *tempHalfEdge= __gl_meshConnect( up, up->Lprev );
108 if (tempHalfEdge == NULL) return 0;
109 up = tempHalfEdge->Sym;
110 }
111 up = up->Lnext;
112 }
113 }
114
115 /* Now lo->Org == up->Dst == the leftmost vertex. The remaining region
116 * can be tessellated in a fan from this leftmost vertex.
117 */
118 assert( lo->Lnext != up );
119 while( lo->Lnext->Lnext != up ) {
120 GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo );
121 if (tempHalfEdge == NULL) return 0;
122 lo = tempHalfEdge->Sym;
123 }
124
125 return 1;
126}
#define NULL
Definition: types.h:112
GLUhalfEdge * __gl_meshConnect(GLUhalfEdge *eOrg, GLUhalfEdge *eDst)
Definition: mesh.c:508
#define assert(x)
Definition: debug.h:53
#define VertLeq(u, v)
Definition: geom.h:50
#define EdgeGoesRight(e)
Definition: geom.h:66
#define EdgeGoesLeft(e)
Definition: geom.h:65
#define EdgeSign(u, v, w)
Definition: geom.h:55
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define up(mutex)
Definition: glue.h:30
GLUhalfEdge * Lnext
Definition: mesh.h:142
GLUvertex * Org
Definition: mesh.h:143
GLUhalfEdge * Sym
Definition: mesh.h:140

Referenced by __gl_meshTessellateInterior().