ReactOS  0.4.14-dev-1233-gf5658fd
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 )
85  coveUpperLeft();
86  else
87  coveLowerLeft();
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  }
112  coveUpperLeftNoGrid( bl );
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  }
127  coveLowerLeftNoGrid( tl );
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  }
149  coveUpperRightNoGrid( br );
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  }
164  coveLowerRightNoGrid( tr );
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);
176  backend.endtmesh();
177  }
178 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
long uend
Definition: gridline.h:44
void endtmesh(void)
Definition: backend.cc:460
Gridline bot
Definition: trimregion.h:56
long ustart
Definition: gridline.h:43
float ustart
Definition: uvcode.h:7
#define assert(x)
Definition: debug.h:53
void coveLowerRightNoGrid(TrimVertex *)
void coveUpperLeftNoGrid(TrimVertex *)
Backend & backend
Definition: coveandtiler.h:52
void coveUpperLeft(void)
long nuid
Definition: trimvertex.h:50
REAL * uarray
Definition: uarray.h:52
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
Uarray uarray
Definition: trimregion.h:57
void coveUpperRight(void)
void set(long, long)
void coveLowerRight(void)
void coveLowerLeftNoGrid(TrimVertex *)
REAL vval
Definition: gridline.h:41
void coveUpperRightNoGrid(TrimVertex *)
w ll
Definition: byte_order.h:166
REAL param[2]
Definition: trimvertex.h:45
void coveLowerLeft(void)
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
void tile(long, long, long)

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 );
358  backend.swaptmesh();
359  }
360  } else while( 1 ) {
361  if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){
362  output( vert );
363  backend.swaptmesh();
364  vert = left.prev();
365  if( vert == NULL ) break;
366  } else {
367  backend.swaptmesh();
368  output( gv );
369  if( gv.prevu() == top.ustart ) {
370  for( ; vert; vert = left.prev() ) {
371  output( vert );
372  backend.swaptmesh();
373  }
374  break;
375  }
376  }
377  }
378 }
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
Gridline bot
Definition: trimregion.h:56
long ustart
Definition: gridline.h:43
#define assert(x)
Definition: debug.h:53
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
smooth NULL
Definition: ftsmooth.c:416
REAL * uarray
Definition: uarray.h:52
GLint left
Definition: glext.h:7726
Uarray uarray
Definition: trimregion.h:57
REAL param[2]
Definition: trimvertex.h:45
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

Referenced by coveLowerLeft(), and coveLowerLeftNoGrid().

◆ coveLowerLeft()

void CoveAndTiler::coveLowerLeft ( void  )
private

Definition at line 320 of file coveandtiler.cc.

321 {
322  GridVertex bgv( bot.ustart, bot.vindex );
323  GridVertex gv( bot.ustart, top.vindex );
324 
325  left.last();
326  backend.bgntmesh( "coveLowerLeft" );
327  output( left.prev() );
328  output( bgv );
329  backend.swaptmesh();
330  output( gv );
331  coveLL();
332  backend.endtmesh();
333 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
Gridline bot
Definition: trimregion.h:56
long ustart
Definition: gridline.h:43
void coveLL(void)
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
GLint left
Definition: glext.h:7726
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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() );
341  backend.swaptmesh();
342  output( tl );
343  coveLL( );
344  backend.endtmesh();
345 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
void coveLL(void)
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
GLint left
Definition: glext.h:7726

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 );
391  backend.swaptmesh();
392  coveLR();
393  backend.endtmesh( );
394 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
long uend
Definition: gridline.h:44
void endtmesh(void)
Definition: backend.cc:460
Gridline bot
Definition: trimregion.h:56
void coveLR(void)
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
GLdouble GLdouble right
Definition: glext.h:10859
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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 );
403  backend.swaptmesh();
404  coveLR();
405  backend.endtmesh();
406 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
void coveLR(void)
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
GLdouble GLdouble right
Definition: glext.h:10859

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() ) {
418  backend.swaptmesh();
419  output( vert );
420  }
421  } else while( 1 ) {
422  if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) {
423  backend.swaptmesh();
424  output( vert );
425  vert = right.prev();
426  if( vert == NULL ) break;
427  } else {
428  output( gv );
429  backend.swaptmesh();
430  if( gv.nextu() == top.uend ) {
431  for( ; vert; vert = right.prev() ) {
432  backend.swaptmesh();
433  output( vert );
434  }
435  break;
436  }
437  }
438  }
439 }
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
long uend
Definition: gridline.h:44
Gridline bot
Definition: trimregion.h:56
#define assert(x)
Definition: debug.h:53
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
smooth NULL
Definition: ftsmooth.c:416
REAL * uarray
Definition: uarray.h:52
GLdouble GLdouble right
Definition: glext.h:10859
Uarray uarray
Definition: trimregion.h:57
REAL param[2]
Definition: trimvertex.h:45
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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() ) {
296  backend.swaptmesh();
297  output( vert );
298  }
299  } else while( 1 ) {
300  if( vert->param[0] > uarray.uarray[gv.gparam[0]] ) {
301  backend.swaptmesh();
302  output( vert );
303  vert = left.next();
304  if( vert == NULL ) break;
305  } else {
306  output( gv );
307  backend.swaptmesh();
308  if( gv.prevu() == bot.ustart ) {
309  for( ; vert; vert = left.next() ) {
310  backend.swaptmesh();
311  output( vert );
312  }
313  break;
314  }
315  }
316  }
317 }
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
Gridline bot
Definition: trimregion.h:56
long ustart
Definition: gridline.h:43
#define assert(x)
Definition: debug.h:53
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
smooth NULL
Definition: ftsmooth.c:416
REAL * uarray
Definition: uarray.h:52
GLint left
Definition: glext.h:7726
Uarray uarray
Definition: trimregion.h:57
REAL param[2]
Definition: trimvertex.h:45
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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 );
269  backend.swaptmesh();
270  coveUL();
271  backend.endtmesh();
272 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
Gridline bot
Definition: trimregion.h:56
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
void coveUL(void)
GLint left
Definition: glext.h:7726
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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 );
281  backend.swaptmesh();
282  coveUL();
283  backend.endtmesh();
284 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
void coveUL(void)
GLint left
Definition: glext.h:7726

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 );
206  backend.swaptmesh();
207  output( gv );
208  coveUR();
209  backend.endtmesh();
210 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
Gridline bot
Definition: trimregion.h:56
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
void coveUR(void)
GLdouble GLdouble right
Definition: glext.h:10859
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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() );
218  backend.swaptmesh();
219  output( br );
220  coveUR();
221  backend.endtmesh();
222 }
void bgntmesh(const char *)
Definition: backend.cc:246
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
void endtmesh(void)
Definition: backend.cc:460
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
void coveUR(void)
GLdouble GLdouble right
Definition: glext.h:10859

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 );
236  backend.swaptmesh();
237  }
238  } else while( 1 ) {
239  if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) {
240  output( vert );
241  backend.swaptmesh();
242  vert = right.next();
243  if( vert == NULL ) break;
244  } else {
245  backend.swaptmesh();
246  output( gv );
247  if( gv.nextu() == bot.uend ) {
248  for( ; vert; vert = right.next() ) {
249  output( vert );
250  backend.swaptmesh();
251  }
252  break;
253  }
254  }
255  }
256 }
void output(GridTrimVertex &)
Definition: coveandtiler.cc:72
long uend
Definition: gridline.h:44
Gridline bot
Definition: trimregion.h:56
#define assert(x)
Definition: debug.h:53
void swaptmesh(void)
Definition: backend.cc:442
Backend & backend
Definition: coveandtiler.h:52
smooth NULL
Definition: ftsmooth.c:416
REAL * uarray
Definition: uarray.h:52
GLdouble GLdouble right
Definition: glext.h:10859
Uarray uarray
Definition: trimregion.h:57
REAL param[2]
Definition: trimvertex.h:45
long vindex
Definition: gridline.h:42
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

Referenced by coveUpperRight(), and coveUpperRightNoGrid().

◆ output() [1/3]

void CoveAndTiler::output ( GridTrimVertex g)
inlineprivate

Definition at line 72 of file coveandtiler.cc.

73 {
74  backend.tmeshvert( &g );
75 }
void tmeshvert(GridTrimVertex *)
Definition: backend.cc:269
Backend & backend
Definition: coveandtiler.h:52
GLboolean GLboolean g
Definition: glext.h:6204

Referenced by coveAndTile(), coveLL(), coveLowerLeft(), coveLowerLeftNoGrid(), coveLowerRight(), coveLowerRightNoGrid(), coveLR(), coveUL(), coveUpperLeft(), coveUpperLeftNoGrid(), coveUpperRight(), coveUpperRightNoGrid(), and coveUR().

◆ output() [2/3]

void CoveAndTiler::output ( GridVertex gv)
inlineprivate

Definition at line 60 of file coveandtiler.cc.

61 {
62  backend.tmeshvert( &gv );
63 }
void tmeshvert(GridTrimVertex *)
Definition: backend.cc:269
Backend & backend
Definition: coveandtiler.h:52

◆ output() [3/3]

void CoveAndTiler::output ( TrimVertex tv)
inlineprivate

Definition at line 66 of file coveandtiler.cc.

67 {
68  backend.tmeshvert( tv );
69 }
void tmeshvert(GridTrimVertex *)
Definition: backend.cc:269
Backend & backend
Definition: coveandtiler.h:52

◆ 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
float ustart
Definition: uvcode.h:7
Backend & backend
Definition: coveandtiler.h:52
static const int MAXSTRIPSIZE
Definition: coveandtiler.h:53
void tile(long, long, long)

Referenced by coveAndTile().

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: