ReactOS 0.4.16-dev-401-g45b008d
CoveAndTiler Class Reference

#include <coveandtiler.h>

Inheritance diagram for CoveAndTiler:
Collaboration diagram for CoveAndTiler:

Public Member Functions

 CoveAndTiler (Backend &)
 
 ~CoveAndTiler (void)
 
void coveAndTile (void)
 
- Public Member Functions inherited from TrimRegion
 TrimRegion ()
 
void init (REAL)
 
void advance (REAL, REAL, REAL)
 
void setDu (REAL)
 
void init (long, Arc_ptr)
 
void getPts (Arc_ptr)
 
void getPts (Backend &)
 
void getGridExtent (TrimVertex *, TrimVertex *)
 
void getGridExtent (void)
 
int canTile (void)
 

Private Member Functions

void tile (long, long, long)
 
void coveLowerLeft (void)
 
void coveLowerRight (void)
 
void coveUpperLeft (void)
 
void coveUpperRight (void)
 
void coveUpperLeftNoGrid (TrimVertex *)
 
void coveUpperRightNoGrid (TrimVertex *)
 
void coveLowerLeftNoGrid (TrimVertex *)
 
void coveLowerRightNoGrid (TrimVertex *)
 
void coveLL (void)
 
void coveLR (void)
 
void coveUL (void)
 
void coveUR (void)
 
void output (GridTrimVertex &)
 
void output (GridVertex &)
 
void output (TrimVertex *)
 

Private Attributes

Backendbackend
 

Static Private Attributes

static const int MAXSTRIPSIZE = 1000
 

Additional Inherited Members

- Public Attributes inherited from TrimRegion
Trimline left
 
Trimline right
 
Gridline top
 
Gridline bot
 
Uarray uarray
 

Detailed Description

Definition at line 46 of file coveandtiler.h.

Constructor & Destructor Documentation

◆ CoveAndTiler()

CoveAndTiler::CoveAndTiler ( Backend b)

Definition at line 52 of file coveandtiler.cc.

53 : backend( b )
54{ }
Backend & backend
Definition: coveandtiler.h:52
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

◆ ~CoveAndTiler()

CoveAndTiler::~CoveAndTiler ( void  )

Definition at line 56 of file coveandtiler.cc.

57{ }

Member Function Documentation

◆ coveAndTile()

void CoveAndTiler::coveAndTile ( void  )

Definition at line 78 of file coveandtiler.cc.

79{
80 long ustart = (top.ustart >= bot.ustart) ? top.ustart : bot.ustart;
81 long uend = (top.uend <= bot.uend) ? top.uend : bot.uend;
82 if( ustart <= uend ) {
83 tile( bot.vindex, ustart, uend );
84 if( top.ustart >= bot.ustart )
86 else
88
89 if( top.uend <= bot.uend )
91 else
93 } else {
94 TrimVertex blv, tlv, *bl, *tl;
95 GridTrimVertex bllv, tllv;
96 TrimVertex *lf = left.first();
97 TrimVertex *ll = left.last();
98 if( lf->param[0] >= ll->param[0] ) {
99 blv.param[0] = lf->param[0];
100 blv.param[1] = ll->param[1];
101 blv.nuid = 0; // XXX
102 assert( blv.param[1] == bot.vval );
103 bl = &blv;
104 tl = lf;
105 tllv.set( lf );
106 if( ll->param[0] > uarray.uarray[top.ustart-1] ) {
107 bllv.set( ll );
108 assert( ll->param[0] <= uarray.uarray[bot.ustart] );
109 } else {
110 bllv.set( top.ustart-1, bot.vindex );
111 }
113 } else {
114 tlv.param[0] = ll->param[0];
115 tlv.param[1] = lf->param[1];
116 tlv.nuid = 0; // XXX
117 assert( tlv.param[1] == top.vval );
118 tl = &tlv;
119 bl = ll;
120 bllv.set( ll );
121 if( lf->param[0] > uarray.uarray[bot.ustart-1] ) {
122 assert( lf->param[0] <= uarray.uarray[bot.ustart] );
123 tllv.set( lf );
124 } else {
125 tllv.set( bot.ustart-1, top.vindex );
126 }
128 }
129
130 TrimVertex brv, trv, *br, *tr;
131 GridTrimVertex brrv, trrv;
132 TrimVertex *rf = right.first();
133 TrimVertex *rl = right.last();
134
135 if( rf->param[0] <= rl->param[0] ) {
136 brv.param[0] = rf->param[0];
137 brv.param[1] = rl->param[1];
138 brv.nuid = 0; // XXX
139 assert( brv.param[1] == bot.vval );
140 br = &brv;
141 tr = rf;
142 trrv.set( rf );
143 if( rl->param[0] < uarray.uarray[top.uend+1] ) {
144 assert( rl->param[0] >= uarray.uarray[top.uend] );
145 brrv.set( rl );
146 } else {
147 brrv.set( top.uend+1, bot.vindex );
148 }
150 } else {
151 trv.param[0] = rl->param[0];
152 trv.param[1] = rf->param[1];
153 trv.nuid = 0; // XXX
154 assert( trv.param[1] == top.vval );
155 tr = &trv;
156 br = rl;
157 brrv.set( rl );
158 if( rf->param[0] < uarray.uarray[bot.uend+1] ) {
159 assert( rf->param[0] >= uarray.uarray[bot.uend] );
160 trrv.set( rf );
161 } else {
162 trrv.set( bot.uend+1, top.vindex );
163 }
165 }
166
167 backend.bgntmesh( "doit" );
168 output(trrv);
169 output(tllv);
170 output( tr );
171 output( tl );
172 output( br );
173 output( bl );
174 output(brrv);
175 output(bllv);
177 }
178}
w ll
Definition: byte_order.h:167
void endtmesh(void)
Definition: backend.cc:460
void bgntmesh(const char *)
Definition: backend.cc:246
void coveLowerRightNoGrid(TrimVertex *)
void tile(long, long, long)
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void coveUpperLeft(void)
void coveLowerLeft(void)
void coveLowerLeftNoGrid(TrimVertex *)
void coveUpperRightNoGrid(TrimVertex *)
void coveLowerRight(void)
void coveUpperRight(void)
void coveUpperLeftNoGrid(TrimVertex *)
void set(long, long)
Gridline bot
Definition: trimregion.h:56
Uarray uarray
Definition: trimregion.h:57
REAL param[2]
Definition: trimvertex.h:45
long nuid
Definition: trimvertex.h:50
REAL * uarray
Definition: uarray.h:52
#define assert(x)
Definition: debug.h:53
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
REAL vval
Definition: gridline.h:41
long uend
Definition: gridline.h:44
long ustart
Definition: gridline.h:43
long vindex
Definition: gridline.h:42
float ustart
Definition: uvcode.h:7

Referenced by Slicer::slice_old().

◆ coveLL()

void CoveAndTiler::coveLL ( void  )
private

Definition at line 348 of file coveandtiler.cc.

349{
350 GridVertex gv( bot.ustart, top.vindex );
351 TrimVertex *vert = left.prev();
352 if( vert == NULL ) return;
353 assert( vert->param[0] <= uarray.uarray[gv.gparam[0]] );
354
355 if( gv.prevu() <= top.ustart ) {
356 for( ; vert; vert = left.prev() ) {
357 output( vert );
359 }
360 } else while( 1 ) {
361 if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){
362 output( vert );
364 vert = left.prev();
365 if( vert == NULL ) break;
366 } else {
368 output( gv );
369 if( gv.prevu() == top.ustart ) {
370 for( ; vert; vert = left.prev() ) {
371 output( vert );
373 }
374 break;
375 }
376 }
377 }
378}
void swaptmesh(void)
Definition: backend.cc:442
#define NULL
Definition: types.h:112

Referenced by coveLowerLeft(), and coveLowerLeftNoGrid().

◆ coveLowerLeft()

void CoveAndTiler::coveLowerLeft ( void  )
private

Definition at line 320 of file coveandtiler.cc.

321{
323 GridVertex gv( bot.ustart, top.vindex );
324
325 left.last();
326 backend.bgntmesh( "coveLowerLeft" );
327 output( left.prev() );
328 output( bgv );
330 output( gv );
331 coveLL();
333}
void coveLL(void)

Referenced by coveAndTile().

◆ coveLowerLeftNoGrid()

void CoveAndTiler::coveLowerLeftNoGrid ( TrimVertex tl)
private

Definition at line 336 of file coveandtiler.cc.

337{
338 backend.bgntmesh( "coveLowerLeft" );
339 output( left.last() );
340 output( left.prev() );
342 output( tl );
343 coveLL( );
345}

Referenced by coveAndTile().

◆ coveLowerRight()

void CoveAndTiler::coveLowerRight ( void  )
private

Definition at line 381 of file coveandtiler.cc.

382{
383 GridVertex bgv( bot.uend, bot.vindex );
384 GridVertex gv( bot.uend, top.vindex );
385
386 right.last();
387 backend.bgntmesh( "coveLowerRight" );
388 output( bgv );
389 output( right.prev() );
390 output( gv );
392 coveLR();
393 backend.endtmesh( );
394}
void coveLR(void)

Referenced by coveAndTile().

◆ coveLowerRightNoGrid()

void CoveAndTiler::coveLowerRightNoGrid ( TrimVertex tr)
private

Definition at line 397 of file coveandtiler.cc.

398{
399 backend.bgntmesh( "coveLowerRIght" );
400 output( right.last() );
401 output( right.prev() );
402 output( tr );
404 coveLR();
406}

Referenced by coveAndTile().

◆ coveLR()

void CoveAndTiler::coveLR ( void  )
private

Definition at line 409 of file coveandtiler.cc.

410{
411 GridVertex gv( bot.uend, top.vindex );
412 TrimVertex *vert = right.prev();
413 if( vert == NULL ) return;
414 assert( vert->param[0] >= uarray.uarray[gv.gparam[0]] );
415
416 if( gv.nextu() >= top.uend ) {
417 for( ; vert; vert = right.prev() ) {
419 output( vert );
420 }
421 } else while( 1 ) {
422 if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) {
424 output( vert );
425 vert = right.prev();
426 if( vert == NULL ) break;
427 } else {
428 output( gv );
430 if( gv.nextu() == top.uend ) {
431 for( ; vert; vert = right.prev() ) {
433 output( vert );
434 }
435 break;
436 }
437 }
438 }
439}

Referenced by coveLowerRight(), and coveLowerRightNoGrid().

◆ coveUL()

void CoveAndTiler::coveUL ( void  )
private

Definition at line 287 of file coveandtiler.cc.

288{
289 GridVertex gv( top.ustart, bot.vindex );
290 TrimVertex *vert = left.next();
291 if( vert == NULL ) return;
292 assert( vert->param[0] <= uarray.uarray[gv.gparam[0]] );
293
294 if( gv.prevu() <= bot.ustart ) {
295 for( ; vert; vert = left.next() ) {
297 output( vert );
298 }
299 } else while( 1 ) {
300 if( vert->param[0] > uarray.uarray[gv.gparam[0]] ) {
302 output( vert );
303 vert = left.next();
304 if( vert == NULL ) break;
305 } else {
306 output( gv );
308 if( gv.prevu() == bot.ustart ) {
309 for( ; vert; vert = left.next() ) {
311 output( vert );
312 }
313 break;
314 }
315 }
316 }
317}

Referenced by coveUpperLeft(), and coveUpperLeftNoGrid().

◆ coveUpperLeft()

void CoveAndTiler::coveUpperLeft ( void  )
private

Definition at line 259 of file coveandtiler.cc.

260{
261 GridVertex tgv( top.ustart, top.vindex );
262 GridVertex gv( top.ustart, bot.vindex );
263
264 left.first();
265 backend.bgntmesh( "coveUpperLeft" );
266 output( tgv );
267 output( left.next() );
268 output( gv );
270 coveUL();
272}
void coveUL(void)

Referenced by coveAndTile().

◆ coveUpperLeftNoGrid()

void CoveAndTiler::coveUpperLeftNoGrid ( TrimVertex bl)
private

Definition at line 275 of file coveandtiler.cc.

276{
277 backend.bgntmesh( "coveUpperLeftNoGrid" );
278 output( left.first() );
279 output( left.next() );
280 output( bl );
282 coveUL();
284}

Referenced by coveAndTile().

◆ coveUpperRight()

void CoveAndTiler::coveUpperRight ( void  )
private

Definition at line 197 of file coveandtiler.cc.

198{
199 GridVertex tgv( top.uend, top.vindex );
200 GridVertex gv( top.uend, bot.vindex );
201
202 right.first();
203 backend.bgntmesh( "coveUpperRight" );
204 output( right.next() );
205 output( tgv );
207 output( gv );
208 coveUR();
210}
void coveUR(void)

Referenced by coveAndTile().

◆ coveUpperRightNoGrid()

void CoveAndTiler::coveUpperRightNoGrid ( TrimVertex br)
private

Definition at line 213 of file coveandtiler.cc.

214{
215 backend.bgntmesh( "coveUpperRight" );
216 output( right.first() );
217 output( right.next() );
219 output( br );
220 coveUR();
222}

Referenced by coveAndTile().

◆ coveUR()

void CoveAndTiler::coveUR ( void  )
private

Definition at line 225 of file coveandtiler.cc.

226{
227 GridVertex gv( top.uend, bot.vindex );
228 TrimVertex *vert = right.next();
229 if( vert == NULL ) return;
230
231 assert( vert->param[0] >= uarray.uarray[gv.gparam[0]] );
232
233 if( gv.nextu() >= bot.uend ) {
234 for( ; vert; vert = right.next() ) {
235 output( vert );
237 }
238 } else while( 1 ) {
239 if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) {
240 output( vert );
242 vert = right.next();
243 if( vert == NULL ) break;
244 } else {
246 output( gv );
247 if( gv.nextu() == bot.uend ) {
248 for( ; vert; vert = right.next() ) {
249 output( vert );
251 }
252 break;
253 }
254 }
255 }
256}

Referenced by coveUpperRight(), and coveUpperRightNoGrid().

◆ output() [1/3]

void CoveAndTiler::output ( GridTrimVertex g)
inlineprivate

◆ output() [2/3]

void CoveAndTiler::output ( GridVertex gv)
inlineprivate

Definition at line 60 of file coveandtiler.cc.

61{
62 backend.tmeshvert( &gv );
63}

◆ output() [3/3]

void CoveAndTiler::output ( TrimVertex tv)
inlineprivate

Definition at line 66 of file coveandtiler.cc.

67{
68 backend.tmeshvert( tv );
69}

◆ tile()

void CoveAndTiler::tile ( long  vindex,
long  ustart,
long  uend 
)
private

Definition at line 181 of file coveandtiler.cc.

182{
183 long numsteps = uend - ustart;
184
185 if( numsteps == 0 ) return;
186
187 if( numsteps > MAXSTRIPSIZE ) {
188 long umid = ustart + (uend - ustart) / 2;
189 tile( vindex, ustart, umid );
190 tile( vindex, umid, uend );
191 } else {
192 backend.surfmesh( ustart, vindex-1, numsteps, 1 );
193 }
194}
void surfmesh(long, long, long, long)
Definition: backend.cc:136
static const int MAXSTRIPSIZE
Definition: coveandtiler.h:53

Referenced by coveAndTile(), and tile().

Member Data Documentation

◆ backend

◆ MAXSTRIPSIZE

const int CoveAndTiler::MAXSTRIPSIZE = 1000
staticprivate

Definition at line 53 of file coveandtiler.h.

Referenced by tile().


The documentation for this class was generated from the following files: