vkQuake2 doxygen  1.0 dev
r_rast.c File Reference
#include <assert.h>
#include "r_local.h"

Go to the source code of this file.

Classes

struct  evert_t
 

Macros

#define MAXLEFTCLIPEDGES   100
 
#define FULLY_CLIPPED_CACHED   0x80000000
 
#define FRAMECOUNT_MASK   0x7FFFFFFF
 

Functions

void R_InitSkyBox (void)
 
void R_EmitSkyBox (void)
 
void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1)
 
void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
 
void R_EmitCachedEdge (void)
 
void R_RenderFace (msurface_t *fa, int clipflags)
 
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
 

Variables

unsigned int cacheoffset
 
int c_faceclip
 
clipplane_tentity_clipplanes
 
clipplane_t view_clipplanes [4]
 
clipplane_t world_clipplanes [16]
 
medge_tr_pedge
 
qboolean r_leftclipped
 
qboolean r_rightclipped
 
static qboolean makeleftedge
 
static qboolean makerightedge
 
qboolean r_nearzionly
 
int sintable [4200]
 
int intsintable [4200]
 
int blanktable [4200]
 
mvertex_t r_leftenter
 
mvertex_t r_leftexit
 
mvertex_t r_rightenter
 
mvertex_t r_rightexit
 
int r_emitted
 
float r_nearzi
 
float r_u1
 
float r_v1
 
float r_lzi1
 
int r_ceilv1
 
qboolean r_lastvertvalid
 
int r_skyframe
 
msurface_tr_skyfaces
 
mplane_t r_skyplanes [6]
 
mtexinfo_t r_skytexinfo [6]
 
mvertex_tr_skyverts
 
medge_tr_skyedges
 
intr_skysurfedges
 
int skybox_planes [12] = {2,-128, 0,-128, 2,128, 1,128, 0,128, 1,-128}
 
int box_surfedges [24]
 
int box_edges [24] = { 1,2, 2,3, 3,4, 4,1, 1,5, 5,6, 6,2, 7,8, 8,6, 5,7, 8,3, 7,4}
 
int box_faces [6] = {0,0,2,2,2,0}
 
vec3_t box_vecs [6][2]
 
float box_verts [8][3]
 

Macro Definition Documentation

◆ FRAMECOUNT_MASK

#define FRAMECOUNT_MASK   0x7FFFFFFF

Definition at line 30 of file r_rast.c.

◆ FULLY_CLIPPED_CACHED

#define FULLY_CLIPPED_CACHED   0x80000000

Definition at line 29 of file r_rast.c.

◆ MAXLEFTCLIPEDGES

#define MAXLEFTCLIPEDGES   100

Definition at line 26 of file r_rast.c.

Function Documentation

◆ R_ClipEdge()

void R_ClipEdge ( mvertex_t pv0,
mvertex_t pv1,
clipplane_t clip 
)

Definition at line 398 of file r_rast.c.

399 {
400  float d0, d1, f;
401  mvertex_t clipvert;
402 
403  if (clip)
404  {
405  do
406  {
407  d0 = DotProduct (pv0->position, clip->normal) - clip->dist;
408  d1 = DotProduct (pv1->position, clip->normal) - clip->dist;
409 
410  if (d0 >= 0)
411  {
412  // point 0 is unclipped
413  if (d1 >= 0)
414  {
415  // both points are unclipped
416  continue;
417  }
418 
419  // only point 1 is clipped
420 
421  // we don't cache clipped edges
422  cacheoffset = 0x7FFFFFFF;
423 
424  f = d0 / (d0 - d1);
425  clipvert.position[0] = pv0->position[0] +
426  f * (pv1->position[0] - pv0->position[0]);
427  clipvert.position[1] = pv0->position[1] +
428  f * (pv1->position[1] - pv0->position[1]);
429  clipvert.position[2] = pv0->position[2] +
430  f * (pv1->position[2] - pv0->position[2]);
431 
432  if (clip->leftedge)
433  {
434  r_leftclipped = true;
435  r_leftexit = clipvert;
436  }
437  else if (clip->rightedge)
438  {
439  r_rightclipped = true;
440  r_rightexit = clipvert;
441  }
442 
443  R_ClipEdge (pv0, &clipvert, clip->next);
444  return;
445  }
446  else
447  {
448  // point 0 is clipped
449  if (d1 < 0)
450  {
451  // both points are clipped
452  // we do cache fully clipped edges
453  if (!r_leftclipped)
456  return;
457  }
458 
459  // only point 0 is clipped
460  r_lastvertvalid = false;
461 
462  // we don't cache partially clipped edges
463  cacheoffset = 0x7FFFFFFF;
464 
465  f = d0 / (d0 - d1);
466  clipvert.position[0] = pv0->position[0] +
467  f * (pv1->position[0] - pv0->position[0]);
468  clipvert.position[1] = pv0->position[1] +
469  f * (pv1->position[1] - pv0->position[1]);
470  clipvert.position[2] = pv0->position[2] +
471  f * (pv1->position[2] - pv0->position[2]);
472 
473  if (clip->leftedge)
474  {
475  r_leftclipped = true;
476  r_leftenter = clipvert;
477  }
478  else if (clip->rightedge)
479  {
480  r_rightclipped = true;
481  r_rightenter = clipvert;
482  }
483 
484  R_ClipEdge (&clipvert, pv1, clip->next);
485  return;
486  }
487  } while ((clip = clip->next) != NULL);
488  }
489 
490 // add the edge
491  R_EmitEdge (pv0, pv1);
492 }

Referenced by R_RenderBmodelFace(), and R_RenderFace().

◆ R_EmitCachedEdge()

void R_EmitCachedEdge ( void  )

Definition at line 502 of file r_rast.c.

503 {
504  edge_t *pedge_t;
505 
506  pedge_t = (edge_t *)((intptr_t)r_edges + r_pedge->cachededgeoffset);
507 
508  if (!pedge_t->surfs[0])
509  pedge_t->surfs[0] = surface_p - surfaces;
510  else
511  pedge_t->surfs[1] = surface_p - surfaces;
512 
513  if (pedge_t->nearzi > r_nearzi) // for mipmap finding
514  r_nearzi = pedge_t->nearzi;
515 
516  r_emitted = 1;
517 }

Referenced by R_RenderFace().

◆ R_EmitEdge()

void R_EmitEdge ( mvertex_t pv0,
mvertex_t pv1 
)

Definition at line 219 of file r_rast.c.

220 {
221  edge_t *edge, *pcheck;
222  int u_check;
223  float u, u_step;
225  float *world;
226  int v, v2, ceilv0;
227  float scale, lzi0, u0, v0;
228  int side;
229 
230  if (r_lastvertvalid)
231  {
232  u0 = r_u1;
233  v0 = r_v1;
234  lzi0 = r_lzi1;
235  ceilv0 = r_ceilv1;
236  }
237  else
238  {
239  world = &pv0->position[0];
240 
241  // transform and project
244 
245  if (transformed[2] < NEAR_CLIP)
246  transformed[2] = NEAR_CLIP;
247 
248  lzi0 = 1.0 / transformed[2];
249 
250  // FIXME: build x/yscale into transform?
251  scale = xscale * lzi0;
252  u0 = (xcenter + scale*transformed[0]);
253  if (u0 < r_refdef.fvrectx_adj)
254  u0 = r_refdef.fvrectx_adj;
255  if (u0 > r_refdef.fvrectright_adj)
257 
258  scale = yscale * lzi0;
259  v0 = (ycenter - scale*transformed[1]);
260  if (v0 < r_refdef.fvrecty_adj)
261  v0 = r_refdef.fvrecty_adj;
262  if (v0 > r_refdef.fvrectbottom_adj)
264 
265  ceilv0 = (int) ceil(v0);
266  }
267 
268  world = &pv1->position[0];
269 
270 // transform and project
273 
274  if (transformed[2] < NEAR_CLIP)
275  transformed[2] = NEAR_CLIP;
276 
277  r_lzi1 = 1.0 / transformed[2];
278 
279  scale = xscale * r_lzi1;
280  r_u1 = (xcenter + scale*transformed[0]);
281  if (r_u1 < r_refdef.fvrectx_adj)
285 
286  scale = yscale * r_lzi1;
287  r_v1 = (ycenter - scale*transformed[1]);
288  if (r_v1 < r_refdef.fvrecty_adj)
292 
293  if (r_lzi1 > lzi0)
294  lzi0 = r_lzi1;
295 
296  if (lzi0 > r_nearzi) // for mipmap finding
297  r_nearzi = lzi0;
298 
299 // for right edges, all we want is the effect on 1/z
300  if (r_nearzionly)
301  return;
302 
303  r_emitted = 1;
304 
305  r_ceilv1 = (int) ceil(r_v1);
306 
307 
308 // create the edge
309  if (ceilv0 == r_ceilv1)
310  {
311  // we cache unclipped horizontal edges as fully clipped
312  if (cacheoffset != 0x7FFFFFFF)
313  {
316  }
317 
318  return; // horizontal edge
319  }
320 
321  side = ceilv0 > r_ceilv1;
322 
323  edge = edge_p++;
324 
325  edge->owner = r_pedge;
326 
327  edge->nearzi = lzi0;
328 
329  if (side == 0)
330  {
331  // trailing edge (go from p1 to p2)
332  v = ceilv0;
333  v2 = r_ceilv1 - 1;
334 
335  edge->surfs[0] = surface_p - surfaces;
336  edge->surfs[1] = 0;
337 
338  u_step = ((r_u1 - u0) / (r_v1 - v0));
339  u = u0 + ((float)v - v0) * u_step;
340  }
341  else
342  {
343  // leading edge (go from p2 to p1)
344  v2 = ceilv0 - 1;
345  v = r_ceilv1;
346 
347  edge->surfs[0] = 0;
348  edge->surfs[1] = surface_p - surfaces;
349 
350  u_step = ((u0 - r_u1) / (v0 - r_v1));
351  u = r_u1 + ((float)v - r_v1) * u_step;
352  }
353 
354  edge->u_step = u_step*0x100000;
355  edge->u = u*0x100000 + 0xFFFFF;
356 
357 // we need to do this to avoid stepping off the edges if a very nearly
358 // horizontal edge is less than epsilon above a scan, and numeric error causes
359 // it to incorrectly extend to the scan, and the extension of the line goes off
360 // the edge of the screen
361 // FIXME: is this actually needed?
362  if (edge->u < r_refdef.vrect_x_adj_shift20)
364  if (edge->u > r_refdef.vrectright_adj_shift20)
366 
367 //
368 // sort the edge in normally
369 //
370  u_check = edge->u;
371  if (edge->surfs[0])
372  u_check++; // sort trailers after leaders
373 
374  if (!newedges[v] || newedges[v]->u >= u_check)
375  {
376  edge->next = newedges[v];
377  newedges[v] = edge;
378  }
379  else
380  {
381  pcheck = newedges[v];
382  while (pcheck->next && pcheck->next->u < u_check)
383  pcheck = pcheck->next;
384  edge->next = pcheck->next;
385  pcheck->next = edge;
386  }
387 
388  edge->nextremove = removeedges[v2];
389  removeedges[v2] = edge;
390 }

Referenced by R_ClipEdge().

◆ R_EmitSkyBox()

void R_EmitSkyBox ( void  )

Definition at line 170 of file r_rast.c.

171 {
172  int i, j;
173  int oldkey;
174 
175  if (insubmodel)
176  return; // submodels should never have skies
177  if (r_skyframe == r_framecount)
178  return; // already set this frame
179 
181 
182  // set the eight fake vertexes
183  for (i=0 ; i<8 ; i++)
184  for (j=0 ; j<3 ; j++)
185  r_skyverts[i].position[j] = r_origin[j] + box_verts[i][j]*128;
186 
187  // set the six fake planes
188  for (i=0 ; i<6 ; i++)
189  if (skybox_planes[i*2+1] > 0)
191  else
193 
194  // fix texture offseets
195  for (i=0 ; i<6 ; i++)
196  {
197  r_skytexinfo[i].vecs[0][3] = -DotProduct (r_origin, r_skytexinfo[i].vecs[0]);
198  r_skytexinfo[i].vecs[1][3] = -DotProduct (r_origin, r_skytexinfo[i].vecs[1]);
199  }
200 
201  // emit the six faces
202  oldkey = r_currentkey;
203  r_currentkey = 0x7ffffff0;
204  for (i=0 ; i<6 ; i++)
205  {
206  R_RenderFace (r_skyfaces + i, 15);
207  }
208  r_currentkey = oldkey; // bsp sorting order
209 }

Referenced by R_RenderFace().

◆ R_InitSkyBox()

void R_InitSkyBox ( void  )

Definition at line 113 of file r_rast.c.

114 {
115  int i;
116  extern model_t *loadmodel;
117 
119  loadmodel->numsurfaces += 6;
121  loadmodel->numvertexes += 8;
123  loadmodel->numedges += 12;
125  loadmodel->numsurfedges += 24;
129  ri.Sys_Error (ERR_DROP, "InitSkyBox: map overflow");
130 
131  memset (r_skyfaces, 0, 6*sizeof(*r_skyfaces));
132  for (i=0 ; i<6 ; i++)
133  {
135  r_skyplanes[i].dist = skybox_planes[i*2+1];
136 
137  VectorCopy (box_vecs[i][0], r_skytexinfo[i].vecs[0]);
138  VectorCopy (box_vecs[i][1], r_skytexinfo[i].vecs[1]);
139 
141  r_skyfaces[i].numedges = 4;
145  r_skyfaces[i].texturemins[0] = -128;
146  r_skyfaces[i].texturemins[1] = -128;
147  r_skyfaces[i].extents[0] = 256;
148  r_skyfaces[i].extents[1] = 256;
149  }
150 
151  for (i=0 ; i<24 ; i++)
152  if (box_surfedges[i] > 0)
154  else
156 
157  for(i=0 ; i<12 ; i++)
158  {
159  r_skyedges[i].v[0] = loadmodel->numvertexes-9+box_edges[i*2+0];
160  r_skyedges[i].v[1] = loadmodel->numvertexes-9+box_edges[i*2+1];
162  }
163 }

Referenced by Mod_LoadBrushModel().

◆ R_RenderBmodelFace()

void R_RenderBmodelFace ( bedge_t pedges,
msurface_t psurf 
)

Definition at line 738 of file r_rast.c.

739 {
740  int i;
741  unsigned mask;
742  mplane_t *pplane;
743  float distinv;
744  vec3_t p_normal;
745  medge_t tedge;
746  clipplane_t *pclip;
747 
748  if (psurf->texinfo->flags & (SURF_TRANS33|SURF_TRANS66))
749  {
751  r_alpha_surfaces = psurf;
752  return;
753  }
754 
755 // skip out if no more surfs
756  if (surface_p >= surf_max)
757  {
758  r_outofsurfaces++;
759  return;
760  }
761 
762 // ditto if not enough edges left, or switch to auxedges if possible
763  if ((edge_p + psurf->numedges + 4) >= edge_max)
764  {
765  r_outofedges += psurf->numedges;
766  return;
767  }
768 
769  c_faceclip++;
770 
771 // this is a dummy to give the caching mechanism someplace to write to
772  r_pedge = &tedge;
773 
774 // set up clip planes
775  pclip = NULL;
776 
777  for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
778  {
779  if (r_clipflags & mask)
780  {
781  view_clipplanes[i].next = pclip;
782  pclip = &view_clipplanes[i];
783  }
784  }
785 
786 // push the edges through
787  r_emitted = 0;
788  r_nearzi = 0;
789  r_nearzionly = false;
790  makeleftedge = makerightedge = false;
791 // FIXME: keep clipped bmodel edges in clockwise order so last vertex caching
792 // can be used?
793  r_lastvertvalid = false;
794 
795  for ( ; pedges ; pedges = pedges->pnext)
796  {
797  r_leftclipped = r_rightclipped = false;
798  R_ClipEdge (pedges->v[0], pedges->v[1], pclip);
799 
800  if (r_leftclipped)
801  makeleftedge = true;
802  if (r_rightclipped)
803  makerightedge = true;
804  }
805 
806 // if there was a clip off the left edge, add that edge too
807 // FIXME: faster to do in screen space?
808 // FIXME: share clipped edges?
809  if (makeleftedge)
810  {
811  r_pedge = &tedge;
812  R_ClipEdge (&r_leftexit, &r_leftenter, pclip->next);
813  }
814 
815 // if there was a clip off the right edge, get the right r_nearzi
816  if (makerightedge)
817  {
818  r_pedge = &tedge;
819  r_nearzionly = true;
821  }
822 
823 // if no edges made it out, return without posting the surface
824  if (!r_emitted)
825  return;
826 
827  r_polycount++;
828 
829  surface_p->msurf = psurf;
831  surface_p->flags = psurf->flags;
832  surface_p->insubmodel = true;
833  surface_p->spanstate = 0;
836  surface_p->spans = NULL;
837 
838  pplane = psurf->plane;
839 // FIXME: cache this?
840  TransformVector (pplane->normal, p_normal);
841 // FIXME: cache this?
842  distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal));
843 
844  surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv;
845  surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv;
846  surface_p->d_ziorigin = p_normal[2] * distinv -
849 
850  surface_p++;
851 }

Referenced by R_DrawSolidClippedSubmodelPolygons(), and R_RecursiveClipBPoly().

◆ R_RenderFace()

void R_RenderFace ( msurface_t fa,
int  clipflags 
)

Definition at line 525 of file r_rast.c.

526 {
527  int i, lindex;
528  unsigned mask;
529  mplane_t *pplane;
530  float distinv;
531  vec3_t p_normal;
532  medge_t *pedges, tedge;
533  clipplane_t *pclip;
534 
535  // translucent surfaces are not drawn by the edge renderer
536  if (fa->texinfo->flags & (SURF_TRANS33|SURF_TRANS66))
537  {
539  r_alpha_surfaces = fa;
540  return;
541  }
542 
543  // sky surfaces encountered in the world will cause the
544  // environment box surfaces to be emited
545  if ( fa->texinfo->flags & SURF_SKY )
546  {
547  R_EmitSkyBox ();
548  return;
549  }
550 
551 // skip out if no more surfs
552  if ((surface_p) >= surf_max)
553  {
554  r_outofsurfaces++;
555  return;
556  }
557 
558 // ditto if not enough edges left, or switch to auxedges if possible
559  if ((edge_p + fa->numedges + 4) >= edge_max)
560  {
561  r_outofedges += fa->numedges;
562  return;
563  }
564 
565  c_faceclip++;
566 
567 // set up clip planes
568  pclip = NULL;
569 
570  for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
571  {
572  if (clipflags & mask)
573  {
574  view_clipplanes[i].next = pclip;
575  pclip = &view_clipplanes[i];
576  }
577  }
578 
579 // push the edges through
580  r_emitted = 0;
581  r_nearzi = 0;
582  r_nearzionly = false;
583  makeleftedge = makerightedge = false;
584  pedges = currentmodel->edges;
585  r_lastvertvalid = false;
586 
587  for (i=0 ; i<fa->numedges ; i++)
588  {
589  lindex = currentmodel->surfedges[fa->firstedge + i];
590 
591  if (lindex > 0)
592  {
593  r_pedge = &pedges[lindex];
594 
595  // if the edge is cached, we can just reuse the edge
596  if (!insubmodel)
597  {
599  {
601  r_framecount)
602  {
603  r_lastvertvalid = false;
604  continue;
605  }
606  }
607  else
608  {
609  if ((((intptr_t)edge_p - (intptr_t)r_edges) >
611  (((edge_t *)((intptr_t)r_edges +
612  r_pedge->cachededgeoffset))->owner == r_pedge))
613  {
614  R_EmitCachedEdge ();
615  r_lastvertvalid = false;
616  continue;
617  }
618  }
619  }
620 
621  // assume it's cacheable
622  cacheoffset = (byte *)edge_p - (byte *)r_edges;
623  r_leftclipped = r_rightclipped = false;
626  pclip);
628 
629  if (r_leftclipped)
630  makeleftedge = true;
631  if (r_rightclipped)
632  makerightedge = true;
633  r_lastvertvalid = true;
634  }
635  else
636  {
637  lindex = -lindex;
638  r_pedge = &pedges[lindex];
639  // if the edge is cached, we can just reuse the edge
640  if (!insubmodel)
641  {
643  {
645  r_framecount)
646  {
647  r_lastvertvalid = false;
648  continue;
649  }
650  }
651  else
652  {
653  // it's cached if the cached edge is valid and is owned
654  // by this medge_t
655  if ((((intptr_t)edge_p - (intptr_t)r_edges) >
657  (((edge_t *)((intptr_t)r_edges +
658  r_pedge->cachededgeoffset))->owner == r_pedge))
659  {
660  R_EmitCachedEdge ();
661  r_lastvertvalid = false;
662  continue;
663  }
664  }
665  }
666 
667  // assume it's cacheable
668  cacheoffset = (byte *)edge_p - (byte *)r_edges;
669  r_leftclipped = r_rightclipped = false;
672  pclip);
674 
675  if (r_leftclipped)
676  makeleftedge = true;
677  if (r_rightclipped)
678  makerightedge = true;
679  r_lastvertvalid = true;
680  }
681  }
682 
683 // if there was a clip off the left edge, add that edge too
684 // FIXME: faster to do in screen space?
685 // FIXME: share clipped edges?
686  if (makeleftedge)
687  {
688  r_pedge = &tedge;
689  r_lastvertvalid = false;
690  R_ClipEdge (&r_leftexit, &r_leftenter, pclip->next);
691  }
692 
693 // if there was a clip off the right edge, get the right r_nearzi
694  if (makerightedge)
695  {
696  r_pedge = &tedge;
697  r_lastvertvalid = false;
698  r_nearzionly = true;
700  }
701 
702 // if no edges made it out, return without posting the surface
703  if (!r_emitted)
704  return;
705 
706  r_polycount++;
707 
708  surface_p->msurf = fa;
710  surface_p->flags = fa->flags;
712  surface_p->spanstate = 0;
715  surface_p->spans = NULL;
716 
717  pplane = fa->plane;
718 // FIXME: cache this?
719  TransformVector (pplane->normal, p_normal);
720 // FIXME: cache this?
721  distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal));
722 
723  surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv;
724  surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv;
725  surface_p->d_ziorigin = p_normal[2] * distinv -
728 
729  surface_p++;
730 }

Referenced by R_DrawSubmodelPolygons(), R_EmitSkyBox(), and R_RecursiveWorldNode().

Variable Documentation

◆ blanktable

int blanktable[4200]

Definition at line 49 of file r_rast.c.

Referenced by NonTurbulent8(), R_InitTurb(), and R_PolygonDrawSpans().

◆ box_edges

int box_edges[24] = { 1,2, 2,3, 3,4, 4,1, 1,5, 5,6, 6,2, 7,8, 8,6, 5,7, 8,3, 7,4}

Definition at line 80 of file r_rast.c.

Referenced by R_InitSkyBox().

◆ box_faces

int box_faces[6] = {0,0,2,2,2,0}

Definition at line 82 of file r_rast.c.

Referenced by R_InitSkyBox().

◆ box_surfedges

int box_surfedges[24]
Initial value:
= { 1,2,3,4, -1,5,6,7, 8,9,-6,10, -2,-7,-9,11,
12,-3,-11,-8, -12,-10,-5,-4}

Definition at line 78 of file r_rast.c.

Referenced by R_InitSkyBox().

◆ box_vecs

vec3_t box_vecs[6][2]
Initial value:
= {
{ {0,-1,0}, {-1,0,0} },
{ {0,1,0}, {0,0,-1} },
{ {0,-1,0}, {1,0,0} },
{ {1,0,0}, {0,0,-1} },
{ {0,-1,0}, {0,0,-1} },
{ {-1,0,0}, {0,0,-1} }
}

Definition at line 84 of file r_rast.c.

Referenced by R_InitSkyBox().

◆ box_verts

float box_verts[8][3]
Initial value:
= {
{-1,-1,-1},
{-1,1,-1},
{1,1,-1},
{1,-1,-1},
{-1,-1,1},
{-1,1,1},
{1,-1,1},
{1,1,1}
}

Definition at line 93 of file r_rast.c.

Referenced by R_EmitSkyBox().

◆ c_faceclip

int c_faceclip

Definition at line 34 of file r_rast.c.

Referenced by R_PrintTimes(), R_RenderBmodelFace(), R_RenderFace(), and R_SetupFrame().

◆ cacheoffset

unsigned int cacheoffset

Definition at line 32 of file r_rast.c.

Referenced by R_ClipEdge(), R_EmitEdge(), and R_RenderFace().

◆ entity_clipplanes

clipplane_t* entity_clipplanes

Definition at line 37 of file r_rast.c.

◆ intsintable

int intsintable[4200]

Definition at line 48 of file r_rast.c.

Referenced by D_WarpScreen(), and R_InitTurb().

◆ makeleftedge

qboolean makeleftedge
static

Definition at line 44 of file r_rast.c.

Referenced by R_RenderBmodelFace(), and R_RenderFace().

◆ makerightedge

qboolean makerightedge
static

Definition at line 44 of file r_rast.c.

Referenced by R_RenderBmodelFace(), and R_RenderFace().

◆ r_ceilv1

int r_ceilv1

Definition at line 63 of file r_rast.c.

Referenced by R_EmitEdge().

◆ r_emitted

int r_emitted

Definition at line 60 of file r_rast.c.

Referenced by R_EmitCachedEdge(), R_EmitEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_lastvertvalid

qboolean r_lastvertvalid

Definition at line 65 of file r_rast.c.

Referenced by R_ClipEdge(), R_EmitEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_leftclipped

qboolean r_leftclipped

Definition at line 43 of file r_rast.c.

Referenced by R_ClipEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_leftenter

mvertex_t r_leftenter

Definition at line 51 of file r_rast.c.

Referenced by R_ClipEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_leftexit

mvertex_t r_leftexit

Definition at line 51 of file r_rast.c.

Referenced by R_ClipEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_lzi1

float r_lzi1

Definition at line 62 of file r_rast.c.

Referenced by R_EmitEdge().

◆ r_nearzi

float r_nearzi

Definition at line 61 of file r_rast.c.

Referenced by R_EmitCachedEdge(), R_EmitEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_nearzionly

qboolean r_nearzionly

Definition at line 45 of file r_rast.c.

Referenced by R_EmitEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_pedge

◆ r_rightclipped

qboolean r_rightclipped

Definition at line 43 of file r_rast.c.

Referenced by R_ClipEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_rightenter

mvertex_t r_rightenter

Definition at line 52 of file r_rast.c.

Referenced by R_ClipEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_rightexit

mvertex_t r_rightexit

Definition at line 52 of file r_rast.c.

Referenced by R_ClipEdge(), R_RenderBmodelFace(), and R_RenderFace().

◆ r_skyedges

medge_t* r_skyedges

Definition at line 72 of file r_rast.c.

Referenced by R_InitSkyBox().

◆ r_skyfaces

msurface_t* r_skyfaces

Definition at line 68 of file r_rast.c.

Referenced by R_EmitSkyBox(), and R_InitSkyBox().

◆ r_skyframe

int r_skyframe

Definition at line 66 of file r_rast.c.

Referenced by R_EmitSkyBox().

◆ r_skyplanes

mplane_t r_skyplanes[6]

Definition at line 69 of file r_rast.c.

Referenced by R_EmitSkyBox(), and R_InitSkyBox().

◆ r_skysurfedges

int* r_skysurfedges

Definition at line 73 of file r_rast.c.

Referenced by R_InitSkyBox().

◆ r_skytexinfo

mtexinfo_t r_skytexinfo[6]

Definition at line 70 of file r_rast.c.

Referenced by R_EmitSkyBox(), R_InitSkyBox(), and R_SetSky().

◆ r_skyverts

mvertex_t* r_skyverts

Definition at line 71 of file r_rast.c.

Referenced by R_EmitSkyBox(), and R_InitSkyBox().

◆ r_u1

float r_u1

Definition at line 62 of file r_rast.c.

Referenced by R_EmitEdge().

◆ r_v1

float r_v1

Definition at line 62 of file r_rast.c.

Referenced by R_EmitEdge().

◆ sintable

int sintable[4200]

Definition at line 47 of file r_rast.c.

Referenced by R_InitTurb(), R_PolygonDrawSpans(), and Turbulent8().

◆ skybox_planes

int skybox_planes[12] = {2,-128, 0,-128, 2,128, 1,128, 0,128, 1,-128}

Definition at line 76 of file r_rast.c.

Referenced by R_EmitSkyBox(), and R_InitSkyBox().

◆ view_clipplanes

◆ world_clipplanes

clipplane_t world_clipplanes[16]

Definition at line 39 of file r_rast.c.

box_faces
int box_faces[6]
Definition: r_rast.c:82
model_s::numvertexes
int numvertexes
Definition: r_model.h:207
box_surfedges
int box_surfedges[24]
Definition: r_rast.c:78
currentmodel
model_t * currentmodel
Definition: r_main.c:39
r_framecount
int r_framecount
Definition: r_main.c:97
msurface_s::plane
mplane_t * plane
Definition: r_model.h:100
oldrefdef_t::fvrectx_adj
float fvrectx_adj
Definition: r_local.h:126
r_leftexit
mvertex_t r_leftexit
Definition: r_rast.c:51
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
r_rightenter
mvertex_t r_rightenter
Definition: r_rast.c:52
transformed
static vec3_t transformed
Definition: r_part.c:468
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
MAX_MAP_EDGES
#define MAX_MAP_EDGES
Definition: qfiles.h:245
insubmodel
qboolean insubmodel
Definition: r_bsp.c:27
mvertex_t
Definition: r_model.h:45
r_emitted
int r_emitted
Definition: r_rast.c:60
R_EmitEdge
void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1)
Definition: r_rast.c:219
r_outofedges
int r_outofedges
Definition: r_main.c:58
ri
refimport_t ri
Definition: r_main.c:25
R_ClipEdge
void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
Definition: r_rast.c:398
r_skyfaces
msurface_t * r_skyfaces
Definition: r_rast.c:68
makeleftedge
static qboolean makeleftedge
Definition: r_rast.c:44
v
GLdouble v
Definition: qgl_win.c:143
yscaleinv
float yscaleinv
Definition: r_local.h:576
oldrefdef_t::vrectright_adj_shift20
int vrectright_adj_shift20
Definition: r_local.h:128
model_s::edges
medge_t * edges
Definition: r_model.h:211
r_skytexinfo
mtexinfo_t r_skytexinfo[6]
Definition: r_rast.c:70
surf_s::flags
int flags
Definition: r_local.h:439
i
int i
Definition: q_shared.c:305
msurface_s::numedges
int numedges
Definition: r_model.h:104
surf_max
surf_t * surf_max
Definition: r_edge.c:51
modelorg
vec3_t modelorg
Definition: r_bsp.c:29
r_currentkey
int r_currentkey
Definition: r_edge.c:62
model_s
Definition: r_model.h:171
r_u1
float r_u1
Definition: r_rast.c:62
r_origin
vec3_t r_origin
Definition: r_main.c:75
R_EmitCachedEdge
void R_EmitCachedEdge(void)
Definition: r_rast.c:502
R_EmitSkyBox
void R_EmitSkyBox(void)
Definition: r_rast.c:170
oldrefdef_t::fvrectright_adj
float fvrectright_adj
Definition: r_local.h:129
xscaleinv
float xscaleinv
Definition: r_main.c:83
edge_s::surfs
unsigned short surfs[2]
Definition: r_local.h:455
c_faceclip
int c_faceclip
Definition: r_rast.c:34
currententity
entity_t * currententity
Definition: r_bsp.c:28
mplane_s::normal
vec3_t normal
Definition: r_model.h:59
msurface_s::extents
short extents[2]
Definition: r_model.h:110
box_vecs
vec3_t box_vecs[6][2]
Definition: r_rast.c:84
SURF_TRANS66
#define SURF_TRANS66
Definition: qfiles.h:374
clipplane_s::normal
vec3_t normal
Definition: r_local.h:380
j
GLint j
Definition: qgl_win.c:150
surf_s::spans
struct espan_s * spans
Definition: r_local.h:432
mvertex_t::position
vec3_t position
Definition: r_model.h:47
edge_p
edge_t * edge_p
Definition: r_edge.c:49
r_leftclipped
qboolean r_leftclipped
Definition: r_rast.c:43
edge_s::next
struct edge_s * next
Definition: r_local.h:454
model_s::numedges
int numedges
Definition: r_model.h:210
oldrefdef_t::fvrecty_adj
float fvrecty_adj
Definition: r_local.h:126
u
static int u
Definition: r_part.c:472
bedge_s::pnext
struct bedge_s * pnext
Definition: r_local.h:373
r_skyedges
medge_t * r_skyedges
Definition: r_rast.c:72
r_edges
edge_t * r_edges
Definition: r_edge.c:49
surf_s::entity
entity_t * entity
Definition: r_local.h:441
FRAMECOUNT_MASK
#define FRAMECOUNT_MASK
Definition: r_rast.c:30
medge_t
Definition: r_model.h:77
mplane_s::dist
float dist
Definition: r_model.h:60
r_polycount
int r_polycount
Definition: r_main.c:100
clipplane_s::leftedge
byte leftedge
Definition: r_local.h:383
v2
GLdouble GLdouble GLint GLint GLdouble GLdouble v2
Definition: qgl_win.c:227
edge_s::u_step
fixed16_t u_step
Definition: r_local.h:453
clipplane_s::rightedge
byte rightedge
Definition: r_local.h:384
r_skyverts
mvertex_t * r_skyverts
Definition: r_rast.c:71
model_s::numsurfedges
int numsurfedges
Definition: r_model.h:223
msurface_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:112
R_RenderFace
void R_RenderFace(msurface_t *fa, int clipflags)
Definition: r_rast.c:525
oldrefdef_t::fvrectbottom_adj
float fvrectbottom_adj
Definition: r_local.h:129
edge_s::owner
medge_t * owner
Definition: r_local.h:458
medge_t::cachededgeoffset
unsigned int cachededgeoffset
Definition: r_model.h:80
r_rightexit
mvertex_t r_rightexit
Definition: r_rast.c:52
surf_s::nearzi
float nearzi
Definition: r_local.h:442
refimport_t::Sys_Error
void(* Sys_Error)(int err_level, char *str,...)
Definition: ref.h:194
r_clipflags
int r_clipflags
Definition: r_main.c:67
surf_s::msurf
msurface_t * msurf
Definition: r_local.h:440
edge_max
edge_t * edge_max
Definition: r_edge.c:49
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:162
SURF_TRANS33
#define SURF_TRANS33
Definition: qfiles.h:373
edge_s::nearzi
float nearzi
Definition: r_local.h:457
r_ceilv1
int r_ceilv1
Definition: r_rast.c:63
clipplane_s::next
struct clipplane_s * next
Definition: r_local.h:382
makerightedge
static qboolean makerightedge
Definition: r_rast.c:44
r_currentbkey
int r_currentbkey
Definition: r_bsp.c:36
xscale
float xscale
Definition: r_main.c:82
r_skysurfedges
int * r_skysurfedges
Definition: r_rast.c:73
r_nearzionly
qboolean r_nearzionly
Definition: r_rast.c:45
r_outofsurfaces
int r_outofsurfaces
Definition: r_main.c:57
clipplane_s
Definition: r_local.h:378
edge_s::u
fixed16_t u
Definition: r_local.h:452
NULL
#define NULL
Definition: q_shared.h:67
MAX_MAP_FACES
#define MAX_MAP_FACES
Definition: qfiles.h:241
edge_s::nextremove
struct edge_s * nextremove
Definition: r_local.h:456
model_s::surfedges
int * surfedges
Definition: r_model.h:224
r_alpha_surfaces
msurface_t * r_alpha_surfaces
Definition: r_poly.c:47
surface_p
surf_t * surface_p
Definition: r_edge.c:51
FULLY_CLIPPED_CACHED
#define FULLY_CLIPPED_CACHED
Definition: r_rast.c:29
ycenter
float ycenter
Definition: r_local.h:574
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
SURF_DRAWSKYBOX
#define SURF_DRAWSKYBOX
Definition: r_model.h:72
surf_s::key
int key
Definition: r_local.h:433
cacheoffset
unsigned int cacheoffset
Definition: r_rast.c:32
r_v1
float r_v1
Definition: r_rast.c:62
msurface_s::flags
int flags
Definition: r_model.h:101
surf_s::d_zistepv
float d_zistepv
Definition: r_local.h:444
surf_s::d_zistepu
float d_zistepu
Definition: r_local.h:444
r_pedge
medge_t * r_pedge
Definition: r_rast.c:41
r_rightclipped
qboolean r_rightclipped
Definition: r_rast.c:43
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
surf_s::d_ziorigin
float d_ziorigin
Definition: r_local.h:444
mtexinfo_s::vecs
float vecs[2][4]
Definition: r_model.h:85
removeedges
edge_t * removeedges[MAXHEIGHT]
Definition: r_edge.c:58
MAX_MAP_VERTS
#define MAX_MAP_VERTS
Definition: qfiles.h:240
r_lzi1
float r_lzi1
Definition: r_rast.c:62
world
#define world
Definition: g_local.h:556
box_verts
float box_verts[8][3]
Definition: r_rast.c:93
bedge_s::v
mvertex_t * v[2]
Definition: r_local.h:372
surf_s::insubmodel
qboolean insubmodel
Definition: r_local.h:443
newedges
edge_t * newedges[MAXHEIGHT]
Definition: r_edge.c:57
model_s::surfaces
msurface_t * surfaces
Definition: r_model.h:221
medge_t::v
unsigned short v[2]
Definition: r_model.h:79
r_nearzi
float r_nearzi
Definition: r_rast.c:61
local
static vec3_t local
Definition: r_part.c:468
NEAR_CLIP
#define NEAR_CLIP
Definition: asm_draw.h:13
r_lastvertvalid
qboolean r_lastvertvalid
Definition: r_rast.c:65
r_leftenter
mvertex_t r_leftenter
Definition: r_rast.c:51
mplane_s
Definition: r_model.h:57
mtexinfo_s::flags
int flags
Definition: r_model.h:88
oldrefdef_t::vrect_x_adj_shift20
int vrect_x_adj_shift20
Definition: r_local.h:127
msurface_s::texturemins
short texturemins[2]
Definition: r_model.h:109
clipplane_s::dist
float dist
Definition: r_local.h:381
r_skyplanes
mplane_t r_skyplanes[6]
Definition: r_rast.c:69
mask
GLint GLuint mask
Definition: qgl_win.c:317
model_s::vertexes
mvertex_t * vertexes
Definition: r_model.h:208
msurface_s::nextalphasurface
struct msurface_s * nextalphasurface
Definition: r_model.h:118
xcenter
float xcenter
Definition: r_main.c:81
loadmodel
model_t * loadmodel
Definition: r_model.c:27
box_edges
int box_edges[24]
Definition: r_rast.c:80
TransformVector
void TransformVector(vec3_t in, vec3_t out)
Definition: r_misc.c:216
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
r_pcurrentvertbase
mvertex_t * r_pcurrentvertbase
Definition: r_main.c:62
surfaces
surf_t * surfaces
Definition: r_edge.c:51
yscale
float yscale
Definition: r_local.h:575
r_refdef
oldrefdef_t r_refdef
Definition: r_main.c:80
view_clipplanes
clipplane_t view_clipplanes[4]
Definition: r_rast.c:38
msurface_s::firstedge
int firstedge
Definition: r_model.h:103
r_skyframe
int r_skyframe
Definition: r_rast.c:66
SURF_SKY
#define SURF_SKY
Definition: qfiles.h:371
edge_s
Definition: r_local.h:450
surf_s::spanstate
int spanstate
Definition: r_local.h:435
model_s::numsurfaces
int numsurfaces
Definition: r_model.h:220
skybox_planes
int skybox_planes[12]
Definition: r_rast.c:76