Quake II RTX doxygen  1.0 dev
polyset.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 // d_polyset.c: routines for drawing sets of polygons sharing the same
19 // texture (used for Alias models)
20 
21 #include "sw.h"
22 
23 // TODO: put in span spilling to shrink list size
24 #define DPS_MAXSPANS MAXHEIGHT+1
25 // 1 extra for spanpackage that marks end
26 
27 typedef struct {
28  void *pdest;
29  short *pz;
30  int count;
31  byte *ptex;
32  int sfrac, tfrac, light, zi;
34 
35 typedef struct {
36  int isflattop;
45 } edgetable_t;
46 
48 
49 static int r_p0[6], r_p1[6], r_p2[6];
50 
51 static int d_xdenom;
52 
53 static const edgetable_t *pedgetable;
54 
55 static const edgetable_t edgetables[12] = {
56  {0, 1, r_p0, r_p2, NULL, 2, r_p0, r_p1, r_p2},
57  {0, 2, r_p1, r_p0, r_p2, 1, r_p1, r_p2, NULL},
58  {1, 1, r_p0, r_p2, NULL, 1, r_p1, r_p2, NULL},
59  {0, 1, r_p1, r_p0, NULL, 2, r_p1, r_p2, r_p0},
60  {0, 2, r_p0, r_p2, r_p1, 1, r_p0, r_p1, NULL},
61  {0, 1, r_p2, r_p1, NULL, 1, r_p2, r_p0, NULL},
62  {0, 1, r_p2, r_p1, NULL, 2, r_p2, r_p0, r_p1},
63  {0, 2, r_p2, r_p1, r_p0, 1, r_p2, r_p0, NULL},
64  {0, 1, r_p1, r_p0, NULL, 1, r_p1, r_p2, NULL},
65  {1, 1, r_p2, r_p1, NULL, 1, r_p0, r_p1, NULL},
66  {1, 1, r_p1, r_p0, NULL, 1, r_p2, r_p0, NULL},
67  {0, 1, r_p0, r_p2, NULL, 1, r_p0, r_p1, NULL},
68 };
69 
72 static int r_zistepx, r_zistepy;
74 
76 
79 static byte *d_pdest, *d_ptex;
80 static short *d_pz;
81 static int d_sfrac, d_tfrac, d_light, d_zi;
88 
89 typedef struct {
90  int quotient;
91  int remainder;
92 } adivtab_t;
93 
94 static const adivtab_t adivtab[32 * 32] = {
95 #include "adivtab.h"
96 };
97 
98 void (*d_pdrawspans)(spanpackage_t *pspanpackage);
99 
101 void R_PolysetDrawSpans8_Blended(spanpackage_t *pspanpackage);
102 void R_PolysetDrawSpans8_Opaque(spanpackage_t *pspanpackage);
103 
104 static void R_PolysetSetEdgeTable(void);
105 static void R_RasterizeAliasPolySmooth(void);
106 
107 
108 /*
109 ================
110 R_DrawTriangle
111 ================
112 */
113 void R_DrawTriangle(void)
114 {
116  int dv1_ab, dv0_ac;
117  int dv0_ab, dv1_ac;
118 
121 
122  if (!(dv0_ab | dv1_ab))
123  return;
124 
127 
128  if (!(dv0_ac | dv1_ac))
129  return;
130 
131  d_xdenom = (dv0_ac * dv1_ab) - (dv0_ab * dv1_ac);
132 
133  if (d_xdenom < 0) {
134  a_spans = spans;
135 
136  r_p0[0] = aliastriangleparms.a->u; // u
137  r_p0[1] = aliastriangleparms.a->v; // v
138  r_p0[2] = aliastriangleparms.a->s; // s
139  r_p0[3] = aliastriangleparms.a->t; // t
140  r_p0[4] = aliastriangleparms.a->l; // light
141  r_p0[5] = aliastriangleparms.a->zi; // iz
142 
143  r_p1[0] = aliastriangleparms.b->u;
144  r_p1[1] = aliastriangleparms.b->v;
145  r_p1[2] = aliastriangleparms.b->s;
146  r_p1[3] = aliastriangleparms.b->t;
147  r_p1[4] = aliastriangleparms.b->l;
148  r_p1[5] = aliastriangleparms.b->zi;
149 
150  r_p2[0] = aliastriangleparms.c->u;
151  r_p2[1] = aliastriangleparms.c->v;
152  r_p2[2] = aliastriangleparms.c->s;
153  r_p2[3] = aliastriangleparms.c->t;
154  r_p2[4] = aliastriangleparms.c->l;
155  r_p2[5] = aliastriangleparms.c->zi;
156 
159  }
160 }
161 
162 
163 /*
164 ===================
165 R_PolysetScanLeftEdge
166 ====================
167 */
169 {
170  do {
175 
178 
179  // FIXME: need to clamp l, s, t, at both ends?
182 
184 
186  if (errorterm >= 0) {
188  d_pz += d_pzextrastep;
192  d_ptex += (d_sfrac >> 16) * TEX_BYTES;
193 
194  d_sfrac &= 0xFFFF;
196  if (d_tfrac & 0x10000) {
198  d_tfrac &= 0xFFFF;
199  }
201  d_zi += d_ziextrastep;
203  } else {
205  d_pz += d_pzbasestep;
209  d_ptex += (d_sfrac >> 16) * TEX_BYTES;
210  d_sfrac &= 0xFFFF;
212  if (d_tfrac & 0x10000) {
214  d_tfrac &= 0xFFFF;
215  }
217  d_zi += d_zibasestep;
218  }
219  } while (--height);
220 }
221 
222 /*
223 ===================
224 FloorDivMod
225 
226 Returns mathematically correct (floor-based) quotient and remainder for
227 numer and denom, both of which should contain no fractional part. The
228 quotient must fit in 32 bits.
229 FIXME: GET RID OF THIS! (FloorDivMod)
230 ====================
231 */
232 static void FloorDivMod(float numer, float denom, int *quotient, int *rem)
233 {
234  int q, r;
235  float x;
236 
237  if (numer >= 0.0) {
238  x = floor(numer / denom);
239  q = (int)x;
240  r = (int)floor(numer - (x * denom));
241  } else {
242  //
243  // perform operations with positive values, and fix mod to make floor-based
244  //
245  x = floor(-numer / denom);
246  q = -(int)x;
247  r = (int)floor(-numer - (x * denom));
248  if (r != 0) {
249  q--;
250  r = (int)denom - r;
251  }
252  }
253 
254  *quotient = q;
255  *rem = r;
256 }
257 
258 
259 /*
260 ===================
261 R_PolysetSetUpForLineScan
262 ====================
263 */
264 static void R_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
265  fixed8_t endvertu, fixed8_t endvertv)
266 {
267  float dm, dn;
268  int tm, tn;
269  const adivtab_t *ptemp;
270 
271  errorterm = -1;
272 
273  tm = endvertu - startvertu;
274  tn = endvertv - startvertv;
275 
276  if (((tm <= 16) && (tm >= -15)) &&
277  ((tn <= 16) && (tn >= -15))) {
278  ptemp = &adivtab[((tm + 15) << 5) + (tn + 15)];
279  ubasestep = ptemp->quotient;
280  erroradjustup = ptemp->remainder;
281  erroradjustdown = tn;
282  } else {
283  dm = tm;
284  dn = tn;
285 
286  FloorDivMod(dm, dn, &ubasestep, &erroradjustup);
287 
288  erroradjustdown = dn;
289  }
290 }
291 
292 /*
293 ================
294 R_PolysetCalcGradients
295 ================
296 */
297 static void R_PolysetCalcGradients(int skinwidth)
298 {
299  float xstepdenominv, ystepdenominv, t0, t1;
300  float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
301 
302  p00_minus_p20 = r_p0[0] - r_p2[0];
303  p01_minus_p21 = r_p0[1] - r_p2[1];
304  p10_minus_p20 = r_p1[0] - r_p2[0];
305  p11_minus_p21 = r_p1[1] - r_p2[1];
306 
307  xstepdenominv = 1.0 / (float)d_xdenom;
308 
309  ystepdenominv = -xstepdenominv;
310 
311 // ceil () for light so positive steps are exaggerated, negative steps
312 // diminished, pushing us away from underflow toward overflow. Underflow is
313 // very visible, overflow is very unlikely, because of ambient lighting
314  t0 = r_p0[4] - r_p2[4];
315  t1 = r_p1[4] - r_p2[4];
316  r_lstepx = (int)
317  ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
318  r_lstepy = (int)
319  ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
320 
321  t0 = r_p0[2] - r_p2[2];
322  t1 = r_p1[2] - r_p2[2];
323  r_sstepx = (int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
324  xstepdenominv);
325  r_sstepy = (int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
326  ystepdenominv);
327 
328  t0 = r_p0[3] - r_p2[3];
329  t1 = r_p1[3] - r_p2[3];
330  r_tstepx = (int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
331  xstepdenominv);
332  r_tstepy = (int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
333  ystepdenominv);
334 
335  t0 = r_p0[5] - r_p2[5];
336  t1 = r_p1[5] - r_p2[5];
337  r_zistepx = (int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
338  xstepdenominv);
339  r_zistepy = (int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
340  ystepdenominv);
341 
342  a_sstepxfrac = r_sstepx & 0xFFFF;
343  a_tstepxfrac = r_tstepx & 0xFFFF;
344 
345  a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16) * TEX_BYTES;
346 }
347 
349 {
350  int lcount;
351  byte *lpdest;
352  byte *lptex;
353  int lsfrac, ltfrac;
354  int llight;
355  int lzi;
356  short *lpz;
357  int tmp[3];
358 
359  do {
360  lcount = d_aspancount - pspanpackage->count;
361 
363  if (errorterm >= 0) {
366  } else {
368  }
369 
370  if (lcount) {
371  lpdest = pspanpackage->pdest;
372  lptex = pspanpackage->ptex;
373  lpz = pspanpackage->pz;
374  lsfrac = pspanpackage->sfrac;
375  ltfrac = pspanpackage->tfrac;
376  llight = pspanpackage->light;
377  lzi = pspanpackage->zi;
378 
379  do {
380  if ((lzi >> 16) >= *lpz) {
381  tmp[0] = (r_aliasblendcolor[0] * llight) >> 15;
382  tmp[1] = (r_aliasblendcolor[1] * llight) >> 15;
383  tmp[2] = (r_aliasblendcolor[2] * llight) >> 15;
384  if (tmp[0] > 255) tmp[0] = 255;
385  if (tmp[1] > 255) tmp[1] = 255;
386  if (tmp[2] > 255) tmp[2] = 255;
387  tmp[0] = (lptex[0] * tmp[0]) >> 8;
388  tmp[1] = (lptex[1] * tmp[1]) >> 8;
389  tmp[2] = (lptex[2] * tmp[2]) >> 8;
390  lpdest[0] = (lpdest[0] * r_alias_one_minus_alpha + tmp[2] * r_alias_alpha) >> 8;
391  lpdest[1] = (lpdest[1] * r_alias_one_minus_alpha + tmp[1] * r_alias_alpha) >> 8;
392  lpdest[2] = (lpdest[2] * r_alias_one_minus_alpha + tmp[0] * r_alias_alpha) >> 8;
393  *lpz = lzi >> 16;
394  }
395  lpdest += VID_BYTES;
396  lzi += r_zistepx;
397  lpz++;
398  llight += r_lstepx;
399  lptex += a_ststepxwhole;
400  lsfrac += a_sstepxfrac;
401  lptex += (lsfrac >> 16) * TEX_BYTES;
402  lsfrac &= 0xFFFF;
403  ltfrac += a_tstepxfrac;
404  if (ltfrac & 0x10000) {
405  lptex += r_affinetridesc.skinwidth;
406  ltfrac &= 0xFFFF;
407  }
408  } while (--lcount);
409  }
410 
411  pspanpackage++;
412  } while (pspanpackage->count != -999999);
413 }
414 
416 {
417  int lcount;
418  byte *lpdest;
419  int lzi;
420  short *lpz;
421 
422  do {
423  lcount = d_aspancount - pspanpackage->count;
424 
426  if (errorterm >= 0) {
429  } else {
431  }
432 
433  if (lcount) {
434  lpdest = pspanpackage->pdest;
435  lpz = pspanpackage->pz;
436  lzi = pspanpackage->zi;
437 
438  do {
439  if ((lzi >> 16) >= *lpz) {
440  lpdest[0] = (lpdest[0] * r_alias_one_minus_alpha + r_aliasblendcolor[2]) >> 8;
441  lpdest[1] = (lpdest[1] * r_alias_one_minus_alpha + r_aliasblendcolor[1]) >> 8;
442  lpdest[2] = (lpdest[2] * r_alias_one_minus_alpha + r_aliasblendcolor[0]) >> 8;
443  }
444  lpdest += VID_BYTES;
445  lzi += r_zistepx;
446  lpz++;
447  } while (--lcount);
448  }
449 
450  pspanpackage++;
451  } while (pspanpackage->count != -999999);
452 }
453 
455 {
456  int lcount;
457 
458  do {
459  lcount = d_aspancount - pspanpackage->count;
460 
462  if (errorterm >= 0) {
465  } else {
467  }
468 
469  if (lcount) {
470  int lsfrac, ltfrac;
471  byte *lpdest;
472  byte *lptex;
473  int llight;
474  int lzi;
475  short *lpz;
476  int tmp[3];
477 
478  lpdest = pspanpackage->pdest;
479  lptex = pspanpackage->ptex;
480  lpz = pspanpackage->pz;
481  lsfrac = pspanpackage->sfrac;
482  ltfrac = pspanpackage->tfrac;
483  llight = pspanpackage->light;
484  lzi = pspanpackage->zi;
485 
486  do {
487  if ((lzi >> 16) >= *lpz) {
488  tmp[0] = (r_aliasblendcolor[0] * llight) >> 15;
489  tmp[1] = (r_aliasblendcolor[1] * llight) >> 15;
490  tmp[2] = (r_aliasblendcolor[2] * llight) >> 15;
491  if (tmp[0] > 255) tmp[0] = 255;
492  if (tmp[1] > 255) tmp[1] = 255;
493  if (tmp[2] > 255) tmp[2] = 255;
494  lpdest[0] = (lptex[2] * tmp[2]) >> 8;
495  lpdest[1] = (lptex[1] * tmp[1]) >> 8;
496  lpdest[2] = (lptex[0] * tmp[0]) >> 8;
497  *lpz = lzi >> 16;
498  }
499  lpdest += VID_BYTES;
500  lzi += r_zistepx;
501  lpz++;
502  llight += r_lstepx;
503  lptex += a_ststepxwhole;
504  lsfrac += a_sstepxfrac;
505  lptex += (lsfrac >> 16) * TEX_BYTES;
506  lsfrac &= 0xFFFF;
507  ltfrac += a_tstepxfrac;
508  if (ltfrac & 0x10000) {
509  lptex += r_affinetridesc.skinwidth;
510  ltfrac &= 0xFFFF;
511  }
512  } while (--lcount);
513  }
514 
515  pspanpackage++;
516  } while (pspanpackage->count != -999999);
517 }
518 
519 static void R_PolysetSetUpAndScanLeftEdge(int *plefttop, int *pleftbottom)
520 {
521  int height, ystart;
522  int working_lstepx;
523 
524  height = pleftbottom[1] - plefttop[1];
525  ystart = plefttop[1];
526 
527  d_ptex = (byte *)r_affinetridesc.pskin + (plefttop[2] >> 16) * TEX_BYTES +
528  (plefttop[3] >> 16) * r_affinetridesc.skinwidth;
529  d_sfrac = plefttop[2] & 0xFFFF;
530  d_tfrac = plefttop[3] & 0xFFFF;
531  d_light = plefttop[4];
532  d_zi = plefttop[5];
533 
534  d_pdest = d_spantable[ystart] + plefttop[0] * VID_BYTES;
535  d_pz = d_zspantable[ystart] + plefttop[0];
536 
537  if (height == 1) {
542 
545 
546  // FIXME: need to clamp l, s, t, at both ends?
549 
551  } else {
552  R_PolysetSetUpForLineScan(plefttop[0], plefttop[1],
553  pleftbottom[0], pleftbottom[1]);
554 
557 
560 
561  // for negative steps in x along left edge, bias toward overflow rather than
562  // underflow (sort of turning the floor () we did in the gradient calcs into
563  // ceil (), but plus a little bit)
564  if (ubasestep < 0)
565  working_lstepx = r_lstepx - 1;
566  else
567  working_lstepx = r_lstepx;
568 
571  ((r_tstepy + r_tstepx * ubasestep) >> 16) *
573  d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
574  d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
575  d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
577 
579  ((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
583  d_lightextrastep = d_lightbasestep + working_lstepx;
585 
587  }
588 }
589 
590 /*
591 ================
592 R_RasterizeAliasPolySmooth
593 ================
594 */
595 static void R_RasterizeAliasPolySmooth(void)
596 {
597  int /*initialleftheight,*/ initialrightheight;
598  int *plefttop, *prighttop, *pleftbottom, *prightbottom;
599  int originalcount;
600 
601  plefttop = pedgetable->pleftedgevert0;
602  prighttop = pedgetable->prightedgevert0;
603 
604  pleftbottom = pedgetable->pleftedgevert1;
605  prightbottom = pedgetable->prightedgevert1;
606 
607  /*initialleftheight = pleftbottom[1] - plefttop[1];*/
608  initialrightheight = prightbottom[1] - prighttop[1];
609 
610 //
611 // set the s, t, and light gradients, which are consistent across the triangle
612 // because being a triangle, things are affine
613 //
615 
616 //
617 // rasterize the polygon
618 //
619 
620 //
621 // scan out the top (and possibly only) part of the left edge
622 //
624 
625  d_aspancount = plefttop[0] - prighttop[0];
626 
627  R_PolysetSetUpAndScanLeftEdge(plefttop, pleftbottom);
628 
629 //
630 // scan out the bottom part of the left edge, if it exists
631 //
632  if (pedgetable->numleftedges == 2) {
633  plefttop = pleftbottom;
634  pleftbottom = pedgetable->pleftedgevert2;
635 
636  d_aspancount = plefttop[0] - prighttop[0];
637 
638  R_PolysetSetUpAndScanLeftEdge(plefttop, pleftbottom);
639  }
640 
641 // scan out the top (and possibly only) part of the right edge, updating the
642 // count field
644 
645  R_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
646  prightbottom[0], prightbottom[1]);
647  d_aspancount = 0;
649  originalcount = a_spans[initialrightheight].count;
650  a_spans[initialrightheight].count = -999999; // mark end of the spanpackages
651  (*d_pdrawspans)(a_spans);
652 
653 // scan out the bottom part of the right edge, if it exists
654  if (pedgetable->numrightedges == 2) {
655  int height;
656  spanpackage_t *pstart;
657 
658  pstart = a_spans + initialrightheight;
659  pstart->count = originalcount;
660 
661  d_aspancount = prightbottom[0] - prighttop[0];
662 
663  prighttop = prightbottom;
664  prightbottom = pedgetable->prightedgevert2;
665 
666  height = prightbottom[1] - prighttop[1];
667 
668  R_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
669  prightbottom[0], prightbottom[1]);
670 
672  a_spans[initialrightheight + height].count = -999999; // mark end of the spanpackages
673  (*d_pdrawspans)(pstart);
674  }
675 }
676 
677 
678 /*
679 ================
680 R_PolysetSetEdgeTable
681 ================
682 */
683 static void R_PolysetSetEdgeTable(void)
684 {
685  int edgetableindex;
686 
687  edgetableindex = 0; // assume the vertices are already in
688  // top to bottom order
689 
690 //
691 // determine which edges are right & left, and the order in which
692 // to rasterize them
693 //
694  if (r_p0[1] >= r_p1[1]) {
695  if (r_p0[1] == r_p1[1]) {
696  if (r_p0[1] < r_p2[1])
697  pedgetable = &edgetables[2];
698  else
699  pedgetable = &edgetables[5];
700 
701  return;
702  } else {
703  edgetableindex = 1;
704  }
705  }
706 
707  if (r_p0[1] == r_p2[1]) {
708  if (edgetableindex)
709  pedgetable = &edgetables[8];
710  else
711  pedgetable = &edgetables[9];
712 
713  return;
714  } else if (r_p1[1] == r_p2[1]) {
715  if (edgetableindex)
716  pedgetable = &edgetables[10];
717  else
718  pedgetable = &edgetables[11];
719 
720  return;
721  }
722 
723  if (r_p0[1] > r_p2[1])
724  edgetableindex += 2;
725 
726  if (r_p1[1] > r_p2[1])
727  edgetableindex += 4;
728 
729  pedgetable = &edgetables[edgetableindex];
730 }
731 
732 
edgetable_t::pleftedgevert1
int * pleftedgevert1
Definition: polyset.c:39
d_countextrastep
static int d_countextrastep
Definition: polyset.c:73
R_PolysetScanLeftEdge
static void R_PolysetScanLeftEdge(int height)
Definition: polyset.c:168
r_lstepy
static int r_lstepy
Definition: polyset.c:71
d_sfrac
static int d_sfrac
Definition: polyset.c:81
spanpackage_t::count
int count
Definition: polyset.c:30
r_zistepx
static int r_zistepx
Definition: polyset.c:72
edgetable_t::pleftedgevert0
int * pleftedgevert0
Definition: polyset.c:38
d_zi
static int d_zi
Definition: polyset.c:81
finalvert_s::u
int u
Definition: sw.h:163
R_PolysetDrawSpans8_Opaque
void R_PolysetDrawSpans8_Opaque(spanpackage_t *pspanpackage)
Definition: polyset.c:454
height
static int height
Definition: physical_sky.c:39
R_PolysetDrawSpansConstant8_Blended
void R_PolysetDrawSpansConstant8_Blended(spanpackage_t *pspanpackage)
Definition: polyset.c:415
d_sfracextrastep
static int d_sfracextrastep
Definition: polyset.c:82
d_ptexbasestep
static int d_ptexbasestep
Definition: polyset.c:84
r_p2
static int r_p2[6]
Definition: polyset.c:49
aliastriangleparms_t::b
finalvert_t * b
Definition: sw.h:294
edgetable_t::numleftedges
int numleftedges
Definition: polyset.c:37
DPS_MAXSPANS
#define DPS_MAXSPANS
Definition: polyset.c:24
edgetable_t::prightedgevert0
int * prightedgevert0
Definition: polyset.c:42
d_light
static int d_light
Definition: polyset.c:81
R_PolysetSetUpForLineScan
static void R_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv)
Definition: polyset.c:264
d_ziextrastep
static int d_ziextrastep
Definition: polyset.c:86
erroradjustdown
static int erroradjustdown
Definition: polyset.c:75
TEX_BYTES
#define TEX_BYTES
Definition: sw.h:50
r_aliasblendcolor
fixed8_t r_aliasblendcolor[3]
Definition: alias.c:31
R_RasterizeAliasPolySmooth
static void R_RasterizeAliasPolySmooth(void)
Definition: polyset.c:595
R_PolysetDrawSpans8_Blended
void R_PolysetDrawSpans8_Blended(spanpackage_t *pspanpackage)
Definition: polyset.c:348
pedgetable
static const edgetable_t * pedgetable
Definition: polyset.c:53
d_screenrowbytes
int d_screenrowbytes
Definition: main.c:126
d_zibasestep
static int d_zibasestep
Definition: polyset.c:86
r_lstepx
static int r_lstepx
Definition: polyset.c:70
edgetables
static const edgetable_t edgetables[12]
Definition: polyset.c:55
finalvert_s::t
int t
Definition: sw.h:163
d_lightbasestep
static int d_lightbasestep
Definition: polyset.c:84
a_ststepxwhole
static int a_ststepxwhole
Definition: polyset.c:70
edgetable_t::prightedgevert2
int * prightedgevert2
Definition: polyset.c:44
spanpackage_t::tfrac
int tfrac
Definition: polyset.c:32
r_zistepy
static int r_zistepy
Definition: polyset.c:72
finalvert_s::v
int v
Definition: sw.h:163
d_pdestextrastep
static int d_pdestextrastep
Definition: polyset.c:83
adivtab
static const adivtab_t adivtab[32 *32]
Definition: polyset.c:94
d_pedgespanpackage
static spanpackage_t * d_pedgespanpackage
Definition: polyset.c:78
spanpackage_t::pz
short * pz
Definition: polyset.c:29
d_xdenom
static int d_xdenom
Definition: polyset.c:51
edgetable_t::numrightedges
int numrightedges
Definition: polyset.c:41
sw.h
r_alias_alpha
int r_alias_alpha
Definition: alias.c:29
R_PolysetSetUpAndScanLeftEdge
static void R_PolysetSetUpAndScanLeftEdge(int *plefttop, int *pleftbottom)
Definition: polyset.c:519
d_aspancount
static int d_aspancount
Definition: polyset.c:73
adivtab_t::remainder
int remainder
Definition: polyset.c:91
spanpackage_t::sfrac
int sfrac
Definition: polyset.c:32
d_spantable
byte * d_spantable[MAXHEIGHT]
Definition: main.c:130
edgetable_t
Definition: polyset.c:35
a_spans
static spanpackage_t * a_spans
Definition: polyset.c:77
d_tfracextrastep
static int d_tfracextrastep
Definition: polyset.c:83
d_zwidth
int d_zwidth
Definition: main.c:129
d_zspantable
short * d_zspantable[MAXHEIGHT]
Definition: main.c:131
d_sfracbasestep
static int d_sfracbasestep
Definition: polyset.c:85
void
void(APIENTRY *qwglDrawBuffer)(GLenum mode)
finalvert_s::zi
int zi
Definition: sw.h:165
d_ptex
static byte * d_ptex
Definition: polyset.c:79
d_pdrawspans
void(* d_pdrawspans)(spanpackage_t *pspanpackage)
Definition: polyset.c:98
d_pzbasestep
static int d_pzbasestep
Definition: polyset.c:87
R_PolysetCalcGradients
static void R_PolysetCalcGradients(int skinwidth)
Definition: polyset.c:297
ubasestep
static int ubasestep
Definition: polyset.c:75
errorterm
static int errorterm
Definition: polyset.c:75
affinetridesc_t::skinwidth
int skinwidth
Definition: sw.h:172
spanpackage_t
Definition: polyset.c:27
edgetable_t::pleftedgevert2
int * pleftedgevert2
Definition: polyset.c:40
aliastriangleparms_t
Definition: sw.h:293
VID_BYTES
#define VID_BYTES
Definition: sw.h:49
d_lightextrastep
static int d_lightextrastep
Definition: polyset.c:83
aliastriangleparms_t::a
finalvert_t * a
Definition: sw.h:294
edgetable_t::prightedgevert1
int * prightedgevert1
Definition: polyset.c:43
erroradjustup
static int erroradjustup
Definition: polyset.c:75
spanpackage_t::pdest
void * pdest
Definition: polyset.c:28
r_sstepy
static int r_sstepy
Definition: polyset.c:71
finalvert_s::s
int s
Definition: sw.h:163
d_pdestbasestep
static int d_pdestbasestep
Definition: polyset.c:84
d_pzextrastep
static int d_pzextrastep
Definition: polyset.c:87
r_alias_one_minus_alpha
int r_alias_one_minus_alpha
Definition: alias.c:30
r_p1
static int r_p1[6]
Definition: polyset.c:49
aliastriangleparms_t::c
finalvert_t * c
Definition: sw.h:294
d_ptexextrastep
static int d_ptexextrastep
Definition: polyset.c:82
adivtab_t
Definition: polyset.c:89
R_DrawTriangle
void R_DrawTriangle(void)
Definition: polyset.c:113
r_affinetridesc
affinetridesc_t r_affinetridesc
Definition: alias.c:27
spanpackage_t::zi
int zi
Definition: polyset.c:32
spanpackage_t::ptex
byte * ptex
Definition: polyset.c:31
edgetable_t::isflattop
int isflattop
Definition: polyset.c:36
adivtab.h
r_p0
static int r_p0[6]
Definition: polyset.c:49
int
CONST PIXELFORMATDESCRIPTOR int
Definition: wgl.c:26
adivtab_t::quotient
int quotient
Definition: polyset.c:90
r_sstepx
static int r_sstepx
Definition: polyset.c:71
d_tfracbasestep
static int d_tfracbasestep
Definition: polyset.c:85
r_tstepx
static int r_tstepx
Definition: polyset.c:71
aliastriangleparms
aliastriangleparms_t aliastriangleparms
Definition: polyset.c:47
r_tstepy
static int r_tstepy
Definition: polyset.c:71
a_tstepxfrac
static int a_tstepxfrac
Definition: polyset.c:70
FloorDivMod
static void FloorDivMod(float numer, float denom, int *quotient, int *rem)
Definition: polyset.c:232
spanpackage_t::light
int light
Definition: polyset.c:32
d_pdest
static byte * d_pdest
Definition: polyset.c:79
finalvert_s::l
int l
Definition: sw.h:164
R_PolysetSetEdgeTable
static void R_PolysetSetEdgeTable(void)
Definition: polyset.c:683
d_pz
static short * d_pz
Definition: polyset.c:80
d_tfrac
static int d_tfrac
Definition: polyset.c:81
affinetridesc_t::pskin
void * pskin
Definition: sw.h:171
a_sstepxfrac
static int a_sstepxfrac
Definition: polyset.c:70