vkQuake2 doxygen  1.0 dev
r_polyse.c File Reference
#include "r_local.h"
#include "rand1k.h"
#include "adivtab.h"

Go to the source code of this file.

Classes

struct  spanpackage_t
 
struct  edgetable
 
struct  adivtab_t
 

Macros

#define MASK_1K   0x3FF
 
#define DPS_MAXSPANS   MAXHEIGHT+1
 

Functions

void R_PolysetDrawSpans8_33 (spanpackage_t *pspanpackage)
 
void R_PolysetDrawSpans8_66 (spanpackage_t *pspanpackage)
 
void R_PolysetDrawSpans8_Opaque_Coloured (spanpackage_t *pspanpackage)
 
void R_PolysetDrawThreshSpans8 (spanpackage_t *pspanpackage)
 
void R_PolysetCalcGradients (int skinwidth)
 
void R_DrawNonSubdiv (void)
 
void R_PolysetSetEdgeTable (void)
 
void R_RasterizeAliasPolySmooth (void)
 
void R_PolysetScanLeftEdge (int height)
 
void R_PolysetScanLeftEdge_C (int height)
 
void R_PolysetUpdateTables (void)
 
void R_DrawTriangle (void)
 
void FloorDivMod (float numer, float denom, int *quotient, int *rem)
 
void R_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv)
 
void R_PolysetDrawSpansConstant8_33 (spanpackage_t *pspanpackage)
 
void R_PolysetDrawSpansConstant8_66 (spanpackage_t *pspanpackage)
 
void R_PolysetFillSpans8 (spanpackage_t *pspanpackage)
 

Variables

int rand1k []
 
int rand1k_index = 0
 
aliastriangleparms_t aliastriangleparms
 
int r_p0 [9]
 
int r_p1 [9]
 
int r_p2 [9]
 
byted_pcolormap
 
int d_aflatcolor
 
int d_xdenom
 
edgetablepedgetable
 
edgetable edgetables [12]
 
int a_sstepxfrac
 
int a_tstepxfrac
 
int r_lstepx
 
int a_ststepxwhole
 
int r_sstepx
 
int r_tstepx
 
int r_lstepy
 
int r_sstepy
 
int r_tstepy
 
int r_zistepx
 
int r_zistepy
 
int r_lrstepx
 
int r_lrstepy
 
int r_lgstepx
 
int r_lgstepy
 
int r_lbstepx
 
int r_lbstepy
 
int d_aspancount
 
int d_countextrastep
 
spanpackage_ta_spans
 
spanpackage_td_pedgespanpackage
 
static int ystart
 
byted_pdest
 
byted_ptex
 
short * d_pz
 
int d_sfrac
 
int d_tfrac
 
int d_light
 
int d_zi
 
int d_ptexextrastep
 
int d_sfracextrastep
 
int d_tfracextrastep
 
int d_lightextrastep
 
int d_pdestextrastep
 
int d_lightbasestep
 
int d_pdestbasestep
 
int d_ptexbasestep
 
int d_sfracbasestep
 
int d_tfracbasestep
 
int d_ziextrastep
 
int d_zibasestep
 
int d_pzextrastep
 
int d_pzbasestep
 
int d_lightbasestepr
 
int d_lightbasestepg
 
int d_lightbasestepb
 
int d_lightextrastepr
 
int d_lightextrastepg
 
int d_lightextrastepb
 
int d_lightr
 
int d_lightg
 
int d_lightb
 
static adivtab_t adivtab [32 *32]
 
byteskintable [MAX_LBM_HEIGHT]
 
int skinwidth
 
byteskinstart
 
void(* d_pdrawspans )(spanpackage_t *pspanpackage)
 
byte iractive = 0
 
byte irtable [256]
 
static int lcount
 
static int lsfrac
 
static int ltfrac
 
static bytelpdest
 
static bytelptex
 
static int llight
 
static int lzi
 
static short * lpz
 
static unsigned char * pix24
 
static int trans [3]
 

Macro Definition Documentation

◆ DPS_MAXSPANS

#define DPS_MAXSPANS   MAXHEIGHT+1

Definition at line 35 of file r_polyse.c.

◆ MASK_1K

#define MASK_1K   0x3FF

Definition at line 29 of file r_polyse.c.

Function Documentation

◆ FloorDivMod()

void FloorDivMod ( float  numer,
float  denom,
int quotient,
int rem 
)

Definition at line 376 of file r_polyse.c.

377 {
378  int q, r;
379  float x;
380 
381  if (numer >= 0.0)
382  {
383 
384  x = floor(numer / denom);
385  q = (int)x;
386  r = (int)floor(numer - (x * denom));
387  }
388  else
389  {
390  //
391  // perform operations with positive values, and fix mod to make floor-based
392  //
393  x = floor(-numer / denom);
394  q = -(int)x;
395  r = (int)floor(-numer - (x * denom));
396  if (r != 0)
397  {
398  q--;
399  r = (int)denom - r;
400  }
401  }
402 
403  *quotient = q;
404  *rem = r;
405 }

Referenced by R_PolysetSetUpForLineScan().

◆ R_DrawNonSubdiv()

void R_DrawNonSubdiv ( void  )

◆ R_DrawTriangle()

void R_DrawTriangle ( void  )

Definition at line 218 of file r_polyse.c.

219 {
221 
222  int dv1_ab, dv0_ac;
223  int dv0_ab, dv1_ac;
224 
225  /*
226  d_xdenom = ( aliastriangleparms.a->v[1] - aliastriangleparms.b->v[1] ) * ( aliastriangleparms.a->v[0] - aliastriangleparms.c->v[0] ) -
227  ( aliastriangleparms.a->v[0] - aliastriangleparms.b->v[0] ) * ( aliastriangleparms.a->v[1] - aliastriangleparms.c->v[1] );
228  */
229 
232 
233  if (!(dv0_ab | dv1_ab))
234  return;
235 
238 
239  if (!(dv0_ac | dv1_ac))
240  return;
241 
242  d_xdenom = (dv0_ac * dv1_ab) - (dv0_ab * dv1_ac);
243 
244  if (d_xdenom < 0)
245  {
246  a_spans = spans;
247 
248  r_p0[0] = aliastriangleparms.a->u; // u
249  r_p0[1] = aliastriangleparms.a->v; // v
250  r_p0[2] = aliastriangleparms.a->s; // s
251  r_p0[3] = aliastriangleparms.a->t; // t
252  r_p0[4] = aliastriangleparms.a->l; // light
253  r_p0[5] = aliastriangleparms.a->zi; // iz
254 
255  r_p1[0] = aliastriangleparms.b->u;
256  r_p1[1] = aliastriangleparms.b->v;
257  r_p1[2] = aliastriangleparms.b->s;
258  r_p1[3] = aliastriangleparms.b->t;
259  r_p1[4] = aliastriangleparms.b->l;
260  r_p1[5] = aliastriangleparms.b->zi;
261 
262  r_p2[0] = aliastriangleparms.c->u;
263  r_p2[1] = aliastriangleparms.c->v;
264  r_p2[2] = aliastriangleparms.c->s;
265  r_p2[3] = aliastriangleparms.c->t;
266  r_p2[4] = aliastriangleparms.c->l;
267  r_p2[5] = aliastriangleparms.c->zi;
268 
269  // i crash fixme //...qb: increased array sizes
270  r_p0[6] = aliastriangleparms.a->l; // lightr
271  r_p0[7] = aliastriangleparms.a->l; // lightg
272  r_p0[8] = aliastriangleparms.a->l; // lightb
273  r_p1[6] = aliastriangleparms.b->l; // lightr
274  r_p1[7] = aliastriangleparms.b->l; // lightg
275  r_p1[8] = aliastriangleparms.b->l; // lightb
276  r_p2[6] = aliastriangleparms.c->l; // lightr
277  r_p2[7] = aliastriangleparms.c->l; // lightg
278  r_p2[8] = aliastriangleparms.c->l; // lightb
279 
282  }
283 }

Referenced by R_AliasClipTriangle(), R_AliasClipTriangleRGB(), and R_AliasPreparePoints().

◆ R_PolysetCalcGradients()

void R_PolysetCalcGradients ( int  skinwidth)

Definition at line 844 of file r_polyse.c.

845 {
846  float xstepdenominv, ystepdenominv, t0, t1;
847  float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
848 
849  p00_minus_p20 = r_p0[0] - r_p2[0];
850  p01_minus_p21 = r_p0[1] - r_p2[1];
851  p10_minus_p20 = r_p1[0] - r_p2[0];
852  p11_minus_p21 = r_p1[1] - r_p2[1];
853 
854  xstepdenominv = 1.0 / (float)d_xdenom;
855 
856  ystepdenominv = -xstepdenominv;
857 
858  // ceil () for light so positive steps are exaggerated, negative steps
859  // diminished, pushing us away from underflow toward overflow. Underflow is
860  // very visible, overflow is very unlikely, because of ambient lighting
861  t0 = r_p0[4] - r_p2[4];
862  t1 = r_p1[4] - r_p2[4];
863  r_lstepx = (int)ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
864  r_lstepy = (int)ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
865 
866  //qb: use ceil
867  t0 = r_p0[6] - r_p2[6];
868  t1 = r_p1[6] - r_p2[6];
869  r_lrstepx = (int)ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
870  r_lrstepy = (int)ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
871 
872  t0 = r_p0[7] - r_p2[7];
873  t1 = r_p1[7] - r_p2[7];
874  r_lgstepx = (int)ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
875  r_lgstepy = (int)ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
876 
877  t0 = r_p0[8] - r_p2[8];
878  t1 = r_p1[8] - r_p2[8];
879  r_lbstepx = (int)ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
880  r_lbstepy = (int)ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
881 
882 
883  t0 = r_p0[2] - r_p2[2];
884  t1 = r_p1[2] - r_p2[2];
885  r_sstepx = (int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
886  r_sstepy = (int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
887 
888  t0 = r_p0[3] - r_p2[3];
889  t1 = r_p1[3] - r_p2[3];
890  r_tstepx = (int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
891  r_tstepy = (int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
892 
893  t0 = r_p0[5] - r_p2[5];
894  t1 = r_p1[5] - r_p2[5];
895  r_zistepx = (int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
896  r_zistepy = (int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
897 
898  //#if id386ALIAS
899 #if id386
901  {
902  a_sstepxfrac = r_sstepx << 16;
903  a_tstepxfrac = r_tstepx << 16;
904  }
905  else
906 #endif
907  {
908  //#else
909  a_sstepxfrac = r_sstepx & 0xFFFF;
910  a_tstepxfrac = r_tstepx & 0xFFFF;
911  }
912  //#endif
913 
914  a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16);
915 }

Referenced by R_RasterizeAliasPolySmooth().

◆ R_PolysetDrawSpans8_33()

void R_PolysetDrawSpans8_33 ( spanpackage_t pspanpackage)

Definition at line 1005 of file r_polyse.c.

1006 {
1007  do
1008  {
1009  lcount = d_aspancount - pspanpackage->count;
1010 
1012  if (errorterm >= 0)
1013  {
1016  }
1017  else
1018  {
1020  }
1021 
1022  if (lcount)
1023  {
1024  lpdest = pspanpackage->pdest;
1025  lptex = pspanpackage->ptex;
1026  lpz = pspanpackage->pz;
1027  lsfrac = pspanpackage->sfrac;
1028  ltfrac = pspanpackage->tfrac;
1029  llight = pspanpackage->light;
1030  lzi = pspanpackage->zi;
1031 
1032  do
1033  {
1034  if ((lzi >> 16) >= *lpz)
1035  {
1036  int temp = vid.colormap[*lptex + ( llight & 0xFF00 )];
1037 
1038  *lpdest = vid.alphamap[temp + *lpdest * 256];
1039  }
1040  lpdest++;
1041  lzi += r_zistepx;
1042  lpz++;
1043  llight += r_lstepx;
1044  lptex += a_ststepxwhole;
1045  lsfrac += a_sstepxfrac;
1046  lptex += lsfrac >> 16;
1047  lsfrac &= 0xFFFF;
1048  ltfrac += a_tstepxfrac;
1049  if (ltfrac & 0x10000)
1050  {
1052  ltfrac &= 0xFFFF;
1053  }
1054  } while (--lcount);
1055  }
1056 
1057  pspanpackage++;
1058  } while (pspanpackage->count != -999999);
1059 }

Referenced by R_AliasDrawModel().

◆ R_PolysetDrawSpans8_66()

void R_PolysetDrawSpans8_66 ( spanpackage_t pspanpackage)

Definition at line 1100 of file r_polyse.c.

1101 {
1102  do
1103  {
1104  lcount = d_aspancount - pspanpackage->count;
1105 
1107  if (errorterm >= 0)
1108  {
1111  }
1112  else
1113  {
1115  }
1116 
1117  if (lcount)
1118  {
1119  lpdest = pspanpackage->pdest;
1120  lptex = pspanpackage->ptex;
1121  lpz = pspanpackage->pz;
1122  lsfrac = pspanpackage->sfrac;
1123  ltfrac = pspanpackage->tfrac;
1124  llight = pspanpackage->light;
1125  lzi = pspanpackage->zi;
1126  do
1127  {
1128  if ((lzi >> 16) >= *lpz)
1129  {
1130  int temp = vid.colormap[*lptex + (llight & 0xFF00)];
1131  *lpdest = vid.alphamap[temp * 256 + *lpdest];
1132  *lpz = lzi >> 16;
1133  }
1134  lpdest++;
1135  lzi += r_zistepx;
1136  lpz++;
1137  llight += r_lstepx;
1138  lptex += a_ststepxwhole;
1139  lsfrac += a_sstepxfrac;
1140  lptex += lsfrac >> 16;
1141  lsfrac &= 0xFFFF;
1142  ltfrac += a_tstepxfrac;
1143  if (ltfrac & 0x10000)
1144  {
1146  ltfrac &= 0xFFFF;
1147  }
1148  } while (--lcount);
1149  }
1150 
1151  pspanpackage++;
1152  } while (pspanpackage->count != -999999);
1153 }

Referenced by R_AliasDrawModel().

◆ R_PolysetDrawSpans8_Opaque_Coloured()

void R_PolysetDrawSpans8_Opaque_Coloured ( spanpackage_t pspanpackage)

Definition at line 1198 of file r_polyse.c.

1199 {
1200 
1201  do
1202  {
1203  lcount = d_aspancount - pspanpackage->count;
1204 
1206  if (errorterm >= 0)
1207  {
1210  }
1211  else
1212  {
1214  }
1215 
1216  if (lcount)
1217  {
1218  lpdest = pspanpackage->pdest;
1219  lptex = pspanpackage->ptex;
1220  lpz = pspanpackage->pz;
1221  lsfrac = pspanpackage->sfrac;
1222  ltfrac = pspanpackage->tfrac;
1223  llight = pspanpackage->light;
1224  lzi = pspanpackage->zi;
1225  do
1226  {
1227  if ((lzi >> 16) >= *lpz)
1228  {
1229  //PGM
1231  *lpdest = ((byte *)vid.colormap)[irtable[*lptex]];
1232  // leilei - colored lights begin
1233  else if (coloredlights)
1234  {
1235  int lptemp = *lptex;
1236  pix24 = (unsigned char *)&d_8to24table[lptemp];
1237  //qb: works now...
1238  trans[0] = CLAMP((int)(pix24[0] * (pspanpackage->lightr * shadelight[0])) >> 15, 0, 63);
1239  trans[1] = CLAMP((int)(pix24[1] * (pspanpackage->lightg * shadelight[1])) >> 15, 0, 63);
1240  trans[2] = CLAMP((int)(pix24[2] * (pspanpackage->lightb * shadelight[2])) >> 15, 0, 63);
1241 
1242  *lpdest = palmap2[trans[0]][trans[1]][trans[2]];
1243  } // leilei - colored lights end
1244  else *lpdest = ((byte *)vid.colormap)[*lptex + (llight & 0xFF00)];
1245 
1246  //PGM
1247  *lpz = lzi >> 16;
1248  }
1249  lpdest++;
1250  lzi += r_zistepx;
1251  lpz++;
1252  llight += r_lstepx;
1253  lptex += a_ststepxwhole;
1254  lsfrac += a_sstepxfrac;
1255  lptex += lsfrac >> 16;
1256  lsfrac &= 0xFFFF;
1257  ltfrac += a_tstepxfrac;
1258  if (ltfrac & 0x10000)
1259  {
1261  ltfrac &= 0xFFFF;
1262  }
1263  } while (--lcount);
1264  }
1265 
1266  pspanpackage++;
1267  } while (pspanpackage->count != -999999);
1268 }

Referenced by R_AliasDrawModel(), R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ R_PolysetDrawSpansConstant8_33()

void R_PolysetDrawSpansConstant8_33 ( spanpackage_t pspanpackage)

Definition at line 1061 of file r_polyse.c.

1062 {
1063  do
1064  {
1065  lcount = d_aspancount - pspanpackage->count;
1066 
1068  if (errorterm >= 0)
1069  {
1072  }
1073  else
1074  {
1076  }
1077 
1078  if (lcount)
1079  {
1080  lpdest = pspanpackage->pdest;
1081  lpz = pspanpackage->pz;
1082  lzi = pspanpackage->zi;
1083 
1084  do
1085  {
1086  if ((lzi >> 16) >= *lpz)
1087  {
1089  }
1090  lpdest++;
1091  lzi += r_zistepx;
1092  lpz++;
1093  } while (--lcount);
1094  }
1095 
1096  pspanpackage++;
1097  } while (pspanpackage->count != -999999);
1098 }

Referenced by R_AliasDrawModel().

◆ R_PolysetDrawSpansConstant8_66()

void R_PolysetDrawSpansConstant8_66 ( spanpackage_t pspanpackage)

Definition at line 1156 of file r_polyse.c.

1157 {
1158  do
1159  {
1160  lcount = d_aspancount - pspanpackage->count;
1161 
1163  if (errorterm >= 0)
1164  {
1167  }
1168  else
1169  {
1171  }
1172 
1173  if (lcount)
1174  {
1175  lpdest = pspanpackage->pdest;
1176  lpz = pspanpackage->pz;
1177  lzi = pspanpackage->zi;
1178 
1179  do
1180  {
1181  if ((lzi >> 16) >= *lpz)
1182  {
1184  }
1185  lpdest++;
1186  lzi += r_zistepx;
1187  lpz++;
1188  } while (--lcount);
1189  }
1190 
1191  pspanpackage++;
1192  } while (pspanpackage->count != -999999);
1193 }

Referenced by R_AliasDrawModel().

◆ R_PolysetDrawThreshSpans8()

void R_PolysetDrawThreshSpans8 ( spanpackage_t pspanpackage)

Definition at line 937 of file r_polyse.c.

938 {
939 
940  do
941  {
942  lcount = d_aspancount - pspanpackage->count;
943 
945  if (errorterm >= 0)
946  {
949  }
950  else
951  {
953  }
954 
955  if (lcount)
956  {
957  lpdest = pspanpackage->pdest;
958  lptex = pspanpackage->ptex;
959  lpz = pspanpackage->pz;
960  lsfrac = pspanpackage->sfrac;
961  ltfrac = pspanpackage->tfrac;
962  llight = pspanpackage->light;
963  lzi = pspanpackage->zi;
964 
965  do
966  {
967  if ((lzi >> 16) >= *lpz)
968  {
970 
972  {
973  *lpdest = ((byte *)vid.colormap)[*lptex + (llight & 0xFF00)];
974  *lpz = lzi >> 16;
975  }
976  }
977 
978  lpdest++;
979  lzi += r_zistepx;
980  lpz++;
981  llight += r_lstepx;
983  lsfrac += a_sstepxfrac;
984  lptex += lsfrac >> 16;
985  lsfrac &= 0xFFFF;
986  ltfrac += a_tstepxfrac;
987  if (ltfrac & 0x10000)
988  {
990  ltfrac &= 0xFFFF;
991  }
992  } while (--lcount);
993  }
994 
995  pspanpackage++;
996  } while (pspanpackage->count != -999999);
997 }

◆ R_PolysetFillSpans8()

void R_PolysetFillSpans8 ( spanpackage_t pspanpackage)

Definition at line 1277 of file r_polyse.c.

1278 {
1279  int color;
1280 
1281  // FIXME: do z buffering
1282 
1283  color = d_aflatcolor++;
1284 
1285  while (1)
1286  {
1287  int lcount;
1288  byte *lpdest;
1289 
1290  lcount = pspanpackage->count;
1291 
1292  if (lcount == -1)
1293  return;
1294 
1295  if (lcount)
1296  {
1297  lpdest = pspanpackage->pdest;
1298 
1299  do
1300  {
1301  *lpdest++ = color;
1302  } while (--lcount);
1303  }
1304 
1305  pspanpackage++;
1306  }
1307 }

◆ R_PolysetScanLeftEdge()

void R_PolysetScanLeftEdge ( int  height)

◆ R_PolysetScanLeftEdge_C()

void R_PolysetScanLeftEdge_C ( int  height)

Definition at line 291 of file r_polyse.c.

292 {
293  do
294  {
299 
302 
303  // FIXME: need to clamp l, s, t, at both ends?
305 #ifdef COLMODEL
309 #endif
311 
313 
315  if (errorterm >= 0)
316  {
318  d_pz += d_pzextrastep;
322  d_ptex += d_sfrac >> 16;
323 
324  d_sfrac &= 0xFFFF;
326  if (d_tfrac & 0x10000)
327  {
329  d_tfrac &= 0xFFFF;
330  }
332  d_zi += d_ziextrastep;
334 #ifdef COLMODEL
338 #endif
339  }
340  else
341  {
343  d_pz += d_pzbasestep;
347  d_ptex += d_sfrac >> 16;
348  d_sfrac &= 0xFFFF;
350  if (d_tfrac & 0x10000)
351  {
353  d_tfrac &= 0xFFFF;
354  }
356 #ifdef COLMODEL
360 #endif
361  d_zi += d_zibasestep;
362  }
363  } while (--height);
364 }

Referenced by R_RasterizeAliasPolySmooth().

◆ R_PolysetSetEdgeTable()

void R_PolysetSetEdgeTable ( void  )

Definition at line 1711 of file r_polyse.c.

1712 {
1713  int edgetableindex;
1714 
1715  edgetableindex = 0; // assume the vertices are already in
1716  // top to bottom order
1717 
1718  //
1719  // determine which edges are right & left, and the order in which
1720  // to rasterize them
1721  //
1722  if (r_p0[1] >= r_p1[1])
1723  {
1724  if (r_p0[1] == r_p1[1])
1725  {
1726  if (r_p0[1] < r_p2[1])
1727  pedgetable = &edgetables[2];
1728  else
1729  pedgetable = &edgetables[5];
1730 
1731  return;
1732  }
1733  else
1734  {
1735  edgetableindex = 1;
1736  }
1737  }
1738 
1739  if (r_p0[1] == r_p2[1])
1740  {
1741  if (edgetableindex)
1742  pedgetable = &edgetables[8];
1743  else
1744  pedgetable = &edgetables[9];
1745 
1746  return;
1747  }
1748  else if (r_p1[1] == r_p2[1])
1749  {
1750  if (edgetableindex)
1751  pedgetable = &edgetables[10];
1752  else
1753  pedgetable = &edgetables[11];
1754 
1755  return;
1756  }
1757 
1758  if (r_p0[1] > r_p2[1])
1759  edgetableindex += 2;
1760 
1761  if (r_p1[1] > r_p2[1])
1762  edgetableindex += 4;
1763 
1764  pedgetable = &edgetables[edgetableindex];
1765 }

Referenced by R_DrawTriangle().

◆ R_PolysetSetUpForLineScan()

void R_PolysetSetUpForLineScan ( fixed8_t  startvertu,
fixed8_t  startvertv,
fixed8_t  endvertu,
fixed8_t  endvertv 
)

Definition at line 413 of file r_polyse.c.

415 {
416  float dm, dn;
417  int tm, tn;
418  adivtab_t *ptemp;
419 
420  // TODO: implement x86 version
421 
422  errorterm = -1;
423 
424  tm = endvertu - startvertu;
425  tn = endvertv - startvertv;
426 
427  if (((tm <= 16) && (tm >= -15)) &&
428  ((tn <= 16) && (tn >= -15)))
429  {
430  ptemp = &adivtab[((tm + 15) << 5) + (tn + 15)];
431  ubasestep = ptemp->quotient;
432  erroradjustup = ptemp->remainder;
433  erroradjustdown = tn;
434  }
435  else
436  {
437  dm = tm;
438  dn = tn;
439 
440  FloorDivMod(dm, dn, &ubasestep, &erroradjustup);
441 
442  erroradjustdown = dn;
443  }
444 }

Referenced by R_RasterizeAliasPolySmooth().

◆ R_PolysetUpdateTables()

void R_PolysetUpdateTables ( void  )

Definition at line 196 of file r_polyse.c.

197 {
198  int i;
199  byte *s;
200 
203  {
206  s = skinstart;
207  for (i = 0; i < MAX_LBM_HEIGHT; i++, s += skinwidth)
208  skintable[i] = s;
209  }
210 }

Referenced by R_AliasSetupSkin().

◆ R_RasterizeAliasPolySmooth()

void R_RasterizeAliasPolySmooth ( void  )

Definition at line 1314 of file r_polyse.c.

1315 {
1316  int initialleftheight, initialrightheight;
1317  int *plefttop, *prighttop, *pleftbottom, *prightbottom;
1318  int working_lstepx, originalcount;
1319  int working_lrstepx;
1320  int working_lgstepx;
1321  int working_lbstepx;
1322 
1323  plefttop = pedgetable->pleftedgevert0;
1324  prighttop = pedgetable->prightedgevert0;
1325 
1326  pleftbottom = pedgetable->pleftedgevert1;
1327  prightbottom = pedgetable->prightedgevert1;
1328 
1329  initialleftheight = pleftbottom[1] - plefttop[1];
1330  initialrightheight = prightbottom[1] - prighttop[1];
1331 
1332 
1333 
1334  //
1335  // set the s, t, and light gradients, which are consistent across the triangle
1336  // because being a triangle, things are affine
1337  //
1339  //
1340  // rasterize the polygon
1341  //
1342 
1343  //
1344  // scan out the top (and possibly only) part of the left edge
1345  //
1347 
1348  ystart = plefttop[1];
1349  d_aspancount = plefttop[0] - prighttop[0];
1350 
1351  d_ptex = (byte *)r_affinetridesc.pskin + (plefttop[2] >> 16) +
1352  (plefttop[3] >> 16) * r_affinetridesc.skinwidth;
1353  //#if id386ALIAS
1354 #if id386
1356  {
1357  d_sfrac = (plefttop[2] & 0xFFFF) << 16;
1358  d_tfrac = (plefttop[3] & 0xFFFF) << 16;
1359  }
1360  //#else
1361  else
1362 #endif
1363  {
1364  d_sfrac = plefttop[2] & 0xFFFF;
1365  d_tfrac = plefttop[3] & 0xFFFF;
1366  }
1367  //#endif
1368  d_light = plefttop[4];
1369  d_zi = plefttop[5];
1370 #ifdef COLMODEL
1371  d_lightr = plefttop[6];
1372  d_lightg = plefttop[7];
1373  d_lightb = plefttop[8];
1374 #endif
1375  d_pdest = (byte *)d_viewbuffer +
1376  ystart * r_screenwidth + plefttop[0];
1377  d_pz = d_pzbuffer + ystart * d_zwidth + plefttop[0];
1378 
1379  if (initialleftheight == 1)
1380  {
1385 
1388 
1389  // FIXME: need to clamp l, s, t, at both ends?
1391 #ifdef COLMODEL
1395 #endif
1397 
1399  }
1400  else
1401  {
1402  R_PolysetSetUpForLineScan(plefttop[0], plefttop[1],
1403  pleftbottom[0], pleftbottom[1]);
1404 
1405  //#if id386ALIAS
1406 #if id386
1408  {
1409  d_pzbasestep = (d_zwidth + ubasestep) << 1;
1411  }
1412  //#else
1413  else
1414 #endif
1415  {
1418  }
1419  //#endif
1420 
1423 
1424  // TODO: can reuse partial expressions here
1425 
1426  // for negative steps in x along left edge, bias toward overflow rather than
1427  // underflow (sort of turning the floor () we did in the gradient calcs into
1428  // ceil (), but plus a little bit)
1429  if (ubasestep < 0){
1430  working_lstepx = r_lstepx - 1;
1431  working_lrstepx = r_lrstepx - 1;
1432  working_lgstepx = r_lgstepx - 1;
1433  working_lbstepx = r_lbstepx - 1;
1434  }
1435  else
1436  {
1437  working_lstepx = r_lstepx;
1438  working_lrstepx = r_lrstepx;
1439  working_lgstepx = r_lgstepx;
1440  working_lbstepx = r_lbstepx;
1441 
1442 
1443  }
1444 
1446  d_ptexbasestep = ((r_sstepy + r_sstepx * ubasestep) >> 16) +
1447  ((r_tstepy + r_tstepx * ubasestep) >> 16) *
1449  //#if id386ALIAS
1450 #if id386
1452  {
1455  }
1456  else
1457 #endif
1458  {
1459  //#else
1460  d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
1461  d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
1462  }
1463  //#endif
1464  d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
1466 
1467  d_lightbasestepr = r_lrstepy + working_lrstepx * ubasestep;
1468  d_lightbasestepg = r_lgstepy + working_lgstepx * ubasestep;
1469  d_lightbasestepb = r_lbstepy + working_lbstepx * ubasestep;
1470 
1471 
1472 
1474  ((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
1476  //#if id386ALIAS
1477 #if id386
1479  {
1482  }
1483  else
1484 #endif
1485  {
1486  //#else
1489  }
1490  //#endif
1491  d_lightextrastep = d_lightbasestep + working_lstepx;
1493 
1494  d_lightextrastepr = d_lightbasestepr + working_lrstepx;
1495  d_lightextrastepg = d_lightbasestepg + working_lgstepx;
1496  d_lightextrastepb = d_lightbasestepb + working_lbstepx;
1497 
1498 #if id386
1500  {
1501  R_PolysetScanLeftEdge(initialleftheight);
1502  }
1503  else
1504 #endif
1505  {
1506  R_PolysetScanLeftEdge_C(initialleftheight);
1507  }
1508  }
1509 
1510  //
1511  // scan out the bottom part of the left edge, if it exists
1512  //
1513  if (pedgetable->numleftedges == 2)
1514  {
1515  int height;
1516 
1517  plefttop = pleftbottom;
1518  pleftbottom = pedgetable->pleftedgevert2;
1519 
1520  height = pleftbottom[1] - plefttop[1];
1521 
1522  // TODO: make this a function; modularize this function in general
1523 
1524  ystart = plefttop[1];
1525  d_aspancount = plefttop[0] - prighttop[0];
1526  d_ptex = (byte *)r_affinetridesc.pskin + (plefttop[2] >> 16) +
1527  (plefttop[3] >> 16) * r_affinetridesc.skinwidth;
1528  d_sfrac = 0;
1529  d_tfrac = 0;
1530  d_light = plefttop[4];
1531  d_zi = plefttop[5];
1532 #ifdef COLMODEL
1533  d_lightr = plefttop[6];
1534  d_lightg = plefttop[7];
1535  d_lightb = plefttop[8];
1536 #endif
1537  d_pdest = (byte *)d_viewbuffer + ystart * r_screenwidth + plefttop[0];
1538  d_pz = d_pzbuffer + ystart * d_zwidth + plefttop[0];
1539 
1540  if (height == 1)
1541  {
1546 
1549 
1550  // FIXME: need to clamp l, s, t, at both ends?
1552 #ifdef COLMODEL
1556 #endif
1558 
1560  }
1561  else
1562  {
1563  R_PolysetSetUpForLineScan(plefttop[0], plefttop[1],
1564  pleftbottom[0], pleftbottom[1]);
1565 
1568 
1569  //#if id386ALIAS
1570 #if id386
1572  {
1573  d_pzbasestep = (d_zwidth + ubasestep) << 1;
1575  }
1576  //#else
1577  else
1578 #endif
1579  {
1582  }
1583  //#endif
1584 
1585  if (ubasestep < 0){
1586  working_lstepx = r_lstepx - 1;
1587  working_lrstepx = r_lrstepx - 1;
1588  working_lgstepx = r_lgstepx - 1;
1589  working_lbstepx = r_lbstepx - 1;
1590  }
1591  else{
1592 
1593  working_lstepx = r_lstepx;
1594  working_lrstepx = r_lrstepx;
1595  working_lgstepx = r_lgstepx;
1596  working_lbstepx = r_lbstepx;
1597  }
1598 
1600  d_ptexbasestep = ((r_sstepy + r_sstepx * ubasestep) >> 16) +
1601  ((r_tstepy + r_tstepx * ubasestep) >> 16) *
1603  //#if id386ALIAS
1604 #if id386
1606  {
1609  }
1610  //#else
1611  else
1612 #endif
1613  {
1614  d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
1615  d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
1616  }
1617  //#endif
1618  d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
1620 
1621  d_lightbasestepr = r_lrstepy + working_lrstepx * ubasestep;
1622  d_lightbasestepg = r_lgstepy + working_lgstepx * ubasestep;
1623  d_lightbasestepb = r_lbstepy + working_lbstepx * ubasestep;
1624 
1626 
1628  ((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
1630  //#if id386ALIAS
1631 #if id386
1633  {
1634  d_sfracextrastep = ((r_sstepy + r_sstepx*d_countextrastep) & 0xFFFF) << 16;
1635  d_tfracextrastep = ((r_tstepy + r_tstepx*d_countextrastep) & 0xFFFF) << 16;
1636  }
1637  else
1638 #endif
1639  //#endif
1640  {
1643  }
1644  //#endif
1645  d_lightextrastep = d_lightbasestep + working_lstepx;
1647 
1648  d_lightextrastepr = d_lightbasestepr + working_lrstepx;
1649  d_lightextrastepg = d_lightbasestepg + working_lgstepx;
1650  d_lightextrastepb = d_lightbasestepb + working_lbstepx;
1651 
1652 #if id386
1654  {
1656  }
1657  else
1658 #endif
1659  {
1661  }
1662  }
1663  }
1664 
1665  // scan out the top (and possibly only) part of the right edge, updating the
1666  // count field
1668 
1669  R_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
1670  prightbottom[0], prightbottom[1]);
1671  d_aspancount = 0;
1673  originalcount = a_spans[initialrightheight].count;
1674  a_spans[initialrightheight].count = -999999; // mark end of the spanpackages
1675  (*d_pdrawspans) (a_spans);
1676 
1677  // scan out the bottom part of the right edge, if it exists
1678  if (pedgetable->numrightedges == 2)
1679  {
1680  int height;
1681  spanpackage_t *pstart;
1682 
1683  pstart = a_spans + initialrightheight;
1684  pstart->count = originalcount;
1685 
1686  d_aspancount = prightbottom[0] - prighttop[0];
1687 
1688  prighttop = prightbottom;
1689  prightbottom = pedgetable->prightedgevert2;
1690 
1691  height = prightbottom[1] - prighttop[1];
1692 
1693  R_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
1694  prightbottom[0], prightbottom[1]);
1695 
1697  a_spans[initialrightheight + height].count = -999999;
1698  // mark end of the spanpackages
1699  (*d_pdrawspans) (pstart);
1700  }
1701 }

Referenced by R_DrawTriangle().

Variable Documentation

◆ a_spans

spanpackage_t* a_spans

Definition at line 97 of file r_polyse.c.

Referenced by R_DrawTriangle(), and R_RasterizeAliasPolySmooth().

◆ a_sstepxfrac

◆ a_ststepxwhole

◆ a_tstepxfrac

◆ adivtab

adivtab_t adivtab[32 *32]
static
Initial value:
= {
}

Definition at line 122 of file r_polyse.c.

Referenced by R_PolysetSetUpForLineScan().

◆ aliastriangleparms

aliastriangleparms_t aliastriangleparms

◆ d_aflatcolor

int d_aflatcolor

Definition at line 68 of file r_polyse.c.

Referenced by R_PolysetFillSpans8(), and R_SetupFrame().

◆ d_aspancount

◆ d_countextrastep

◆ d_light

int d_light

◆ d_lightb

int d_lightb

Definition at line 114 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightbasestep

int d_lightbasestep

Definition at line 105 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightbasestepb

int d_lightbasestepb

Definition at line 112 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightbasestepg

int d_lightbasestepg

Definition at line 112 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightbasestepr

int d_lightbasestepr

Definition at line 112 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightextrastep

int d_lightextrastep

Definition at line 104 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightextrastepb

int d_lightextrastepb

Definition at line 113 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightextrastepg

int d_lightextrastepg

Definition at line 113 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightextrastepr

int d_lightextrastepr

Definition at line 113 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightg

int d_lightg

Definition at line 114 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_lightr

int d_lightr

Definition at line 114 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pcolormap

byte* d_pcolormap

Definition at line 66 of file r_polyse.c.

◆ d_pdest

byte* d_pdest

Definition at line 100 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pdestbasestep

int d_pdestbasestep

Definition at line 105 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pdestextrastep

int d_pdestextrastep

Definition at line 104 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pdrawspans

void(* d_pdrawspans) (spanpackage_t *pspanpackage)

◆ d_pedgespanpackage

spanpackage_t* d_pedgespanpackage

Definition at line 98 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_ptex

byte * d_ptex

Definition at line 100 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_ptexbasestep

int d_ptexbasestep

Definition at line 105 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_ptexextrastep

int d_ptexextrastep

Definition at line 103 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pz

short* d_pz

Definition at line 101 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pzbasestep

int d_pzbasestep

Definition at line 108 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_pzextrastep

int d_pzextrastep

Definition at line 108 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_sfrac

int d_sfrac

Definition at line 102 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_sfracbasestep

int d_sfracbasestep

Definition at line 106 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_sfracextrastep

int d_sfracextrastep

Definition at line 103 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_tfrac

int d_tfrac

Definition at line 102 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_tfracbasestep

int d_tfracbasestep

Definition at line 106 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_tfracextrastep

int d_tfracextrastep

Definition at line 104 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_xdenom

int d_xdenom

Definition at line 69 of file r_polyse.c.

Referenced by R_DrawTriangle(), and R_PolysetCalcGradients().

◆ d_zi

int d_zi

Definition at line 102 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_zibasestep

int d_zibasestep

Definition at line 107 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ d_ziextrastep

int d_ziextrastep

Definition at line 107 of file r_polyse.c.

Referenced by R_PolysetScanLeftEdge_C(), and R_RasterizeAliasPolySmooth().

◆ edgetables

edgetable edgetables[12]
Initial value:
= {
{ 0, 1, r_p0, r_p2, NULL, 2, r_p0, r_p1, r_p2 },
{ 0, 2, r_p1, r_p0, r_p2, 1, r_p1, r_p2, NULL },
{ 1, 1, r_p0, r_p2, NULL, 1, r_p1, r_p2, NULL },
{ 0, 1, r_p1, r_p0, NULL, 2, r_p1, r_p2, r_p0 },
{ 0, 2, r_p0, r_p2, r_p1, 1, r_p0, r_p1, NULL },
{ 0, 1, r_p2, r_p1, NULL, 1, r_p2, r_p0, NULL },
{ 0, 1, r_p2, r_p1, NULL, 2, r_p2, r_p0, r_p1 },
{ 0, 2, r_p2, r_p1, r_p0, 1, r_p2, r_p0, NULL },
{ 0, 1, r_p1, r_p0, NULL, 1, r_p1, r_p2, NULL },
{ 1, 1, r_p2, r_p1, NULL, 1, r_p0, r_p1, NULL },
{ 1, 1, r_p1, r_p0, NULL, 1, r_p2, r_p0, NULL },
{ 0, 1, r_p0, r_p2, NULL, 1, r_p0, r_p1, NULL },
}

Definition at line 73 of file r_polyse.c.

Referenced by R_PolysetSetEdgeTable().

◆ iractive

byte iractive = 0

Definition at line 148 of file r_polyse.c.

Referenced by R_AliasPreparePoints().

◆ irtable

byte irtable[256]

Definition at line 149 of file r_polyse.c.

Referenced by R_PolysetDrawSpans8_Opaque_Coloured().

◆ lcount

◆ llight

◆ lpdest

◆ lptex

◆ lpz

◆ lsfrac

◆ ltfrac

◆ lzi

◆ pedgetable

edgetable* pedgetable

Definition at line 71 of file r_polyse.c.

Referenced by R_PolysetSetEdgeTable(), and R_RasterizeAliasPolySmooth().

◆ pix24

◆ r_lbstepx

int r_lbstepx

Definition at line 94 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_lbstepy

int r_lbstepy

Definition at line 94 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_lgstepx

int r_lgstepx

Definition at line 93 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_lgstepy

int r_lgstepy

Definition at line 93 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_lrstepx

int r_lrstepx

Definition at line 92 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_lrstepy

int r_lrstepy

Definition at line 92 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_lstepx

◆ r_lstepy

int r_lstepy

Definition at line 90 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_p0

int r_p0[9]

Definition at line 64 of file r_polyse.c.

Referenced by R_DrawTriangle(), R_PolysetCalcGradients(), and R_PolysetSetEdgeTable().

◆ r_p1

int r_p1[9]

Definition at line 64 of file r_polyse.c.

Referenced by R_DrawTriangle(), R_PolysetCalcGradients(), and R_PolysetSetEdgeTable().

◆ r_p2

int r_p2[9]

Definition at line 64 of file r_polyse.c.

Referenced by R_DrawTriangle(), R_PolysetCalcGradients(), and R_PolysetSetEdgeTable().

◆ r_sstepx

int r_sstepx

Definition at line 90 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_sstepy

int r_sstepy

Definition at line 90 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_tstepx

int r_tstepx

Definition at line 90 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_tstepy

int r_tstepy

Definition at line 90 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ r_zistepx

◆ r_zistepy

int r_zistepy

Definition at line 91 of file r_polyse.c.

Referenced by R_PolysetCalcGradients(), and R_RasterizeAliasPolySmooth().

◆ rand1k

int rand1k[]
Initial value:
= {
}

Definition at line 25 of file r_polyse.c.

Referenced by R_PolysetDrawThreshSpans8().

◆ rand1k_index

int rand1k_index = 0

Definition at line 31 of file r_polyse.c.

Referenced by R_PolysetDrawThreshSpans8().

◆ skinstart

byte* skinstart

Definition at line 128 of file r_polyse.c.

Referenced by R_PolysetUpdateTables().

◆ skintable

byte* skintable[MAX_LBM_HEIGHT]

Definition at line 126 of file r_polyse.c.

Referenced by R_PolysetUpdateTables().

◆ skinwidth

int skinwidth

Definition at line 127 of file r_polyse.c.

Referenced by R_FloodFillSkin(), R_PolysetCalcGradients(), and R_PolysetUpdateTables().

◆ trans

◆ ystart

int ystart
static

Definition at line 99 of file r_polyse.c.

Referenced by M_Main_Draw(), and R_RasterizeAliasPolySmooth().

R_PolysetDrawSpans8_Opaque_Coloured
void R_PolysetDrawSpans8_Opaque_Coloured(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1198
d_xdenom
int d_xdenom
Definition: r_polyse.c:69
r_zistepx
int r_zistepx
Definition: r_polyse.c:91
spanpackage_t::count
int count
Definition: r_polyse.c:42
height
GLsizei height
Definition: qgl_win.c:69
errorterm
int errorterm
Definition: r_edge.c:80
d_lightb
int d_lightb
Definition: r_polyse.c:114
d_lightr
int d_lightr
Definition: r_polyse.c:114
RF_IR_VISIBLE
#define RF_IR_VISIBLE
Definition: q_shared.h:614
d_aflatcolor
int d_aflatcolor
Definition: r_polyse.c:68
d_pzbasestep
int d_pzbasestep
Definition: r_polyse.c:108
r_sstepx
int r_sstepx
Definition: r_polyse.c:90
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
finalvert_s::u
int u
Definition: r_local.h:293
edgetable::pleftedgevert2
int * pleftedgevert2
Definition: r_polyse.c:55
ltfrac
static int ltfrac
Definition: r_polyse.c:921
d_zi
int d_zi
Definition: r_polyse.c:102
skinwidth
int skinwidth
Definition: r_polyse.c:127
aliastriangleparms_t::b
finalvert_t * b
Definition: r_local.h:772
R_PolysetSetUpForLineScan
void R_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv)
Definition: r_polyse.c:413
d_ptexbasestep
int d_ptexbasestep
Definition: r_polyse.c:105
d_sfracextrastep
int d_sfracextrastep
Definition: r_polyse.c:103
CLAMP
#define CLAMP(x, low, high)
Definition: r_local.h:47
d_zibasestep
int d_zibasestep
Definition: r_polyse.c:107
x
GLint GLenum GLint x
Definition: qgl_win.c:116
id386
#define id386
Definition: q_shared.h:46
i
int i
Definition: q_shared.c:305
d_viewbuffer
pixel_t * d_viewbuffer
Definition: r_main.c:196
d_ziextrastep
int d_ziextrastep
Definition: r_polyse.c:107
r_p0
int r_p0[9]
Definition: r_polyse.c:64
r_lstepy
int r_lstepy
Definition: r_polyse.c:90
COLMODEL
#define COLMODEL
Definition: r_local.h:35
q
GLdouble GLdouble GLdouble q
Definition: qgl_win.c:344
irtable
byte irtable[256]
Definition: r_polyse.c:149
d_pdrawspans
void(* d_pdrawspans)(spanpackage_t *pspanpackage)
Definition: r_polyse.c:130
refdef_t::rdflags
int rdflags
Definition: ref.h:110
finalvert_s::t
int t
Definition: r_local.h:293
entity_s::flags
int flags
Definition: ref.h:76
currententity
entity_t * currententity
Definition: r_bsp.c:28
erroradjustup
int erroradjustup
Definition: r_edge.c:80
d_tfracextrastep
int d_tfracextrastep
Definition: r_polyse.c:104
r_lbstepx
int r_lbstepx
Definition: r_polyse.c:94
spanpackage_t::lightg
int lightg
Definition: r_polyse.c:46
spanpackage_t::lightb
int lightb
Definition: r_polyse.c:46
spanpackage_t::tfrac
int tfrac
Definition: r_polyse.c:44
edgetable::numleftedges
int numleftedges
Definition: r_polyse.c:52
r_tstepy
int r_tstepy
Definition: r_polyse.c:90
spanpackage_t::lightr
int lightr
Definition: r_polyse.c:46
finalvert_s::v
int v
Definition: r_local.h:293
r_lgstepx
int r_lgstepx
Definition: r_polyse.c:93
edgetable::prightedgevert1
int * prightedgevert1
Definition: r_polyse.c:58
d_lightextrastep
int d_lightextrastep
Definition: r_polyse.c:104
pix24
static unsigned char * pix24
Definition: r_polyse.c:927
r
GLdouble GLdouble r
Definition: qgl_win.c:336
r_zistepy
int r_zistepy
Definition: r_polyse.c:91
spanpackage_t::pz
short * pz
Definition: r_polyse.c:41
MASK_1K
#define MASK_1K
Definition: r_polyse.c:29
lptex
static byte * lptex
Definition: r_polyse.c:923
d_tfrac
int d_tfrac
Definition: r_polyse.c:102
lsfrac
static int lsfrac
Definition: r_polyse.c:921
d_pdestextrastep
int d_pdestextrastep
Definition: r_polyse.c:104
RDF_IRGOGGLES
#define RDF_IRGOGGLES
Definition: q_shared.h:625
R_RasterizeAliasPolySmooth
void R_RasterizeAliasPolySmooth(void)
Definition: r_polyse.c:1314
pedgetable
edgetable * pedgetable
Definition: r_polyse.c:71
d_pzextrastep
int d_pzextrastep
Definition: r_polyse.c:108
r_affinetridesc
affinetridesc_t r_affinetridesc
Definition: r_alias.c:34
d_lightbasestepb
int d_lightbasestepb
Definition: r_polyse.c:112
r_lstepx
int r_lstepx
Definition: r_polyse.c:89
adivtab_t::remainder
int remainder
Definition: r_polyse.c:119
spanpackage_t::sfrac
int sfrac
Definition: r_polyse.c:44
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:38
palmap2
byte palmap2[64][64][64]
Definition: r_draw.c:91
adivtab
static adivtab_t adivtab[32 *32]
Definition: r_polyse.c:122
r_p2
int r_p2[9]
Definition: r_polyse.c:64
d_lightg
int d_lightg
Definition: r_polyse.c:114
skinstart
byte * skinstart
Definition: r_polyse.c:128
r_p1
int r_p1[9]
Definition: r_polyse.c:64
edgetable::numrightedges
int numrightedges
Definition: r_polyse.c:56
NULL
#define NULL
Definition: q_shared.h:67
lzi
static int lzi
Definition: r_polyse.c:925
d_sfracbasestep
int d_sfracbasestep
Definition: r_polyse.c:106
d_ptex
byte * d_ptex
Definition: r_polyse.c:100
finalvert_s::zi
int zi
Definition: r_local.h:295
edgetable::prightedgevert0
int * prightedgevert0
Definition: r_polyse.c:57
r_screenwidth
int r_screenwidth
Definition: r_main.c:87
R_PolysetScanLeftEdge_C
void R_PolysetScanLeftEdge_C(int height)
Definition: r_polyse.c:291
coloredlights
int coloredlights
Definition: r_main.c:156
d_pdest
byte * d_pdest
Definition: r_polyse.c:100
d_tfracbasestep
int d_tfracbasestep
Definition: r_polyse.c:106
a_tstepxfrac
int a_tstepxfrac
Definition: r_polyse.c:89
affinetridesc_t::skinwidth
int skinwidth
Definition: r_local.h:330
MAX_LBM_HEIGHT
#define MAX_LBM_HEIGHT
Definition: r_local.h:184
spanpackage_t
Definition: r_polyse.c:39
d_countextrastep
int d_countextrastep
Definition: r_polyse.c:95
lpdest
static byte * lpdest
Definition: r_polyse.c:922
d_lightextrastepr
int d_lightextrastepr
Definition: r_polyse.c:113
s
static fixed16_t s
Definition: r_scan.c:30
a_spans
spanpackage_t * a_spans
Definition: r_polyse.c:97
d_lightbasestepr
int d_lightbasestepr
Definition: r_polyse.c:112
ystart
static int ystart
Definition: r_polyse.c:99
d_pdestbasestep
int d_pdestbasestep
Definition: r_polyse.c:105
R_PolysetScanLeftEdge
void R_PolysetScanLeftEdge(int height)
d_ptexextrastep
int d_ptexextrastep
Definition: r_polyse.c:103
edgetable::pleftedgevert0
int * pleftedgevert0
Definition: r_polyse.c:53
aliastriangleparms_t::a
finalvert_t * a
Definition: r_local.h:772
r_sstepy
int r_sstepy
Definition: r_polyse.c:90
llight
static int llight
Definition: r_polyse.c:924
trans
static int trans[3]
Definition: r_polyse.c:928
d_8to24table
unsigned d_8to24table[256]
Definition: r_main.c:27
d_pedgespanpackage
spanpackage_t * d_pedgespanpackage
Definition: r_polyse.c:98
edgetables
edgetable edgetables[12]
Definition: r_polyse.c:73
affinetridesc_t::vis_thresh
int vis_thresh
Definition: r_local.h:338
r_lgstepy
int r_lgstepy
Definition: r_polyse.c:93
spanpackage_t::pdest
void * pdest
Definition: r_polyse.c:40
d_lightextrastepg
int d_lightextrastepg
Definition: r_polyse.c:113
d_lightbasestep
int d_lightbasestep
Definition: r_polyse.c:105
finalvert_s::s
int s
Definition: r_local.h:293
FloorDivMod
void FloorDivMod(float numer, float denom, int *quotient, int *rem)
Definition: r_polyse.c:376
edgetable::pleftedgevert1
int * pleftedgevert1
Definition: r_polyse.c:54
d_lightextrastepb
int d_lightextrastepb
Definition: r_polyse.c:113
d_zwidth
unsigned int d_zwidth
Definition: r_local.h:538
aliastriangleparms_t::c
finalvert_t * c
Definition: r_local.h:772
adivtab_t
Definition: r_polyse.c:117
d_pz
short * d_pz
Definition: r_polyse.c:101
d_lightbasestepg
int d_lightbasestepg
Definition: r_polyse.c:112
d_light
int d_light
Definition: r_polyse.c:102
DPS_MAXSPANS
#define DPS_MAXSPANS
Definition: r_polyse.c:35
spanpackage_t::zi
int zi
Definition: r_polyse.c:44
R_PolysetSetEdgeTable
void R_PolysetSetEdgeTable(void)
Definition: r_polyse.c:1711
a_sstepxfrac
int a_sstepxfrac
Definition: r_polyse.c:89
spanpackage_t::ptex
byte * ptex
Definition: r_polyse.c:43
skintable
byte * skintable[MAX_LBM_HEIGHT]
Definition: r_polyse.c:126
d_sfrac
int d_sfrac
Definition: r_polyse.c:102
r_aliasblendcolor
int r_aliasblendcolor
Definition: r_alias.c:47
lpz
static short * lpz
Definition: r_polyse.c:926
r_lbstepy
int r_lbstepy
Definition: r_polyse.c:94
a_ststepxwhole
int a_ststepxwhole
Definition: r_polyse.c:89
r_tstepx
int r_tstepx
Definition: r_polyse.c:90
adivtab_t::quotient
int quotient
Definition: r_polyse.c:118
viddef_t::colormap
pixel_t * colormap
Definition: r_local.h:95
r_lrstepy
int r_lrstepy
Definition: r_polyse.c:92
d_pzbuffer
short * d_pzbuffer
Definition: r_main.c:197
edgetable::prightedgevert2
int * prightedgevert2
Definition: r_polyse.c:59
d_aspancount
int d_aspancount
Definition: r_polyse.c:95
lcount
static int lcount
Definition: r_polyse.c:920
viddef_t::alphamap
pixel_t * alphamap
Definition: r_local.h:96
spanpackage_t::light
int light
Definition: r_polyse.c:44
erroradjustdown
int erroradjustdown
Definition: r_edge.c:80
aliastriangleparms
aliastriangleparms_t aliastriangleparms
Definition: r_polyse.c:62
rand1k
int rand1k[]
Definition: r_polyse.c:25
rand1k_index
int rand1k_index
Definition: r_polyse.c:31
finalvert_s::l
int l
Definition: r_local.h:294
ubasestep
int ubasestep
Definition: r_edge.c:80
r_lrstepx
int r_lrstepx
Definition: r_polyse.c:92
affinetridesc_t::pskin
void * pskin
Definition: r_local.h:328
R_PolysetCalcGradients
void R_PolysetCalcGradients(int skinwidth)
Definition: r_polyse.c:844
vid
viddef_t vid
Definition: r_main.c:24
shadelight
float shadelight[3]
Definition: r_local.h:645