Quake II RTX doxygen  1.0 dev
alias.c File Reference
#include "sw.h"

Go to the source code of this file.

Macros

#define BBOX_TRIVIAL_ACCEPT   0
 
#define BBOX_MUST_CLIP_XY   1
 
#define BBOX_MUST_CLIP_Z   2
 
#define BBOX_TRIVIAL_REJECT   8
 

Functions

static void R_AliasTransformVector (vec3_t in, vec3_t out, float xf[3][4])
 
static unsigned long R_AliasCheckFrameBBox (maliasframe_t *frame, float worldxf[3][4])
 
static qboolean R_AliasCheckBBox (void)
 
void R_AliasProjectAndClipTestFinalVert (finalvert_t *fv)
 
static void R_AliasTransformFinalVerts (int numpoints, finalvert_t *fv, maliasvert_t *oldv, maliasvert_t *newv)
 
static void R_AliasPreparePoints (void)
 
static void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
 
static void R_AliasSetUpTransform (void)
 
static void R_AliasSetupSkin (void)
 
static void R_AliasSetupLighting (void)
 
static void R_AliasSetupFrames (void)
 
static void R_AliasSetUpLerpData (float backlerp)
 
static void R_AliasSetupBlend (void)
 
void R_AliasDrawModel (void)
 

Variables

int r_amodels_drawn
 
affinetridesc_t r_affinetridesc
 
int r_alias_alpha
 
int r_alias_one_minus_alpha
 
fixed8_t r_aliasblendcolor [3]
 
static vec3_t r_plightvec
 
static vec3_t r_lerp_frontv
 
static vec3_t r_lerp_backv
 
static vec3_t r_lerp_move
 
static maliasframe_tr_thisframe
 
static maliasframe_tr_lastframe
 
static float aliastransform [3][4]
 
static float aliasworldtransform [3][4]
 
static float aliasoldworldtransform [3][4]
 
static float s_ziscale
 
static vec3_t s_alias_forward
 
static vec3_t s_alias_right
 
static vec3_t s_alias_up
 

Macro Definition Documentation

◆ BBOX_MUST_CLIP_XY

#define BBOX_MUST_CLIP_XY   1

Definition at line 46 of file alias.c.

◆ BBOX_MUST_CLIP_Z

#define BBOX_MUST_CLIP_Z   2

Definition at line 47 of file alias.c.

◆ BBOX_TRIVIAL_ACCEPT

#define BBOX_TRIVIAL_ACCEPT   0

Definition at line 45 of file alias.c.

◆ BBOX_TRIVIAL_REJECT

#define BBOX_TRIVIAL_REJECT   8

Definition at line 48 of file alias.c.

Function Documentation

◆ R_AliasCheckBBox()

static qboolean R_AliasCheckBBox ( void  )
static

Definition at line 154 of file alias.c.

155 {
156  unsigned long ccodes[2] = { 0, 0 };
157 
159 
160  /*
161  ** non-lerping model
162  */
163  if (currententity->backlerp == 0) {
164  if (ccodes[0] == BBOX_TRIVIAL_ACCEPT)
165  return BBOX_TRIVIAL_ACCEPT;
166  else if (ccodes[0] & BBOX_TRIVIAL_REJECT)
167  return BBOX_TRIVIAL_REJECT;
168  else
169  return (ccodes[0] & ~BBOX_TRIVIAL_REJECT);
170  }
171 
173 
174  if ((ccodes[0] | ccodes[1]) == BBOX_TRIVIAL_ACCEPT)
175  return BBOX_TRIVIAL_ACCEPT;
176  else if ((ccodes[0] & ccodes[1]) & BBOX_TRIVIAL_REJECT)
177  return BBOX_TRIVIAL_REJECT;
178  else
179  return (ccodes[0] | ccodes[1]) & ~BBOX_TRIVIAL_REJECT;
180 }

Referenced by R_AliasDrawModel().

◆ R_AliasCheckFrameBBox()

static unsigned long R_AliasCheckFrameBBox ( maliasframe_t frame,
float  worldxf[3][4] 
)
static

Definition at line 68 of file alias.c.

69 {
70  unsigned long aggregate_and_clipcode = ~0U,
71  aggregate_or_clipcode = 0;
72  int i;
73  vec3_t mins, maxs;
74  vec3_t transformed_min, transformed_max;
75  qboolean zclipped = qfalse, zfullyclipped = qtrue;
76 
77  /*
78  ** get the exact frame bounding box
79  */
80  for (i = 0; i < 3; i++) {
81  mins[i] = frame->translate[i];
82  maxs[i] = mins[i] + frame->scale[i] * 255;
83  }
84 
85  /*
86  ** transform the min and max values into view space
87  */
88  R_AliasTransformVector(mins, transformed_min, aliastransform);
89  R_AliasTransformVector(maxs, transformed_max, aliastransform);
90 
91  if (transformed_min[2] >= ALIAS_Z_CLIP_PLANE)
92  zfullyclipped = qfalse;
93  if (transformed_max[2] >= ALIAS_Z_CLIP_PLANE)
94  zfullyclipped = qfalse;
95 
96  if (zfullyclipped) {
97  return BBOX_TRIVIAL_REJECT;
98  }
99  if (zclipped) {
101  }
102 
103  /*
104  ** build a transformed bounding box from the given min and max
105  */
106  for (i = 0; i < 8; i++) {
107  int j;
108  vec3_t tmp, transformed;
109  unsigned long clipcode = 0;
110 
111  if (i & 1)
112  tmp[0] = mins[0];
113  else
114  tmp[0] = maxs[0];
115 
116  if (i & 2)
117  tmp[1] = mins[1];
118  else
119  tmp[1] = maxs[1];
120 
121  if (i & 4)
122  tmp[2] = mins[2];
123  else
124  tmp[2] = maxs[2];
125 
126  R_AliasTransformVector(tmp, transformed, worldxf);
127 
128  for (j = 0; j < 4; j++) {
129  float dp = DotProduct(transformed, view_clipplanes[j].normal);
130 
131  if ((dp - view_clipplanes[j].dist) < 0.0F)
132  clipcode |= 1 << j;
133  }
134 
135  aggregate_and_clipcode &= clipcode;
136  aggregate_or_clipcode |= clipcode;
137  }
138 
139  if (aggregate_and_clipcode) {
140  return BBOX_TRIVIAL_REJECT;
141  }
142  if (!aggregate_or_clipcode) {
143  return BBOX_TRIVIAL_ACCEPT;
144  }
145 
146  return BBOX_MUST_CLIP_XY;
147 }

Referenced by R_AliasCheckBBox().

◆ R_AliasDrawModel()

void R_AliasDrawModel ( void  )

Definition at line 674 of file alias.c.

675 {
676  if (r_lerpmodels->integer == 0)
677  currententity->backlerp = 0;
678 
679  if ((currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND))
681 
682  /*
683  ** we have to set our frame pointers and transformations before
684  ** doing any real work
685  */
688 
689  // see if the bounding box lets us trivially reject, also sets
690  // trivial accept status
692  goto exit;
693 
694  // set up the skin and verify it exists
696 
697  r_amodels_drawn++;
698 
700 
702 
703  /*
704  ** compute this_frame and old_frame addresses
705  */
707 
708  if (currententity->flags & RF_DEPTHHACK)
709  s_ziscale = (float)0x8000 * (float)0x10000 * 3.0;
710  else
711  s_ziscale = (float)0x8000 * (float)0x10000;
712 
714 
715 exit:
716  if ((currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND))
718 }

Referenced by R_DrawEntities().

◆ R_AliasPreparePoints()

static void R_AliasPreparePoints ( void  )
static

Definition at line 274 of file alias.c.

275 {
276  int i;
277  maliasst_t *pstverts;
278  maliastri_t *ptri;
279  finalvert_t *pfv[3];
280  finalvert_t finalverts[MAX_ALIAS_VERTS +
281  ((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 3];
282  finalvert_t *pfinalverts;
283 
284  // put work vertexes on stack, cache aligned
285  pfinalverts = (finalvert_t *)
286  (((uintptr_t)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
287 
288  R_AliasTransformFinalVerts(currentmodel->numverts, pfinalverts,
290 
291 // clip and draw all triangles
292 //
293  pstverts = currentmodel->sts;
294  ptri = currentmodel->tris;
295 
296  if ((currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND)) {
297  for (i = 0; i < currentmodel->numtris; i++, ptri++) {
298  pfv[0] = &pfinalverts[ptri->index_xyz[0]];
299  pfv[1] = &pfinalverts[ptri->index_xyz[1]];
300  pfv[2] = &pfinalverts[ptri->index_xyz[2]];
301 
302  if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
303  continue; // completely clipped
304 
305  // insert s/t coordinates
306  pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
307  pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;
308 
309  pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
310  pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;
311 
312  pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
313  pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;
314 
315  if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)) {
316  // totally unclipped
317  aliastriangleparms.a = pfv[2];
318  aliastriangleparms.b = pfv[1];
319  aliastriangleparms.c = pfv[0];
320 
321  R_DrawTriangle();
322  } else {
323  R_AliasClipTriangle(pfv[2], pfv[1], pfv[0]);
324  }
325  }
326  } else {
327  for (i = 0; i < currentmodel->numtris; i++, ptri++) {
328  pfv[0] = &pfinalverts[ptri->index_xyz[0]];
329  pfv[1] = &pfinalverts[ptri->index_xyz[1]];
330  pfv[2] = &pfinalverts[ptri->index_xyz[2]];
331 
332  if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
333  continue; // completely clipped
334 
335  // insert s/t coordinates
336  pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
337  pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;
338 
339  pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
340  pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;
341 
342  pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
343  pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;
344 
345  if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)) {
346  // totally unclipped
347  aliastriangleparms.a = pfv[0];
348  aliastriangleparms.b = pfv[1];
349  aliastriangleparms.c = pfv[2];
350 
351  R_DrawTriangle();
352  } else {
353  // partially clipped
354  R_AliasClipTriangle(pfv[0], pfv[1], pfv[2]);
355  }
356  }
357  }
358 }

Referenced by R_AliasDrawModel().

◆ R_AliasProjectAndClipTestFinalVert()

void R_AliasProjectAndClipTestFinalVert ( finalvert_t fv)

Definition at line 188 of file alias.c.

189 {
190  float zi;
191  float x, y, z;
192 
193  // project points
194  x = fv->xyz[0];
195  y = fv->xyz[1];
196  z = fv->xyz[2];
197  zi = 1.0 / z;
198 
199  fv->zi = zi * s_ziscale;
200 
201  fv->u = (x * r_refdef.xscale * zi) + r_refdef.xcenter;
202  fv->v = (y * r_refdef.yscale * zi) + r_refdef.ycenter;
203 
204  if (fv->u < r_refdef.vrect.x)
205  fv->flags |= ALIAS_LEFT_CLIP;
206  if (fv->v < r_refdef.vrect.y)
207  fv->flags |= ALIAS_TOP_CLIP;
208  if (fv->u > r_refdef.vrectright)
209  fv->flags |= ALIAS_RIGHT_CLIP;
210  if (fv->v > r_refdef.vrectbottom)
211  fv->flags |= ALIAS_BOTTOM_CLIP;
212 }

Referenced by R_Alias_clip_z(), and R_AliasTransformFinalVerts().

◆ R_AliasSetupBlend()

static void R_AliasSetupBlend ( void  )
static

Definition at line 612 of file alias.c.

613 {
614  extern void (*d_pdrawspans)(void *);
615  extern void R_PolysetDrawSpansConstant8_Blended(void *);
616  extern void R_PolysetDrawSpans8_Blended(void *);
617  extern void R_PolysetDrawSpans8_Opaque(void *);
618 
619  int mask;
620  color_t color;
621 
622  if (currententity->flags & RF_TRANSLUCENT) {
623  r_alias_alpha = 255 * currententity->alpha;
625  } else {
626  r_alias_alpha = 255;
628  }
629 
630  /*
631  ** select the proper span routine based on translucency
632  */
633  mask = currententity->flags & RF_SHELL_MASK;
634  if (mask || r_affinetridesc.pskin == NULL) {
635  if (mask == RF_SHELL_RED)
636  color.u32 = d_8to24table[SHELL_RED_COLOR];
637  else if (mask == RF_SHELL_GREEN)
638  color.u32 = d_8to24table[SHELL_GREEN_COLOR];
639  else if (mask == RF_SHELL_BLUE)
640  color.u32 = d_8to24table[SHELL_BLUE_COLOR];
641  else if (mask == (RF_SHELL_RED | RF_SHELL_GREEN))
642  color.u32 = d_8to24table[SHELL_RG_COLOR];
643  else if (mask == (RF_SHELL_RED | RF_SHELL_BLUE))
644  color.u32 = d_8to24table[SHELL_RB_COLOR];
645  else if (mask == (RF_SHELL_BLUE | RF_SHELL_GREEN))
646  color.u32 = d_8to24table[SHELL_BG_COLOR];
647  else if (mask == RF_SHELL_DOUBLE)
648  color.u32 = d_8to24table[SHELL_DOUBLE_COLOR];
649  else if (mask == RF_SHELL_HALF_DAM)
650  color.u32 = d_8to24table[SHELL_HALF_DAM_COLOR];
651  else
652  color.u32 = d_8to24table[SHELL_WHITE_COLOR];
653 
657 
659  } else if (currententity->flags & RF_TRANSLUCENT) {
660  if (r_alias_alpha == 255)
662  else
664  } else {
666  }
667 }

Referenced by R_AliasDrawModel().

◆ R_AliasSetupFrames()

static void R_AliasSetupFrames ( void  )
static

Definition at line 550 of file alias.c.

551 {
552  int thisframe = currententity->frame;
553  int lastframe = currententity->oldframe;
554 
555  if (thisframe >= currentmodel->numframes || thisframe < 0) {
556  Com_DPrintf("%s: %s: no such thisframe %d\n",
557  __func__, currentmodel->name, thisframe);
558  thisframe = 0;
559  }
560  if (lastframe >= currentmodel->numframes || lastframe < 0) {
561  Com_DPrintf("%s: %s: no such lastframe %d\n",
562  __func__, currentmodel->name, lastframe);
563  lastframe = 0;
564  }
565 
566  r_thisframe = &currentmodel->frames[thisframe];
567  r_lastframe = &currentmodel->frames[lastframe];
568 }

Referenced by R_AliasDrawModel().

◆ R_AliasSetUpLerpData()

static void R_AliasSetUpLerpData ( float  backlerp)
static

Definition at line 575 of file alias.c.

576 {
577  float frontlerp;
578  vec3_t translation, vectors[3];
579  int i;
580 
581  frontlerp = 1.0F - backlerp;
582 
583  /*
584  ** convert entity's angles into discrete vectors for R, U, and F
585  */
586  AngleVectors(currententity->angles, vectors[0], vectors[1], vectors[2]);
587 
588  /*
589  ** translation is the vector from last position to this position
590  */
591  VectorSubtract(currententity->oldorigin, currententity->origin, translation);
592 
593  /*
594  ** move should be the delta back to the previous frame * backlerp
595  */
596  r_lerp_move[0] = DotProduct(translation, vectors[0]); // forward
597  r_lerp_move[1] = -DotProduct(translation, vectors[1]); // left
598  r_lerp_move[2] = DotProduct(translation, vectors[2]); // up
599 
601 
602  for (i = 0; i < 3; i++) {
604  }
605 
606  for (i = 0; i < 3; i++) {
609  }
610 }

Referenced by R_AliasDrawModel().

◆ R_AliasSetupLighting()

static void R_AliasSetupLighting ( void  )
static

Definition at line 491 of file alias.c.

492 {
493  float cp, cy, sp, sy;
494  vec_t yaw;
495  vec3_t light;
496  int i;
497 
498  // all components of light should be identical in software
499  if (currententity->flags & RF_FULLBRIGHT) {
500  VectorSet(light, 1, 1, 1);
501  } else {
502  R_LightPoint(currententity->origin, light);
503  }
504 
505  if (currententity->flags & RF_MINLIGHT) {
506  for (i = 0; i < 3; i++)
507  if (light[i] < 0.1)
508  light[i] = 0.1;
509  }
510 
511  if (currententity->flags & RF_GLOW) {
512  // bonus items will pulse with time
513  float scale;
514  float min;
515 
516  scale = 0.1 * sin(r_newrefdef.time * 7);
517  for (i = 0; i < 3; i++) {
518  min = light[i] * 0.8;
519  light[i] += scale;
520  if (light[i] < min)
521  light[i] = min;
522  }
523  }
524 
525  for (i = 0; i < 3; i++)
526  clamp(light[i], 0, 1);
527 
528  r_aliasblendcolor[0] = light[0] * 255;
529  r_aliasblendcolor[1] = light[1] * 255;
530  r_aliasblendcolor[2] = light[2] * 255;
531 
532 // rotate the lighting vector into the model's frame of reference
533  yaw = -DEG2RAD(currententity->angles[YAW]);
534  cy = cos(yaw);
535  sy = sin(yaw);
536  cp = cos(-M_PI / 4);
537  sp = sin(-M_PI / 4);
538  r_plightvec[0] = cp * cy;
539  r_plightvec[1] = cp * sy;
540  r_plightvec[2] = -sp;
541 }

Referenced by R_AliasDrawModel().

◆ R_AliasSetupSkin()

static void R_AliasSetupSkin ( void  )
static

Definition at line 454 of file alias.c.

455 {
456  int skinnum;
457  image_t *pskindesc;
458 
459  if (currententity->skin) {
460  pskindesc = IMG_ForHandle(currententity->skin);
461  } else {
462  skinnum = currententity->skinnum;
463  if ((skinnum >= currentmodel->numskins) || (skinnum < 0)) {
464  Com_DPrintf("R_AliasSetupSkin %s: no such skin # %d\n",
465  currentmodel->name, skinnum);
466  skinnum = 0;
467  }
468  pskindesc = currentmodel->skins[skinnum];
469  }
470 
471  if (pskindesc == NULL ||
472  pskindesc->upload_width != currentmodel->skinwidth ||
473  pskindesc->upload_height != currentmodel->skinheight) {
474  Com_DPrintf("R_AliasSetupSkin %s: bad skin %p\n",
475  currentmodel->name, pskindesc);
476  memset(&r_affinetridesc, 0, sizeof(r_affinetridesc));
477  return;
478  }
479 
480  r_affinetridesc.pskin = pskindesc->pixels[0];
481  r_affinetridesc.skinwidth = pskindesc->upload_width * TEX_BYTES;
482  r_affinetridesc.skinheight = pskindesc->upload_height;
483 }

Referenced by R_AliasDrawModel().

◆ R_AliasSetUpTransform()

static void R_AliasSetUpTransform ( void  )
static

Definition at line 387 of file alias.c.

388 {
389  int i;
390  float viewmatrix[3][4];
391  vec3_t angles;
392 
393 // TODO: should really be stored with the entity instead of being reconstructed
394 // TODO: should use a look-up table
395 // TODO: could cache lazily, stored in the entity
396 //
397  angles[ROLL] = currententity->angles[ROLL];
398  angles[PITCH] = currententity->angles[PITCH];
399  angles[YAW] = currententity->angles[YAW];
401 
402 // TODO: can do this with simple matrix rearrangement
403 
404  memset(aliasworldtransform, 0, sizeof(aliasworldtransform));
406 
407  for (i = 0; i < 3; i++) {
411  }
412 
413  aliasworldtransform[0][3] = currententity->origin[0] - r_origin[0];
414  aliasworldtransform[1][3] = currententity->origin[1] - r_origin[1];
415  aliasworldtransform[2][3] = currententity->origin[2] - r_origin[2];
416 
417  aliasoldworldtransform[0][3] = currententity->oldorigin[0] - r_origin[0];
418  aliasoldworldtransform[1][3] = currententity->oldorigin[1] - r_origin[1];
419  aliasoldworldtransform[2][3] = currententity->oldorigin[2] - r_origin[2];
420 
421 // FIXME: can do more efficiently than full concatenation
422 // memcpy(rotationmatrix, t2matrix, sizeof(rotationmatrix));
423 
424 // R_ConcatTransforms(t2matrix, tmatrix, rotationmatrix);
425 
426 // TODO: should be global, set when vright, etc., set
427  VectorCopy(vright, viewmatrix[0]);
428  VectorCopy(vup, viewmatrix[1]);
429  VectorNegate(viewmatrix[1], viewmatrix[1]);
430  VectorCopy(vpn, viewmatrix[2]);
431 
432  viewmatrix[0][3] = 0;
433  viewmatrix[1][3] = 0;
434  viewmatrix[2][3] = 0;
435 
436 // memcpy(aliasworldtransform, rotationmatrix, sizeof(aliastransform));
437 
439 
440  aliasworldtransform[0][3] = currententity->origin[0];
441  aliasworldtransform[1][3] = currententity->origin[1];
442  aliasworldtransform[2][3] = currententity->origin[2];
443 
444  aliasoldworldtransform[0][3] = currententity->oldorigin[0];
445  aliasoldworldtransform[1][3] = currententity->oldorigin[1];
446  aliasoldworldtransform[2][3] = currententity->oldorigin[2];
447 }

Referenced by R_AliasDrawModel().

◆ R_AliasTransformFinalVerts()

static void R_AliasTransformFinalVerts ( int  numpoints,
finalvert_t fv,
maliasvert_t oldv,
maliasvert_t newv 
)
static

Definition at line 219 of file alias.c.

220 {
221  int i;
222 
223  for (i = 0; i < numpoints; i++, fv++, oldv++, newv++) {
224  float lightcos;
225  const vec_t *plightnormal;
226  vec3_t lerped_vert;
227 
228  lerped_vert[0] = r_lerp_move[0] + oldv->v[0] * r_lerp_backv[0] + newv->v[0] * r_lerp_frontv[0];
229  lerped_vert[1] = r_lerp_move[1] + oldv->v[1] * r_lerp_backv[1] + newv->v[1] * r_lerp_frontv[1];
230  lerped_vert[2] = r_lerp_move[2] + oldv->v[2] * r_lerp_backv[2] + newv->v[2] * r_lerp_frontv[2];
231 
232  plightnormal = bytedirs[newv->lightnormalindex];
233 
234  if (currententity->flags & RF_SHELL_MASK) {
235  float scale;
236 
237  scale = (currententity->flags & RF_WEAPONMODEL) ?
238  WEAPONSHELL_SCALE : POWERSUIT_SCALE;
239 
240  lerped_vert[0] += plightnormal[0] * scale;
241  lerped_vert[1] += plightnormal[1] * scale;
242  lerped_vert[2] += plightnormal[2] * scale;
243  }
244 
245  fv->xyz[0] = DotProduct(lerped_vert, aliastransform[0]) + aliastransform[0][3];
246  fv->xyz[1] = DotProduct(lerped_vert, aliastransform[1]) + aliastransform[1][3];
247  fv->xyz[2] = DotProduct(lerped_vert, aliastransform[2]) + aliastransform[2][3];
248 
249  fv->flags = 0;
250 
251  // lighting
252  lightcos = DotProduct(plightnormal, r_plightvec);
253  if (lightcos < 0)
254  lightcos *= 0.3f;
255 
256  fv->l = 0x8000 + (int)(0x7fff * lightcos);
257 
258  if (fv->xyz[2] < ALIAS_Z_CLIP_PLANE) {
259  fv->flags |= ALIAS_Z_CLIP;
260  } else {
262  }
263  }
264 }

Referenced by R_AliasPreparePoints().

◆ R_AliasTransformVector()

static void R_AliasTransformVector ( vec3_t  in,
vec3_t  out,
float  xf[3][4] 
)
static

Definition at line 55 of file alias.c.

56 {
57  out[0] = DotProduct(in, xf[0]) + xf[0][3];
58  out[1] = DotProduct(in, xf[1]) + xf[1][3];
59  out[2] = DotProduct(in, xf[2]) + xf[2][3];
60 }

Referenced by R_AliasCheckFrameBBox().

◆ R_ConcatTransforms()

static void R_ConcatTransforms ( float  in1[3][4],
float  in2[3][4],
float  out[3][4] 
)
static

Definition at line 365 of file alias.c.

366 {
367  out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];
368  out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1];
369  out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2];
370  out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3];
371  out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0];
372  out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1];
373  out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2];
374  out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3];
375  out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0];
376  out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1];
377  out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2];
378  out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
379 }

Referenced by R_AliasSetUpTransform().

Variable Documentation

◆ aliasoldworldtransform

float aliasoldworldtransform[3][4]
static

Definition at line 40 of file alias.c.

Referenced by R_AliasCheckBBox(), and R_AliasSetUpTransform().

◆ aliastransform

float aliastransform[3][4]
static

◆ aliasworldtransform

float aliasworldtransform[3][4]
static

Definition at line 39 of file alias.c.

Referenced by R_AliasCheckBBox(), and R_AliasSetUpTransform().

◆ r_affinetridesc

◆ r_alias_alpha

int r_alias_alpha

Definition at line 29 of file alias.c.

Referenced by R_AliasSetupBlend(), and R_PolysetDrawSpans8_Blended().

◆ r_alias_one_minus_alpha

int r_alias_one_minus_alpha

◆ r_aliasblendcolor

◆ r_amodels_drawn

int r_amodels_drawn

Definition at line 25 of file alias.c.

Referenced by R_AliasDrawModel(), R_PrintAliasStats(), and R_SetupFrame().

◆ r_lastframe

maliasframe_t * r_lastframe
static

◆ r_lerp_backv

vec3_t r_lerp_backv
static

Definition at line 34 of file alias.c.

Referenced by R_AliasSetUpLerpData(), and R_AliasTransformFinalVerts().

◆ r_lerp_frontv

vec3_t r_lerp_frontv
static

Definition at line 34 of file alias.c.

Referenced by R_AliasSetUpLerpData(), and R_AliasTransformFinalVerts().

◆ r_lerp_move

vec3_t r_lerp_move
static

Definition at line 34 of file alias.c.

Referenced by R_AliasSetUpLerpData(), and R_AliasTransformFinalVerts().

◆ r_plightvec

vec3_t r_plightvec
static

Definition at line 33 of file alias.c.

Referenced by R_AliasSetupLighting(), and R_AliasTransformFinalVerts().

◆ r_thisframe

maliasframe_t* r_thisframe
static

◆ s_alias_forward

vec3_t s_alias_forward
static

Definition at line 43 of file alias.c.

Referenced by R_AliasSetUpTransform().

◆ s_alias_right

vec3_t s_alias_right
static

Definition at line 43 of file alias.c.

Referenced by R_AliasSetUpTransform().

◆ s_alias_up

vec3_t s_alias_up
static

Definition at line 43 of file alias.c.

Referenced by R_AliasSetUpTransform().

◆ s_ziscale

float s_ziscale
static

Definition at line 42 of file alias.c.

Referenced by R_AliasDrawModel(), and R_AliasProjectAndClipTestFinalVert().

oldrefdef_t::xcenter
float xcenter
Definition: sw.h:145
r_origin
vec3_t r_origin
Definition: main.c:52
r_newrefdef
refdef_t r_newrefdef
Definition: main.c:28
ALIAS_Z_CLIP_PLANE
#define ALIAS_Z_CLIP_PLANE
Definition: sw.h:105
R_ConcatTransforms
static void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4])
Definition: alias.c:365
R_PolysetDrawSpans8_Opaque
void R_PolysetDrawSpans8_Opaque(spanpackage_t *pspanpackage)
Definition: polyset.c:454
R_AliasSetupLighting
static void R_AliasSetupLighting(void)
Definition: alias.c:491
maliastri_s::index_xyz
unsigned short index_xyz[3]
Definition: sw.h:276
R_PolysetDrawSpansConstant8_Blended
void R_PolysetDrawSpansConstant8_Blended(spanpackage_t *pspanpackage)
Definition: polyset.c:415
maliasframe_s::scale
vec3_t scale
Definition: gl.h:226
R_AliasTransformVector
static void R_AliasTransformVector(vec3_t in, vec3_t out, float xf[3][4])
Definition: alias.c:55
image_t
struct image_s image_t
Definition: material.h:27
BBOX_TRIVIAL_REJECT
#define BBOX_TRIVIAL_REJECT
Definition: alias.c:48
aliastriangleparms_t::b
finalvert_t * b
Definition: sw.h:294
maliasst_s
Definition: sw.h:270
aliasoldworldtransform
static float aliasoldworldtransform[3][4]
Definition: alias.c:40
fv
static float fv
Definition: edge.c:59
R_AliasSetUpTransform
static void R_AliasSetUpTransform(void)
Definition: alias.c:387
TEX_BYTES
#define TEX_BYTES
Definition: sw.h:50
r_aliasblendcolor
fixed8_t r_aliasblendcolor[3]
Definition: alias.c:31
R_LightPoint
void(* R_LightPoint)(vec3_t origin, vec3_t light)
Definition: refresh.c:409
maliastri_s::index_st
unsigned short index_st[3]
Definition: sw.h:277
R_PolysetDrawSpans8_Blended
void R_PolysetDrawSpans8_Blended(spanpackage_t *pspanpackage)
Definition: polyset.c:348
r_lerp_backv
static vec3_t r_lerp_backv
Definition: alias.c:34
R_AliasPreparePoints
static void R_AliasPreparePoints(void)
Definition: alias.c:274
R_AliasSetUpLerpData
static void R_AliasSetUpLerpData(float backlerp)
Definition: alias.c:575
aliasworldtransform
static float aliasworldtransform[3][4]
Definition: alias.c:39
R_AliasClipTriangle
void R_AliasClipTriangle(finalvert_t *index0, finalvert_t *index1, finalvert_t *index2)
Definition: aclip.c:183
BBOX_MUST_CLIP_XY
#define BBOX_MUST_CLIP_XY
Definition: alias.c:46
r_refdef
oldrefdef_t r_refdef
Definition: main.c:57
F
#define F(name)
Definition: g_save.c:46
d_8to24table
uint32_t d_8to24table[256]
Definition: images.c:654
finalvert_s::t
int t
Definition: sw.h:163
r_plightvec
static vec3_t r_plightvec
Definition: alias.c:33
oldrefdef_t::yscale
float yscale
Definition: sw.h:146
backlerp
static float backlerp
Definition: mesh.c:26
R_AliasSetupBlend
static void R_AliasSetupBlend(void)
Definition: alias.c:612
r_amodels_drawn
int r_amodels_drawn
Definition: alias.c:25
ALIAS_BOTTOM_CLIP
#define ALIAS_BOTTOM_CLIP
Definition: sw.h:90
finalvert_s
Definition: sw.h:162
r_lerp_move
static vec3_t r_lerp_move
Definition: alias.c:34
R_AliasSetupSkin
static void R_AliasSetupSkin(void)
Definition: alias.c:454
vup
vec3_t vup
Definition: main.c:49
maliasframe_s::translate
vec3_t translate
Definition: gl.h:227
ALIAS_RIGHT_CLIP
#define ALIAS_RIGHT_CLIP
Definition: sw.h:89
currententity
entity_t * currententity
Definition: bsp.c:26
vpn
vec3_t vpn
Definition: main.c:50
r_lerp_frontv
static vec3_t r_lerp_frontv
Definition: alias.c:34
ALIAS_LEFT_CLIP
#define ALIAS_LEFT_CLIP
Definition: sw.h:87
r_alias_alpha
int r_alias_alpha
Definition: alias.c:29
R_AliasTransformFinalVerts
static void R_AliasTransformFinalVerts(int numpoints, finalvert_t *fv, maliasvert_t *oldv, maliasvert_t *newv)
Definition: alias.c:219
BBOX_MUST_CLIP_Z
#define BBOX_MUST_CLIP_Z
Definition: alias.c:47
ALIAS_Z_CLIP
#define ALIAS_Z_CLIP
Definition: sw.h:91
CACHE_SIZE
#define CACHE_SIZE
Definition: sw.h:47
R_AliasSetupFrames
static void R_AliasSetupFrames(void)
Definition: alias.c:550
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: shared.c:23
maliasst_s::t
signed short t
Definition: sw.h:272
void
void(APIENTRY *qwglDrawBuffer)(GLenum mode)
d_pdrawspans
void(* d_pdrawspans)(spanpackage_t *pspanpackage)
Definition: polyset.c:98
ALIAS_TOP_CLIP
#define ALIAS_TOP_CLIP
Definition: sw.h:88
s_alias_up
static vec3_t s_alias_up
Definition: alias.c:43
oldrefdef_t::xscale
float xscale
Definition: sw.h:146
aliastransform
static float aliastransform[3][4]
Definition: alias.c:38
BBOX_TRIVIAL_ACCEPT
#define BBOX_TRIVIAL_ACCEPT
Definition: alias.c:45
affinetridesc_t::skinwidth
int skinwidth
Definition: sw.h:172
r_lerpmodels
cvar_t * r_lerpmodels
Definition: main.c:99
aliastriangleparms_t::a
finalvert_t * a
Definition: sw.h:294
s_ziscale
static float s_ziscale
Definition: alias.c:42
r_thisframe
static maliasframe_t * r_thisframe
Definition: alias.c:36
oldrefdef_t::vrect
vrect_t vrect
Definition: sw.h:132
s_alias_forward
static vec3_t s_alias_forward
Definition: alias.c:43
finalvert_s::s
int s
Definition: sw.h:163
frontlerp
static float frontlerp
Definition: mesh.c:25
maliasst_s::s
signed short s
Definition: sw.h:271
r_alias_one_minus_alpha
int r_alias_one_minus_alpha
Definition: alias.c:30
r_lastframe
static maliasframe_t * r_lastframe
Definition: alias.c:36
aliastriangleparms_t::c
finalvert_t * c
Definition: sw.h:294
oldrefdef_t::vrectright
int vrectright
Definition: sw.h:133
R_DrawTriangle
void R_DrawTriangle(void)
Definition: polyset.c:113
s_alias_right
static vec3_t s_alias_right
Definition: alias.c:43
r_affinetridesc
affinetridesc_t r_affinetridesc
Definition: alias.c:27
color
static vec4_t color
Definition: mesh.c:33
IMG_ForHandle
image_t * IMG_ForHandle(qhandle_t h)
Definition: images.c:1156
oldrefdef_t::ycenter
float ycenter
Definition: sw.h:145
affinetridesc_t::skinheight
int skinheight
Definition: sw.h:173
int
CONST PIXELFORMATDESCRIPTOR int
Definition: wgl.c:26
R_AliasProjectAndClipTestFinalVert
void R_AliasProjectAndClipTestFinalVert(finalvert_t *fv)
Definition: alias.c:188
bytedirs
const vec3_t bytedirs[NUMVERTEXNORMALS]
Definition: math.c:80
R_AliasCheckBBox
static qboolean R_AliasCheckBBox(void)
Definition: alias.c:154
aliastriangleparms
aliastriangleparms_t aliastriangleparms
Definition: polyset.c:47
view_clipplanes
clipplane_t view_clipplanes[4]
Definition: raster.c:37
maliasframe_s::verts
maliasvert_t * verts
Definition: sw.h:290
maliastri_s
Definition: sw.h:275
R_AliasCheckFrameBBox
static unsigned long R_AliasCheckFrameBBox(maliasframe_t *frame, float worldxf[3][4])
Definition: alias.c:68
currentmodel
model_t * currentmodel
Definition: main.c:29
oldrefdef_t::vrectbottom
int vrectbottom
Definition: sw.h:133
affinetridesc_t::pskin
void * pskin
Definition: sw.h:171
vright
vec3_t vright
Definition: main.c:51