Quake II RTX doxygen  1.0 dev
sw.h File Reference
#include "shared/shared.h"
#include "common/bsp.h"
#include "common/cmd.h"
#include "common/common.h"
#include "common/cvar.h"
#include "common/files.h"
#include "common/math.h"
#include "client/client.h"
#include "client/video.h"
#include "refresh/refresh.h"
#include "refresh/images.h"
#include "refresh/models.h"
#include "system/system.h"

Go to the source code of this file.

Classes

struct  viddef_t
 
struct  oldrefdef_t
 
struct  emitpoint_t
 
struct  finalvert_s
 
struct  affinetridesc_t
 
struct  drawsurf_s
 
struct  bedge_s
 
struct  clipplane_s
 
struct  surfcache_s
 
struct  espan_s
 
struct  polydesc_t
 
struct  surf_s
 
struct  edge_s
 
struct  maliasst_s
 
struct  maliastri_s
 
struct  maliasvert_s
 
struct  maliasframe_s
 
struct  aliastriangleparms_t
 

Macros

#define REF_VERSION   "SOFT 0.01"
 
#define DSURF_SKY   2
 
#define DSURF_TURB   4
 
#define DSURF_BACKGROUND   8
 
#define CACHE_SIZE   32
 
#define VID_BYTES   4
 
#define TEX_BYTES   4
 
#define MAXVERTS   64
 
#define MAXWORKINGVERTS   (MAXVERTS + 4)
 
#define MAXHEIGHT   1200
 
#define MAXWIDTH   1600
 
#define INFINITE_DISTANCE   0x10000
 
#define WARP_WIDTH   320
 
#define WARP_HEIGHT   240
 
#define PARTICLE_Z_CLIP   8.0
 
#define TRANSPARENT_COLOR   0xFF
 
#define TURB_SIZE   64
 
#define TURB_MASK   (TURB_SIZE - 1)
 
#define CYCLE   128
 
#define DS_SPAN_LIST_END   -128
 
#define NUMSTACKEDGES   3000
 
#define MINEDGES   NUMSTACKEDGES
 
#define MAXEDGES   30000
 
#define NUMSTACKSURFACES   1000
 
#define MINSURFACES   NUMSTACKSURFACES
 
#define MAXSURFACES   10000
 
#define MAXSPANS   3000
 
#define ALIAS_LEFT_CLIP   0x0001
 
#define ALIAS_TOP_CLIP   0x0002
 
#define ALIAS_RIGHT_CLIP   0x0004
 
#define ALIAS_BOTTOM_CLIP   0x0008
 
#define ALIAS_Z_CLIP   0x0010
 
#define ALIAS_XY_CLIP_MASK   0x000F
 
#define SURFCACHE_SIZE_AT_320X240   1024*768
 
#define BMODEL_FULLY_CLIPPED   0x10
 
#define CLIP_EPSILON   0.001
 
#define BACKFACE_EPSILON   0.01
 
#define NEAR_CLIP   0.01
 
#define ALIAS_Z_CLIP_PLANE   4
 
#define AMP   8*0x10000
 
#define AMP2   3
 
#define SPEED   20
 
#define MAX_BLOCKLIGHTS   1024
 
#define LIGHTMAP_BYTES   3
 

Typedefs

typedef unsigned char pixel_t
 
typedef struct finalvert_s finalvert_t
 
typedef struct drawsurf_s drawsurf_t
 
typedef struct bedge_s bedge_t
 
typedef struct clipplane_s clipplane_t
 
typedef int blocklight_t
 
typedef struct surfcache_s surfcache_t
 
typedef struct espan_s espan_t
 
typedef struct surf_s surf_t
 
typedef struct edge_s edge_t
 
typedef struct maliasst_s maliasst_t
 
typedef struct maliastri_s maliastri_t
 
typedef struct maliasvert_s maliasvert_t
 
typedef struct maliasframe_s maliasframe_t
 

Functions

void D_DrawSurfaces (void)
 
void D_WarpScreen (void)
 
void D_DrawTurbulent16 (espan_t *pspan, int *warptable)
 
void D_DrawSpans16 (espan_t *pspans)
 
void D_DrawZSpans (espan_t *pspans)
 
surfcache_tD_CacheSurface (mface_t *surface, int miplevel)
 
void R_TransformVector (vec3_t in, vec3_t out)
 
void R_RenderWorld (void)
 
void R_DrawAlphaSurfaces (void)
 
void R_DrawSprite (void)
 
void R_DrawBeam (entity_t *e)
 
void R_RenderFace (mface_t *fa, int clipflags)
 
void R_RenderBmodelFace (bedge_t *pedges, mface_t *psurf)
 
void R_TransformPlane (cplane_t *p, float *normal, float *dist)
 
void R_TransformFrustum (void)
 
void R_DrawSubmodelPolygons (mmodel_t *pmodel, int clipflags, mnode_t *topnode)
 
void R_DrawSolidClippedSubmodelPolygons (mmodel_t *pmodel, mnode_t *topnode)
 
void R_AliasDrawModel (void)
 
void R_BeginEdgeFrame (void)
 
void R_ScanEdges (void)
 
void R_MarkLights (mnode_t *headnode)
 
void R_RotateBmodel (void)
 
void R_DrawParticles (void)
 
void R_DrawTriangle (void)
 
void R_AliasClipTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t *index2)
 
void R_AliasProjectAndClipTestFinalVert (finalvert_t *fv)
 
void R_PrintAliasStats (void)
 
void R_PrintTimes (void)
 
void R_LightPoint (vec3_t p, vec3_t color)
 
void R_SetupFrame (void)
 
void R_BuildLightMap (void)
 
void R_NewMap (void)
 
void R_InitCaches (void)
 
void R_FreeCaches (void)
 
void D_FlushCaches (void)
 
void D_SCDump_f (void)
 
void R_InitTurb (void)
 
void R_InitImages (void)
 
void R_ShutdownImages (void)
 
void R_BuildGammaTable (void)
 
void R_InitSkyBox (void)
 
void R_EmitSkyBox (void)
 
void R_ApplySIRDAlgorithum (void)
 
void R_IMFlatShadedQuad (vec3_t a, vec3_t b, vec3_t c, vec3_t d, color_t color, float alpha)
 
void R_InitDraw (void)
 

Variables

int r_framecount
 
qboolean r_dowarp
 
affinetridesc_t r_affinetridesc
 
drawsurf_t r_drawsurf
 
int c_surf
 
byte r_warpbuffer [WARP_WIDTH *WARP_HEIGHT *VID_BYTES]
 
float d_sdivzstepu
 
float d_tdivzstepu
 
float d_zistepu
 
float d_sdivzstepv
 
float d_tdivzstepv
 
float d_zistepv
 
float d_sdivzorigin
 
float d_tdivzorigin
 
float d_ziorigin
 
fixed16_t sadjust
 
fixed16_t tadjust
 
fixed16_t bbextents
 
fixed16_t bbextentt
 
pixel_td_viewbuffer
 
int d_screenrowbytes
 
short * d_pzbuffer
 
int d_zrowbytes
 
int d_zwidth
 
byte * d_spantable [MAXHEIGHT]
 
short * d_zspantable [MAXHEIGHT]
 
int d_minmip
 
float d_scalemip [3]
 
viddef_t vid
 
oldrefdef_t r_refdef
 
int cachewidth
 
pixel_tcacheblock
 
int r_drawnpolycount
 
int sintable [CYCLE *2]
 
int intsintable [CYCLE *2]
 
int blanktable [CYCLE *2]
 
vec3_t vup
 
vec3_t base_vup
 
vec3_t vpn
 
vec3_t base_vpn
 
vec3_t vright
 
vec3_t base_vright
 
surf_tauxsurfaces
 
surf_tsurfaces
 
surf_tsurface_p
 
surf_tsurf_max
 
vec3_t sxformaxis [4]
 
vec3_t txformaxis [4]
 
cvar_t * sw_aliasstats
 
cvar_t * sw_clearcolor
 
cvar_t * sw_drawflat
 
cvar_t * sw_draworder
 
cvar_t * sw_maxedges
 
cvar_t * sw_maxsurfs
 
cvar_t * sw_mipcap
 
cvar_t * sw_mipscale
 
cvar_t * sw_mode
 
cvar_t * sw_reportsurfout
 
cvar_t * sw_reportedgeout
 
cvar_t * sw_surfcacheoverride
 
cvar_t * sw_waterwarp
 
cvar_t * sw_drawsird
 
cvar_t * sw_dynamic
 
cvar_t * sw_modulate
 
cvar_t * r_fullbright
 
cvar_t * r_drawentities
 
cvar_t * r_drawworld
 
cvar_t * r_lerpmodels
 
cvar_t * r_speeds
 
cvar_t * vid_fullscreen
 
cvar_t * vid_gamma
 
clipplane_t view_clipplanes [4]
 
intpfrustum_indexes [4]
 
cplane_t screenedge [4]
 
vec3_t r_origin
 
entity_t r_worldentity
 
model_t * currentmodel
 
entity_t * currententity
 
vec3_t modelorg
 
vec3_t r_entorigin
 
vec3_t entity_rotation [3]
 
int r_visframecount
 
mface_t * r_alpha_surfaces
 
qboolean insubmodel
 
int c_faceclip
 
int r_polycount
 
int r_wholepolycount
 
mvertex_t * r_ptverts
 
mvertex_t * r_ptvertsmax
 
int r_currentkey
 
int r_currentbkey
 
int r_amodels_drawn
 
edge_tauxedges
 
int r_numallocatededges
 
edge_tr_edges
 
edge_tedge_p
 
edge_tedge_max
 
edge_tnewedges [MAXHEIGHT]
 
edge_tremoveedges [MAXHEIGHT]
 
fixed8_t r_aliasblendcolor [3]
 
int r_alias_alpha
 
int r_alias_one_minus_alpha
 
int r_outofsurfaces
 
int r_outofedges
 
int r_maxvalidedgeoffset
 
aliastriangleparms_t aliastriangleparms
 
float r_time1
 
int r_frustum_indexes [4 *6]
 
int r_maxsurfsseen
 
int r_maxedgesseen
 
int r_cnumsurfs
 
qboolean r_surfsonstack
 
mleaf_t * r_viewleaf
 
int r_viewcluster
 
int r_oldviewcluster
 
int r_clipflags
 
int r_dlightframecount
 
bsp_t * r_worldmodel
 
blocklight_t blocklights [MAX_BLOCKLIGHTS *LIGHTMAP_BYTES]
 
refdef_t r_newrefdef
 

Macro Definition Documentation

◆ ALIAS_BOTTOM_CLIP

#define ALIAS_BOTTOM_CLIP   0x0008

Definition at line 90 of file sw.h.

◆ ALIAS_LEFT_CLIP

#define ALIAS_LEFT_CLIP   0x0001

Definition at line 87 of file sw.h.

◆ ALIAS_RIGHT_CLIP

#define ALIAS_RIGHT_CLIP   0x0004

Definition at line 89 of file sw.h.

◆ ALIAS_TOP_CLIP

#define ALIAS_TOP_CLIP   0x0002

Definition at line 88 of file sw.h.

◆ ALIAS_XY_CLIP_MASK

#define ALIAS_XY_CLIP_MASK   0x000F

Definition at line 92 of file sw.h.

◆ ALIAS_Z_CLIP

#define ALIAS_Z_CLIP   0x0010

Definition at line 91 of file sw.h.

◆ ALIAS_Z_CLIP_PLANE

#define ALIAS_Z_CLIP_PLANE   4

Definition at line 105 of file sw.h.

◆ AMP

#define AMP   8*0x10000

Definition at line 108 of file sw.h.

◆ AMP2

#define AMP2   3

Definition at line 109 of file sw.h.

◆ BACKFACE_EPSILON

#define BACKFACE_EPSILON   0.01

Definition at line 101 of file sw.h.

◆ BMODEL_FULLY_CLIPPED

#define BMODEL_FULLY_CLIPPED   0x10

Definition at line 96 of file sw.h.

◆ CACHE_SIZE

#define CACHE_SIZE   32

Definition at line 47 of file sw.h.

◆ CLIP_EPSILON

#define CLIP_EPSILON   0.001

Definition at line 99 of file sw.h.

◆ CYCLE

#define CYCLE   128

Definition at line 74 of file sw.h.

◆ DS_SPAN_LIST_END

#define DS_SPAN_LIST_END   -128

Definition at line 76 of file sw.h.

◆ DSURF_BACKGROUND

#define DSURF_BACKGROUND   8

Definition at line 45 of file sw.h.

◆ DSURF_SKY

#define DSURF_SKY   2

Definition at line 43 of file sw.h.

◆ DSURF_TURB

#define DSURF_TURB   4

Definition at line 44 of file sw.h.

◆ INFINITE_DISTANCE

#define INFINITE_DISTANCE   0x10000

Definition at line 60 of file sw.h.

◆ LIGHTMAP_BYTES

#define LIGHTMAP_BYTES   3

Definition at line 203 of file sw.h.

◆ MAX_BLOCKLIGHTS

#define MAX_BLOCKLIGHTS   1024

Definition at line 202 of file sw.h.

◆ MAXEDGES

#define MAXEDGES   30000

Definition at line 80 of file sw.h.

◆ MAXHEIGHT

#define MAXHEIGHT   1200

Definition at line 57 of file sw.h.

◆ MAXSPANS

#define MAXSPANS   3000

Definition at line 84 of file sw.h.

◆ MAXSURFACES

#define MAXSURFACES   10000

Definition at line 83 of file sw.h.

◆ MAXVERTS

#define MAXVERTS   64

Definition at line 53 of file sw.h.

◆ MAXWIDTH

#define MAXWIDTH   1600

Definition at line 58 of file sw.h.

◆ MAXWORKINGVERTS

#define MAXWORKINGVERTS   (MAXVERTS + 4)

Definition at line 54 of file sw.h.

◆ MINEDGES

#define MINEDGES   NUMSTACKEDGES

Definition at line 79 of file sw.h.

◆ MINSURFACES

#define MINSURFACES   NUMSTACKSURFACES

Definition at line 82 of file sw.h.

◆ NEAR_CLIP

#define NEAR_CLIP   0.01

Definition at line 103 of file sw.h.

◆ NUMSTACKEDGES

#define NUMSTACKEDGES   3000

Definition at line 78 of file sw.h.

◆ NUMSTACKSURFACES

#define NUMSTACKSURFACES   1000

Definition at line 81 of file sw.h.

◆ PARTICLE_Z_CLIP

#define PARTICLE_Z_CLIP   8.0

Definition at line 67 of file sw.h.

◆ REF_VERSION

#define REF_VERSION   "SOFT 0.01"

Definition at line 33 of file sw.h.

◆ SPEED

#define SPEED   20

Definition at line 110 of file sw.h.

◆ SURFCACHE_SIZE_AT_320X240

#define SURFCACHE_SIZE_AT_320X240   1024*768

Definition at line 94 of file sw.h.

◆ TEX_BYTES

#define TEX_BYTES   4

Definition at line 50 of file sw.h.

◆ TRANSPARENT_COLOR

#define TRANSPARENT_COLOR   0xFF

Definition at line 69 of file sw.h.

◆ TURB_MASK

#define TURB_MASK   (TURB_SIZE - 1)

Definition at line 72 of file sw.h.

◆ TURB_SIZE

#define TURB_SIZE   64

Definition at line 71 of file sw.h.

◆ VID_BYTES

#define VID_BYTES   4

Definition at line 49 of file sw.h.

◆ WARP_HEIGHT

#define WARP_HEIGHT   240

Definition at line 65 of file sw.h.

◆ WARP_WIDTH

#define WARP_WIDTH   320

Definition at line 64 of file sw.h.

Typedef Documentation

◆ bedge_t

typedef struct bedge_s bedge_t

◆ blocklight_t

typedef int blocklight_t

Definition at line 205 of file sw.h.

◆ clipplane_t

typedef struct clipplane_s clipplane_t

◆ drawsurf_t

typedef struct drawsurf_s drawsurf_t

◆ edge_t

typedef struct edge_s edge_t

◆ espan_t

typedef struct espan_s espan_t

◆ finalvert_t

typedef struct finalvert_s finalvert_t

◆ maliasframe_t

typedef struct maliasframe_s maliasframe_t

◆ maliasst_t

typedef struct maliasst_s maliasst_t

◆ maliastri_t

typedef struct maliastri_s maliastri_t

◆ maliasvert_t

typedef struct maliasvert_s maliasvert_t

◆ pixel_t

typedef unsigned char pixel_t

Definition at line 121 of file sw.h.

◆ surf_t

typedef struct surf_s surf_t

◆ surfcache_t

typedef struct surfcache_s surfcache_t

Function Documentation

◆ D_CacheSurface()

surfcache_t* D_CacheSurface ( mface_t *  surface,
int  miplevel 
)

Definition at line 330 of file surf.c.

331 {
332  surfcache_t *cache;
333  float surfscale;
334 
335 //
336 // if the surface is animating or flashing, flush the cache
337 //
338  r_drawsurf.image = R_TextureAnimation(surface->texinfo);
339  r_drawsurf.lightadj[0] = r_newrefdef.lightstyles[surface->styles[0]].white * sw_modulate->value * 256;
340  r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white * sw_modulate->value * 256;
341  r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white * sw_modulate->value * 256;
342  r_drawsurf.lightadj[3] = r_newrefdef.lightstyles[surface->styles[3]].white * sw_modulate->value * 256;
343 
344 //
345 // see if the cache holds apropriate data
346 //
347  cache = surface->cachespots[miplevel];
348 
349  if (cache && !cache->dlight && surface->dlightframe != r_framecount
350  && cache->image == r_drawsurf.image
351  && cache->lightadj[0] == r_drawsurf.lightadj[0]
352  && cache->lightadj[1] == r_drawsurf.lightadj[1]
353  && cache->lightadj[2] == r_drawsurf.lightadj[2]
354  && cache->lightadj[3] == r_drawsurf.lightadj[3])
355  return cache;
356 
357 //
358 // determine shape of surface
359 //
360  surfscale = 1.0 / (1 << miplevel);
362  r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
364  r_drawsurf.surfheight = surface->extents[1] >> miplevel;
365 
366 //
367 // allocate memory if needed
368 //
369  if (!cache) { // if a texture just animated, don't reallocate it
372  surface->cachespots[miplevel] = cache;
373  cache->owner = &surface->cachespots[miplevel];
374  cache->mipscale = surfscale;
375  }
376 
377  if (surface->dlightframe == r_framecount)
378  cache->dlight = 1;
379  else
380  cache->dlight = 0;
381 
382  r_drawsurf.surfdat = (pixel_t *)cache->data;
383 
384  cache->image = r_drawsurf.image;
385  cache->lightadj[0] = r_drawsurf.lightadj[0];
386  cache->lightadj[1] = r_drawsurf.lightadj[1];
387  cache->lightadj[2] = r_drawsurf.lightadj[2];
388  cache->lightadj[3] = r_drawsurf.lightadj[3];
389 
390 //
391 // draw and light the surface texture
392 //
393  r_drawsurf.surf = surface;
394 
395  c_surf++;
396 
397  // calculate the lightings
398  R_BuildLightMap();
399 
400  // rasterize the surface into the cache
401  R_DrawSurface();
402 
403  return cache;
404 }

Referenced by D_SolidSurf(), and R_BuildPolygonFromSurface().

◆ D_DrawSpans16()

void D_DrawSpans16 ( espan_t pspans)

Definition at line 222 of file scan.c.

223 {
224  int count, spancount;
225  byte *pbase, *pdest, *ptex;
226  fixed16_t s, t, snext, tnext, sstep, tstep;
227  float sdivz, tdivz, zi, z, du, dv, spancountminus1;
228  float sdivz16stepu, tdivz16stepu, zi16stepu;
229 
230  sstep = 0; // keep compiler happy
231  tstep = 0; // ditto
232 
233  pbase = (byte *)cacheblock;
234 
235  sdivz16stepu = d_sdivzstepu * 16;
236  tdivz16stepu = d_tdivzstepu * 16;
237  zi16stepu = d_zistepu * 16;
238 
239  do {
240  pdest = d_spantable[pspan->v] + pspan->u * VID_BYTES;
241 
242  count = pspan->count;
243 
244  // calculate the initial s/z, t/z, 1/z, s, and t and clamp
245  du = (float)pspan->u;
246  dv = (float)pspan->v;
247 
248  sdivz = d_sdivzorigin + dv * d_sdivzstepv + du * d_sdivzstepu;
249  tdivz = d_tdivzorigin + dv * d_tdivzstepv + du * d_tdivzstepu;
250  zi = d_ziorigin + dv * d_zistepv + du * d_zistepu;
251  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
252 
253  s = (int)(sdivz * z) + sadjust;
254  if (s > bbextents)
255  s = bbextents;
256  else if (s < 0)
257  s = 0;
258 
259  t = (int)(tdivz * z) + tadjust;
260  if (t > bbextentt)
261  t = bbextentt;
262  else if (t < 0)
263  t = 0;
264 
265  do {
266  // calculate s and t at the far end of the span
267  if (count >= 16)
268  spancount = 16;
269  else
270  spancount = count;
271 
272  count -= spancount;
273 
274  if (q_likely(count)) {
275  // calculate s/z, t/z, zi->fixed s and t at far end of span,
276  // calculate s and t steps across span by shifting
277  sdivz += sdivz16stepu;
278  tdivz += tdivz16stepu;
279  zi += zi16stepu;
280  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
281 
282  snext = (int)(sdivz * z) + sadjust;
283  if (snext > bbextents)
284  snext = bbextents;
285  else if (snext < 16)
286  snext = 16; // prevent round-off error on <0 steps from
287  // from causing overstepping & running off the
288  // edge of the texture
289 
290  tnext = (int)(tdivz * z) + tadjust;
291  if (tnext > bbextentt)
292  tnext = bbextentt;
293  else if (tnext < 16)
294  tnext = 16; // guard against round-off error on <0 steps
295 
296  sstep = (snext - s) >> 4;
297  tstep = (tnext - t) >> 4;
298  } else {
299  // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
300  // can't step off polygon), clamp, calculate s and t steps across
301  // span by division, biasing steps low so we don't run off the
302  // texture
303  spancountminus1 = (float)(spancount - 1);
304  sdivz += d_sdivzstepu * spancountminus1;
305  tdivz += d_tdivzstepu * spancountminus1;
306  zi += d_zistepu * spancountminus1;
307  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
308 
309  snext = (int)(sdivz * z) + sadjust;
310  if (snext > bbextents)
311  snext = bbextents;
312  else if (snext < 16)
313  snext = 16; // prevent round-off error on <0 steps from
314  // from causing overstepping & running off the
315  // edge of the texture
316 
317  tnext = (int)(tdivz * z) + tadjust;
318  if (tnext > bbextentt)
319  tnext = bbextentt;
320  else if (tnext < 16)
321  tnext = 16; // guard against round-off error on <0 steps
322 
323  if (spancount > 1) {
324  sstep = (snext - s) / (spancount - 1);
325  tstep = (tnext - t) / (spancount - 1);
326  }
327  }
328 
329  do {
330  ptex = pbase + (s >> 16) * TEX_BYTES + (t >> 16) * cachewidth;
331  pdest[0] = ptex[2];
332  pdest[1] = ptex[1];
333  pdest[2] = ptex[0];
334  pdest += VID_BYTES;
335  s += sstep;
336  t += tstep;
337  } while (--spancount > 0);
338 
339  s = snext;
340  t = tnext;
341 
342  } while (count > 0);
343 
344  } while ((pspan = pspan->pnext) != NULL);
345 }

Referenced by D_SkySurf(), and D_SolidSurf().

◆ D_DrawSurfaces()

void D_DrawSurfaces ( void  )

Definition at line 1001 of file edge.c.

1002 {
1003  surf_t *s;
1004 
1005 // currententity = NULL; //&r_worldentity;
1006  VectorSubtract(r_origin, vec3_origin, modelorg);
1009 
1010  if (sw_drawsird->integer) {
1011  D_DrawZSurfaces();
1012  } else if (sw_drawflat->integer) {
1014  } else {
1015  for (s = &surfaces[1]; s < surface_p; s++) {
1016  if (!s->spans)
1017  continue;
1018 
1019  r_drawnpolycount++;
1020 
1021  if (s->flags & DSURF_SKY)
1022  D_SkySurf(s);
1023  else if (s->flags & DSURF_BACKGROUND)
1024  D_BackgroundSurf(s);
1025  else if (s->flags & DSURF_TURB)
1026  D_TurbulentSurf(s);
1027  else
1028  D_SolidSurf(s);
1029  }
1030  }
1031 
1032  currententity = NULL; //&r_worldentity;
1033  VectorSubtract(r_origin, vec3_origin, modelorg);
1035 }

Referenced by R_ScanEdges().

◆ D_DrawTurbulent16()

void D_DrawTurbulent16 ( espan_t pspan,
int warptable 
)

Definition at line 83 of file scan.c.

84 {
85  int count, spancount;
86  byte *pbase, *pdest, *ptex;
87  fixed16_t s, t, snext, tnext, sstep, tstep;
88  float sdivz, tdivz, zi, z, du, dv, spancountminus1;
89  float sdivz16stepu, tdivz16stepu, zi16stepu;
90  int *turb;
91  int turb_s, turb_t;
92 
93  turb = warptable + ((int)(r_newrefdef.time * SPEED) & (CYCLE - 1));
94 
95  sstep = 0; // keep compiler happy
96  tstep = 0; // ditto
97 
98  pbase = (byte *)cacheblock;
99 
100  sdivz16stepu = d_sdivzstepu * 16;
101  tdivz16stepu = d_tdivzstepu * 16;
102  zi16stepu = d_zistepu * 16;
103 
104  do {
105  pdest = d_spantable[pspan->v] + pspan->u * VID_BYTES;
106 
107  count = pspan->count;
108 
109  // calculate the initial s/z, t/z, 1/z, s, and t and clamp
110  du = (float)pspan->u;
111  dv = (float)pspan->v;
112 
113  sdivz = d_sdivzorigin + dv * d_sdivzstepv + du * d_sdivzstepu;
114  tdivz = d_tdivzorigin + dv * d_tdivzstepv + du * d_tdivzstepu;
115  zi = d_ziorigin + dv * d_zistepv + du * d_zistepu;
116  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
117 
118  s = (int)(sdivz * z) + sadjust;
119  if (s > bbextents)
120  s = bbextents;
121  else if (s < 0)
122  s = 0;
123 
124  t = (int)(tdivz * z) + tadjust;
125  if (t > bbextentt)
126  t = bbextentt;
127  else if (t < 0)
128  t = 0;
129 
130  do {
131  // calculate s and t at the far end of the span
132  if (count >= 16)
133  spancount = 16;
134  else
135  spancount = count;
136 
137  count -= spancount;
138 
139  if (q_likely(count)) {
140  // calculate s/z, t/z, zi->fixed s and t at far end of span,
141  // calculate s and t steps across span by shifting
142  sdivz += sdivz16stepu;
143  tdivz += tdivz16stepu;
144  zi += zi16stepu;
145  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
146 
147  snext = (int)(sdivz * z) + sadjust;
148  if (snext > bbextents)
149  snext = bbextents;
150  else if (snext < 16)
151  snext = 16; // prevent round-off error on <0 steps from
152  // from causing overstepping & running off the
153  // edge of the texture
154 
155  tnext = (int)(tdivz * z) + tadjust;
156  if (tnext > bbextentt)
157  tnext = bbextentt;
158  else if (tnext < 16)
159  tnext = 16; // guard against round-off error on <0 steps
160 
161  sstep = (snext - s) >> 4;
162  tstep = (tnext - t) >> 4;
163  } else {
164  // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
165  // can't step off polygon), clamp, calculate s and t steps across
166  // span by division, biasing steps low so we don't run off the
167  // texture
168  spancountminus1 = (float)(spancount - 1);
169  sdivz += d_sdivzstepu * spancountminus1;
170  tdivz += d_tdivzstepu * spancountminus1;
171  zi += d_zistepu * spancountminus1;
172  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
173 
174  snext = (int)(sdivz * z) + sadjust;
175  if (snext > bbextents)
176  snext = bbextents;
177  else if (snext < 16)
178  snext = 16; // prevent round-off error on <0 steps from
179  // from causing overstepping & running off the
180  // edge of the texture
181 
182  tnext = (int)(tdivz * z) + tadjust;
183  if (tnext > bbextentt)
184  tnext = bbextentt;
185  else if (tnext < 16)
186  tnext = 16; // guard against round-off error on <0 steps
187 
188  if (spancount > 1) {
189  sstep = (snext - s) / (spancount - 1);
190  tstep = (tnext - t) / (spancount - 1);
191  }
192  }
193 
194  s = s & ((CYCLE << 16) - 1);
195  t = t & ((CYCLE << 16) - 1);
196 
197  do {
198  turb_s = ((s + turb[(t >> 16) & (CYCLE - 1)]) >> 16) & TURB_MASK;
199  turb_t = ((t + turb[(s >> 16) & (CYCLE - 1)]) >> 16) & TURB_MASK;
200  ptex = pbase + (turb_t * TURB_SIZE * TEX_BYTES) + turb_s * TEX_BYTES;
201  pdest[0] = ptex[2];
202  pdest[1] = ptex[1];
203  pdest[2] = ptex[0];
204  pdest += VID_BYTES;
205  s += sstep;
206  t += tstep;
207  } while (--spancount > 0);
208 
209  s = snext;
210  t = tnext;
211 
212  } while (count > 0);
213 
214  } while ((pspan = pspan->pnext) != NULL);
215 }

Referenced by D_TurbulentSurf().

◆ D_DrawZSpans()

void D_DrawZSpans ( espan_t pspans)

Definition at line 352 of file scan.c.

353 {
354  int count, doublecount, izistep;
355  int izi;
356  short *pdest;
357  uint32_t ltemp;
358  float zi;
359  float du, dv;
360 
361 // FIXME: check for clamping/range problems
362 // we count on FP exceptions being turned off to avoid range problems
363  izistep = (int)(d_zistepu * 0x8000 * 0x10000);
364 
365  do {
366  pdest = d_zspantable[pspan->v] + pspan->u;
367 
368  count = pspan->count;
369 
370  // calculate the initial 1/z
371  du = (float)pspan->u;
372  dv = (float)pspan->v;
373 
374  zi = d_ziorigin + dv * d_zistepv + du * d_zistepu;
375  // we count on FP exceptions being turned off to avoid range problems
376  izi = (int)(zi * 0x8000 * 0x10000);
377 
378  if ((uintptr_t)pdest & 0x02) {
379  *pdest++ = (short)(izi >> 16);
380  izi += izistep;
381  count--;
382  }
383 
384  if ((doublecount = count >> 1) > 0) {
385  do {
386  ltemp = izi >> 16;
387  izi += izistep;
388  ltemp |= izi & 0xFFFF0000;
389  izi += izistep;
390  *(uint32_t *)pdest = ltemp;
391  pdest += 2;
392  } while (--doublecount > 0);
393  }
394 
395  if (count & 1)
396  *pdest = (short)(izi >> 16);
397 
398  } while ((pspan = pspan->pnext) != NULL);
399 }

Referenced by D_BackgroundSurf(), D_DrawflatSurfaces(), D_DrawZSurfaces(), D_SkySurf(), D_SolidSurf(), and D_TurbulentSurf().

◆ D_FlushCaches()

void D_FlushCaches ( void  )

Definition at line 222 of file surf.c.

223 {
224  surfcache_t *c;
225 
226  if (!sc_base)
227  return;
228 
229  for (c = sc_base; c; c = c->next) {
230  if (c->owner) {
231  *c->owner = NULL;
232  }
233  }
234 
235  sc_rover = sc_base;
236  sc_base->next = NULL;
237  sc_base->owner = NULL;
238  sc_base->size = sc_size;
239 }

Referenced by R_BeginRegistration(), R_ModeChanged(), R_SetupFrame(), and R_Shutdown().

◆ D_SCDump_f()

void D_SCDump_f ( void  )

Definition at line 311 of file surf.c.

312 {
313  surfcache_t *test;
314 
315  for (test = sc_base; test; test = test->next) {
316  if (test == sc_rover)
317  Com_Printf("ROVER:\n");
318  Com_Printf("%p : %i bytes %i width\n", test, test->size,
319  test->width);
320  }
321 }

Referenced by R_Register().

◆ D_WarpScreen()

void D_WarpScreen ( void  )

Definition at line 32 of file scan.c.

33 {
34  int w, h;
35  int u, v, u2, v2;
36  byte *dest;
37  int *turb;
38  int *col;
39  byte **row;
40 
41  static int cached_width, cached_height;
42  static byte *rowptr[MAXHEIGHT * 2 + AMP2 * 2];
43  static int column[MAXWIDTH * 2 + AMP2 * 2];
44 
45  //
46  // these are constant over resolutions, and can be saved
47  //
48  w = r_newrefdef.width;
49  h = r_newrefdef.height;
50  if (w != cached_width || h != cached_height) {
51  cached_width = w;
52  cached_height = h;
53  for (v = 0; v < h + AMP2 * 2; v++) {
54  v2 = (int)((float)v / (h + AMP2 * 2) * r_refdef.vrect.height);
55  rowptr[v] = r_warpbuffer + (WARP_WIDTH * v2) * VID_BYTES;
56  }
57 
58  for (u = 0; u < w + AMP2 * 2; u++) {
59  u2 = (int)((float)u / (w + AMP2 * 2) * r_refdef.vrect.width);
60  column[u] = u2 * VID_BYTES;
61  }
62  }
63 
64  turb = intsintable + ((int)(r_newrefdef.time * SPEED) & (CYCLE - 1));
66 
67  for (v = 0; v < h; v++, dest += vid.rowbytes) {
68  col = &column[turb[v & (CYCLE - 1)]];
69  row = &rowptr[v];
70  for (u = 0; u < w; u++) {
71  dest[u * VID_BYTES + 0] = row[turb[u & (CYCLE - 1)]][col[u] + 0];
72  dest[u * VID_BYTES + 1] = row[turb[u & (CYCLE - 1)]][col[u] + 1];
73  dest[u * VID_BYTES + 2] = row[turb[u & (CYCLE - 1)]][col[u] + 2];
74  }
75  }
76 }

Referenced by R_RenderFrame().

◆ R_AliasClipTriangle()

void R_AliasClipTriangle ( finalvert_t index0,
finalvert_t index1,
finalvert_t index2 
)

Definition at line 183 of file aclip.c.

184 {
185  finalvert_t fv[2][8];
186  int i, k, pingpong;
187  unsigned clipflags;
188 
189 // copy vertexes and fix seam texture coordinates
190  fv[0][0] = *index0;
191  fv[0][1] = *index1;
192  fv[0][2] = *index2;
193 
194 // clip
195  clipflags = fv[0][0].flags | fv[0][1].flags | fv[0][2].flags;
196 
197  if (clipflags & ALIAS_Z_CLIP) {
198  k = R_AliasClip(fv[0], fv[1], ALIAS_Z_CLIP, 3, R_Alias_clip_z);
199  if (k == 0)
200  return;
201 
202  pingpong = 1;
203  clipflags = fv[1][0].flags | fv[1][1].flags | fv[1][2].flags;
204  } else {
205  pingpong = 0;
206  k = 3;
207  }
208 
209  if (clipflags & ALIAS_LEFT_CLIP) {
210  k = R_AliasClip(fv[pingpong], fv[pingpong ^ 1],
212  if (k == 0)
213  return;
214 
215  pingpong ^= 1;
216  }
217 
218  if (clipflags & ALIAS_RIGHT_CLIP) {
219  k = R_AliasClip(fv[pingpong], fv[pingpong ^ 1],
221  if (k == 0)
222  return;
223 
224  pingpong ^= 1;
225  }
226 
227  if (clipflags & ALIAS_BOTTOM_CLIP) {
228  k = R_AliasClip(fv[pingpong], fv[pingpong ^ 1],
230  if (k == 0)
231  return;
232 
233  pingpong ^= 1;
234  }
235 
236  if (clipflags & ALIAS_TOP_CLIP) {
237  k = R_AliasClip(fv[pingpong], fv[pingpong ^ 1],
239  if (k == 0)
240  return;
241 
242  pingpong ^= 1;
243  }
244 
245  for (i = 0; i < k; i++) {
246  if (fv[pingpong][i].u < r_refdef.vrect.x)
247  fv[pingpong][i].u = r_refdef.vrect.x;
248  else if (fv[pingpong][i].u > r_refdef.vrectright)
249  fv[pingpong][i].u = r_refdef.vrectright;
250 
251  if (fv[pingpong][i].v < r_refdef.vrect.y)
252  fv[pingpong][i].v = r_refdef.vrect.y;
253  else if (fv[pingpong][i].v > r_refdef.vrectbottom)
254  fv[pingpong][i].v = r_refdef.vrectbottom;
255 
256  fv[pingpong][i].flags = 0;
257  }
258 
259 // draw triangles
260  for (i = 1; i < k - 1; i++) {
261  aliastriangleparms.a = &fv[pingpong][0];
262  aliastriangleparms.b = &fv[pingpong][i];
263  aliastriangleparms.c = &fv[pingpong][i + 1];
264  R_DrawTriangle();
265  }
266 }

Referenced by R_AliasPreparePoints().

◆ 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_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_ApplySIRDAlgorithum()

void R_ApplySIRDAlgorithum ( void  )

Definition at line 155 of file sird.c.

156 {
157  short* curz, *oldz;
158  short cz = 0, lastz = 0;
159  byte* curp;
160  byte* curbp, j = 0;
161  int x, y, i, zinc, k;
162  int mode = sw_drawsird->integer;
163 
164  //note of interest: I've made this static so that
165  //if you like you could make it not static and see
166  //what would happen if you didn't change the background
167  static int ji = 0;
168 
169  //create the background image to tile
170  //basically done by shifting the values around
171  //each time and xoring them with a randomly
172  //selected pixel
173  for (i = 0; i < R_SIRDw * R_SIRDh * VID_BYTES; i++) {
174  if ((i % R_SIRDnumRand) == 0) {
175  ji++;
176  ji %= R_SIRDnumRand;
178  }
180  }
181 
182  //if we are under water:
183  if ((r_dowarp) && (vid.width != WARP_WIDTH)) {
184  //the rendering is only in the top left
185  //WARP_WIDTH by WARP_HEIGHT area, so scale the z-values
186  //to span over the whole screen
187 
188 
189  //why are we going backwards? so that we don't write over the
190  //values before we read from them
191 
192  zinc = ((WARP_WIDTH * 0x10000) / vid.width);
193  for (y = vid.height - 1; y >= 0; y--) {
194  curz = (d_pzbuffer + (vid.width * y));
195  oldz = (d_pzbuffer + (vid.width * ((y * WARP_HEIGHT) / vid.height)));
196  k = (zinc * (vid.width - 1));
197 
198  for (x = vid.width - 1; x >= 0; x--) {
199  curz[x] = oldz[k >> 16];
200  k -= zinc;
201  }
202  }
203  }
204 
205 
206  //SIRDify each line
207  for (y = 0; y < vid.height; y++) {
208  curp = (vid.buffer + (vid.rowbytes * y));
209  curz = (d_pzbuffer + (vid.width * y));
210 
211  if (mode != 3) {
212  // draw the SIRD
213 
214  // copy the background into the left most column
215  curbp = &(r_SIRDBackground[ R_SIRDw * (y % R_SIRDh) ]);
216  for (x = 0; x < R_SIRDw; x++) {
217  curp[0] = curbp[0];
218  curp[1] = curbp[1];
219  curp[2] = curbp[2];
220 
221  curp += VID_BYTES;
222  curbp += VID_BYTES;
223  }
224 
225  lastz = 0;
226  cz = 0;
227  curz += R_SIRDw;
228  curbp = curp - R_SIRDw * VID_BYTES;
229 
230  // now calculate the SIRD
231  for (x = R_SIRDw; x < vid.width; x++) {
232  //only call the z-function with a new
233  //value, it is slow so this saves quite
234  //some time.
235  if (lastz != *curz) {
236  lastz = *curz;
237 
238  //convert from z to height offset
239  cz = (mode == 2) ? R_SIRDmaxDiff - R_SIRDZFunc(lastz) : R_SIRDZFunc(lastz);
240 
241  //the "height offset" used in making SIRDS
242  //can be considered an adjustment of the
243  //frequency of repetition in the pattern.
244  //so here we are copying from bp to p, and so
245  //it simply increases or decreases the distance
246  //between the two.
247  curbp = (curp - R_SIRDw * VID_BYTES + cz * VID_BYTES);
248  }
249 
250  curp[0] = curbp[0];
251  curp[1] = curbp[1];
252  curp[2] = curbp[2];
253 
254  curp += VID_BYTES;
255  curbp += VID_BYTES;
256  curz++;
257  }
258  } else {
259  //if we are just drawing the height map
260  //this lets you see which layers are used to
261  //create the SIRD
262  //
263  //NOTE: even though it may sort of look like
264  //a grey-scale height map, that is merely a
265  //coincidence because of how the colours are
266  //organized in the pallette.
267 
268  for (x = 0; x < vid.width; x++) {
269  if (lastz != *curz) {
270  lastz = *curz;
271  cz = R_SIRDZFunc(*curz);
272  }
273 
274  curp[0] = cz;
275  curp[1] = cz;
276  curp[2] = cz;
277 
278  curp += VID_BYTES;
279  curz++;
280  }
281  }
282  }
283 }

Referenced by R_RenderFrame().

◆ R_BeginEdgeFrame()

void R_BeginEdgeFrame ( void  )

Definition at line 80 of file edge.c.

81 {
82  int v;
83 
84  edge_p = r_edges;
86 
87  surface_p = &surfaces[2]; // background is surface 1,
88  // surface 0 is a dummy
89  surfaces[1].spans = NULL; // no background spans yet
91 
92 // put the background behind everything in the world
93  if (sw_draworder->integer) {
95  surfaces[1].key = 0;
96  r_currentkey = 1;
97  } else {
99  surfaces[1].key = 0x7FFFFFFF;
100  r_currentkey = 0;
101  }
102 
103 // FIXME: set with memset
104  for (v = r_refdef.vrect.y; v < r_refdef.vrectbottom; v++) {
105  newedges[v] = removeedges[v] = NULL;
106  }
107 }

Referenced by R_EdgeDrawing().

◆ R_BuildGammaTable()

void R_BuildGammaTable ( void  )

Definition at line 109 of file image.c.

110 {
111  int i, inf;
112  float g = vid_gamma->value;
113 
114  if (g == 1.0) {
115  for (i = 0; i < 256; i++)
116  gammatable[i] = i;
117  return;
118  }
119 
120  for (i = 0; i < 256; i++) {
121  inf = 255 * pow((i + 0.5) / 255.5, g) + 0.5;
122  gammatable[i] = clamp(inf, 0, 255);
123  }
124 }

Referenced by R_InitImages().

◆ R_BuildLightMap()

void R_BuildLightMap ( void  )

Definition at line 290 of file light.c.

291 {
292  int i, maps, smax, tmax, size;
293  byte *lightmap;
294  mface_t *surf;
295  blocklight_t *block;
296 
297  surf = r_drawsurf.surf;
298  smax = S_MAX(surf);
299  tmax = T_MAX(surf);
300  size = smax * tmax;
301 
302  if (size > MAX_BLOCKLIGHTS)
303  Com_Error(ERR_DROP, "R_BuildLightMap: surface blocklights size %i > %i", size, MAX_BLOCKLIGHTS);
304 
305  if (r_fullbright->integer || !surf->lightmap) {
306  block = blocklights;
307  for (i = 0; i < size; i++) {
308  block[0] = block[1] = block[2] = 0xffff;
309  block += LIGHTMAP_BYTES;
310  }
311  return;
312  }
313 
314 // clear to no light
315  memset(blocklights, 0, sizeof(blocklights[0]) * size * LIGHTMAP_BYTES);
316 
317 // add all the lightmaps
318  lightmap = surf->lightmap;
319  for (maps = 0; maps < surf->numstyles; maps++) {
320  fixed8_t scale;
321 
322  block = blocklights;
323  scale = r_drawsurf.lightadj[maps]; // 8.8 fraction
324  for (i = 0; i < size; i++) {
325  block[0] += lightmap[0] * scale;
326  block[1] += lightmap[1] * scale;
327  block[2] += lightmap[2] * scale;
328 
329  lightmap += LIGHTMAP_BYTES;
330  block += LIGHTMAP_BYTES;
331  }
332  }
333 
334 // add all the dynamic lights
335  if (surf->dlightframe == r_framecount)
337 
338 // bound
339  block = blocklights;
340  for (i = 0; i < size; i++) {
341  blocklight_t r, g, b, max;
342 
343  r = block[0];
344  g = block[1];
345  b = block[2];
346 
347  // catch negative lights
348  if (r < 255)
349  r = 255;
350  if (g < 255)
351  g = 255;
352  if (b < 255)
353  b = 255;
354 
355  // determine the brightest of the three color components
356  max = g;
357  if (r > max)
358  max = r;
359  if (b > max)
360  max = b;
361 
362  // rescale all the color components if the intensity of the greatest
363  // channel exceeds 1.0
364  if (max > 65535) {
365  float y;
366 
367  y = 65535.0f / max;
368  r *= y;
369  g *= y;
370  b *= y;
371  }
372 
373  block[0] = r;
374  block[1] = g;
375  block[2] = b;
376 
377  block += LIGHTMAP_BYTES;
378  }
379 }

Referenced by D_CacheSurface().

◆ R_DrawAlphaSurfaces()

void R_DrawAlphaSurfaces ( void  )

Definition at line 764 of file poly.c.

765 {
766  mface_t *s = r_alpha_surfaces;
767 
768  //currentmodel = r_worldmodel;
769 
770  modelorg[0] = -r_origin[0];
771  modelorg[1] = -r_origin[1];
772  modelorg[2] = -r_origin[2];
773 
774  while (s) {
776 
777  if (s->texinfo->c.flags & SURF_TRANS66)
778  R_ClipAndDrawPoly(0.66f, (s->texinfo->c.flags & (SURF_WARP | SURF_FLOWING)), qtrue);
779  else
780  R_ClipAndDrawPoly(0.33f, (s->texinfo->c.flags & (SURF_WARP | SURF_FLOWING)), qtrue);
781 
782  s = s->next;
783  }
784 
785  r_alpha_surfaces = NULL;
786 }

Referenced by R_RenderFrame().

◆ R_DrawBeam()

void R_DrawBeam ( entity_t *  e)

Definition at line 871 of file main.c.

872 {
873 #define NUM_BEAM_SEGS 6
874 
875  color_t color;
876  int i;
877 
878  vec3_t perpvec;
879  vec3_t direction, normalized_direction;
880  vec3_t start_points[NUM_BEAM_SEGS], end_points[NUM_BEAM_SEGS];
881  vec3_t oldorigin, origin;
882 
883  oldorigin[0] = e->oldorigin[0];
884  oldorigin[1] = e->oldorigin[1];
885  oldorigin[2] = e->oldorigin[2];
886 
887  origin[0] = e->origin[0];
888  origin[1] = e->origin[1];
889  origin[2] = e->origin[2];
890 
891  normalized_direction[0] = direction[0] = oldorigin[0] - origin[0];
892  normalized_direction[1] = direction[1] = oldorigin[1] - origin[1];
893  normalized_direction[2] = direction[2] = oldorigin[2] - origin[2];
894 
895  if (VectorNormalize(normalized_direction) == 0)
896  return;
897 
898  PerpendicularVector(perpvec, normalized_direction);
899  VectorScale(perpvec, e->frame / 2, perpvec);
900 
901  for (i = 0; i < NUM_BEAM_SEGS; i++) {
902  RotatePointAroundVector(start_points[i], normalized_direction,
903  perpvec, (360.0f / NUM_BEAM_SEGS) * i);
904  VectorAdd(start_points[i], origin, start_points[i]);
905  VectorAdd(start_points[i], direction, end_points[i]);
906  }
907 
908  if (e->skinnum == -1)
909  color.u32 = e->rgba.u32;
910  else
911  color.u32 = d_8to24table[e->skinnum & 0xFF];
912 
913  for (i = 0; i < NUM_BEAM_SEGS; i++) {
914  R_IMFlatShadedQuad(start_points[i],
915  end_points[i],
916  end_points[(i + 1) % NUM_BEAM_SEGS],
917  start_points[(i + 1) % NUM_BEAM_SEGS],
918  color,
919  e->alpha);
920  }
921 }

Referenced by R_DrawEntities().

◆ R_DrawParticles()

void R_DrawParticles ( void  )

Definition at line 119 of file part.c.

120 {
121  particle_t *p;
122  int i;
123  int alpha;
124 
125  VectorScale(vright, r_refdef.xscaleshrink, partparms.right);
126  VectorScale(vup, r_refdef.yscaleshrink, partparms.up);
127  VectorCopy(vpn, partparms.pn);
128 
129  for (p = r_newrefdef.particles, i = 0; i < r_newrefdef.num_particles; i++, p++) {
130  partparms.particle = p;
131 
132  alpha = 255 * p->alpha;
133  partparms.one_minus_alpha = 255 - alpha;
134 
135  if (p->color == -1) {
136  partparms.color[0] = p->rgba.u8[0] * alpha;
137  partparms.color[1] = p->rgba.u8[1] * alpha;
138  partparms.color[2] = p->rgba.u8[2] * alpha;
139  } else {
140  color_t color;
141 
142  color.u32 = d_8to24table[p->color & 0xff];
143  partparms.color[0] = color.u8[0] * alpha;
144  partparms.color[1] = color.u8[1] * alpha;
145  partparms.color[2] = color.u8[2] * alpha;
146  }
147 
148  R_DrawParticle();
149  }
150 }

Referenced by R_RenderFrame().

◆ R_DrawSolidClippedSubmodelPolygons()

void R_DrawSolidClippedSubmodelPolygons ( mmodel_t *  pmodel,
mnode_t *  topnode 
)

Definition at line 245 of file bsp.c.

246 {
247  int i, j;
248  vec_t dot;
249  mface_t *psurf;
250  int numsurfaces;
251  cplane_t *pplane;
252  mvertex_t bverts[MAX_BMODEL_VERTS];
253  bedge_t bedges[MAX_BMODEL_EDGES], *pbedge;
254  msurfedge_t *surfedge;
255 
256 // FIXME: use bounding-box-based frustum clipping info?
257 
258  psurf = pmodel->firstface;
259  numsurfaces = pmodel->numfaces;
260 
261  for (i = 0; i < numsurfaces; i++, psurf++) {
262  // find which side of the node we are on
263  pplane = psurf->plane;
264 
265  dot = PlaneDiff(modelorg, pplane);
266 
267  // draw the polygon
268  if ((!(psurf->drawflags & DSURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
269  ((psurf->drawflags & DSURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
270  continue;
271 
272  // FIXME: use bounding-box-based frustum clipping info?
273 
274  // copy the edges to bedges, flipping if necessary so always
275  // clockwise winding
276  // FIXME: if edges and vertices get caches, these assignments must move
277  // outside the loop, and overflow checking must be done here
278  pbverts = bverts;
279  pbedges = bedges;
280  numbverts = numbedges = 0;
281  pbedge = &bedges[numbedges];
282  numbedges += psurf->numsurfedges;
283 
284  if (numbedges >= MAX_BMODEL_EDGES) {
285  Com_Printf("Out of edges for bmodel\n");
286  return;
287  }
288 
289  surfedge = psurf->firstsurfedge;
290  for (j = 0; j < psurf->numsurfedges; j++, surfedge++) {
291  pbedge[j].v[0] = surfedge->edge->v[surfedge->vert ];
292  pbedge[j].v[1] = surfedge->edge->v[surfedge->vert ^ 1];
293  pbedge[j].pnext = &pbedge[j + 1];
294  }
295 
296  pbedge[j - 1].pnext = NULL; // mark end of edges
297 
298  if (!(psurf->texinfo->c.flags & SURF_TRANS_MASK))
299  R_RecursiveClipBPoly(pbedge, topnode, psurf);
300  else
301  R_RenderBmodelFace(pbedge, psurf);
302  }
303 }

Referenced by R_DrawBEntitiesOnList().

◆ R_DrawSprite()

void R_DrawSprite ( void  )

Definition at line 835 of file poly.c.

836 {
837  vec5_t *pverts;
838  vec3_t left, up, right, down;
839  mspriteframe_t *frame;
840  int textured;
841 
842  frame = &currentmodel->spriteframes[
843  currententity->frame % currentmodel->numframes];
844 
845  r_polydesc.pixels = frame->image->pixels[0];
846  r_polydesc.pixel_width = frame->image->upload_width;
847  r_polydesc.pixel_height = frame->image->upload_height;
848  r_polydesc.dist = 0;
849 
850  // generate the sprite's axes, completely parallel to the viewplane.
851  VectorCopy(vup, r_polydesc.vup);
852  VectorCopy(vright, r_polydesc.vright);
853  VectorCopy(vpn, r_polydesc.vpn);
854 
855 // build the sprite poster in worldspace
856  VectorScale(r_polydesc.vright,
857  frame->width - frame->origin_x, right);
858  VectorScale(r_polydesc.vup,
859  frame->height - frame->origin_y, up);
860  VectorScale(r_polydesc.vright,
861  -frame->origin_x, left);
862  VectorScale(r_polydesc.vup,
863  -frame->origin_y, down);
864 
865  // invert UP vector for sprites
866  VectorNegate(r_polydesc.vup, r_polydesc.vup);
867 
868  pverts = r_clip_verts[0];
869 
870  pverts[0][0] = r_entorigin[0] + up[0] + left[0];
871  pverts[0][1] = r_entorigin[1] + up[1] + left[1];
872  pverts[0][2] = r_entorigin[2] + up[2] + left[2];
873  pverts[0][3] = 0;
874  pverts[0][4] = 0;
875 
876  pverts[1][0] = r_entorigin[0] + up[0] + right[0];
877  pverts[1][1] = r_entorigin[1] + up[1] + right[1];
878  pverts[1][2] = r_entorigin[2] + up[2] + right[2];
879  pverts[1][3] = frame->width;
880  pverts[1][4] = 0;
881 
882  pverts[2][0] = r_entorigin[0] + down[0] + right[0];
883  pverts[2][1] = r_entorigin[1] + down[1] + right[1];
884  pverts[2][2] = r_entorigin[2] + down[2] + right[2];
885  pverts[2][3] = frame->width;
886  pverts[2][4] = frame->height;
887 
888  pverts[3][0] = r_entorigin[0] + down[0] + left[0];
889  pverts[3][1] = r_entorigin[1] + down[1] + left[1];
890  pverts[3][2] = r_entorigin[2] + down[2] + left[2];
891  pverts[3][3] = 0;
892  pverts[3][4] = frame->height;
893 
894  r_polydesc.nump = 4;
897  VectorCopy(modelorg, r_polydesc.viewer_position);
898 
899  if (frame->image->flags & IF_TRANSPARENT)
900  textured = 2;
901  else
902  textured = 1;
903 
904  if (currententity->flags & RF_TRANSLUCENT)
905  R_ClipAndDrawPoly(currententity->alpha, qfalse, textured);
906  else
907  R_ClipAndDrawPoly(1.0F, qfalse, textured);
908 }

Referenced by R_DrawEntities().

◆ R_DrawSubmodelPolygons()

void R_DrawSubmodelPolygons ( mmodel_t *  pmodel,
int  clipflags,
mnode_t *  topnode 
)

Definition at line 313 of file bsp.c.

314 {
315  int i;
316  vec_t dot;
317  mface_t *psurf;
318  int numsurfaces;
319  cplane_t *pplane;
320 
321 // FIXME: use bounding-box-based frustum clipping info?
322 
323  psurf = pmodel->firstface;
324  numsurfaces = pmodel->numfaces;
325 
326  for (i = 0; i < numsurfaces; i++, psurf++) {
327  // find which side of the node we are on
328  pplane = psurf->plane;
329 
330  dot = PlaneDiff(modelorg, pplane);
331 
332  // draw the polygon
333  if (((psurf->drawflags & DSURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
334  (!(psurf->drawflags & DSURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) {
335  r_currentkey = ((mleaf_t *)topnode)->key;
336 
337  // FIXME: use bounding-box-based frustum clipping info?
338  R_RenderFace(psurf, clipflags);
339  }
340  }
341 }

Referenced by R_DrawBEntitiesOnList().

◆ R_DrawTriangle()

void R_DrawTriangle ( void  )

Definition at line 113 of file polyset.c.

114 {
116  int dv1_ab, dv0_ac;
117  int dv0_ab, dv1_ac;
118 
121 
122  if (!(dv0_ab | dv1_ab))
123  return;
124 
127 
128  if (!(dv0_ac | dv1_ac))
129  return;
130 
131  d_xdenom = (dv0_ac * dv1_ab) - (dv0_ab * dv1_ac);
132 
133  if (d_xdenom < 0) {
134  a_spans = spans;
135 
136  r_p0[0] = aliastriangleparms.a->u; // u
137  r_p0[1] = aliastriangleparms.a->v; // v
138  r_p0[2] = aliastriangleparms.a->s; // s
139  r_p0[3] = aliastriangleparms.a->t; // t
140  r_p0[4] = aliastriangleparms.a->l; // light
141  r_p0[5] = aliastriangleparms.a->zi; // iz
142 
143  r_p1[0] = aliastriangleparms.b->u;
144  r_p1[1] = aliastriangleparms.b->v;
145  r_p1[2] = aliastriangleparms.b->s;
146  r_p1[3] = aliastriangleparms.b->t;
147  r_p1[4] = aliastriangleparms.b->l;
148  r_p1[5] = aliastriangleparms.b->zi;
149 
150  r_p2[0] = aliastriangleparms.c->u;
151  r_p2[1] = aliastriangleparms.c->v;
152  r_p2[2] = aliastriangleparms.c->s;
153  r_p2[3] = aliastriangleparms.c->t;
154  r_p2[4] = aliastriangleparms.c->l;
155  r_p2[5] = aliastriangleparms.c->zi;
156 
159  }
160 }

Referenced by R_AliasClipTriangle(), and R_AliasPreparePoints().

◆ R_EmitSkyBox()

void R_EmitSkyBox ( void  )

Definition at line 116 of file sky.c.

117 {
118  int i, j;
119  int oldkey;
120 
121  if (insubmodel)
122  return; // submodels should never have skies
123  if (r_skyframe == r_framecount)
124  return; // already set this frame
125 
127 
128  // set the eight fake vertexes
129  for (i = 0; i < 8; i++)
130  for (j = 0; j < 3; j++)
131  r_skyverts[i].point[j] = r_origin[j] + box_verts[i][j] * 128;
132 
133  // set the six fake planes
134  for (i = 0; i < 6; i++)
135  if (box_planes[i * 2 + 1] > 0)
136  r_skyplanes[i].dist = r_origin[box_planes[i * 2]] + 128;
137  else
138  r_skyplanes[i].dist = r_origin[box_planes[i * 2]] - 128;
139 
140  // fix texture offsets
141  for (i = 0; i < 6; i++) {
142  r_skytexinfo[i].offset[0] = -DotProduct(r_origin, r_skytexinfo[i].axis[0]);
143  r_skytexinfo[i].offset[1] = -DotProduct(r_origin, r_skytexinfo[i].axis[1]);
144  }
145 
146  // emit the six faces
147  oldkey = r_currentkey;
148  r_currentkey = 0x7ffffff0;
149  for (i = 0; i < 6; i++) {
150  R_RenderFace(&r_skyfaces[i], 15);
151  }
152  r_currentkey = oldkey; // bsp sorting order
153 }

Referenced by R_RenderFace().

◆ R_FreeCaches()

void R_FreeCaches ( void  )

Definition at line 206 of file surf.c.

207 {
208  if (sc_base) {
209  Z_Free(sc_base);
210  sc_base = NULL;
211  }
212 
213  sc_size = 0;
214  sc_rover = NULL;
215 }

Referenced by R_ModeChanged(), and R_Shutdown().

◆ R_IMFlatShadedQuad()

void R_IMFlatShadedQuad ( vec3_t  a,
vec3_t  b,
vec3_t  c,
vec3_t  d,
color_t  color,
float  alpha 
)

Definition at line 791 of file poly.c.

792 {
793  vec3_t s0, s1;
794 
795  r_polydesc.nump = 4;
796  VectorCopy(r_origin, r_polydesc.viewer_position);
797 
798  VectorCopy(a, r_clip_verts[0][0]);
799  VectorCopy(b, r_clip_verts[0][1]);
800  VectorCopy(c, r_clip_verts[0][2]);
801  VectorCopy(d, r_clip_verts[0][3]);
802 
803  r_clip_verts[0][0][3] = 0;
804  r_clip_verts[0][1][3] = 0;
805  r_clip_verts[0][2][3] = 0;
806  r_clip_verts[0][3][3] = 0;
807 
808  r_clip_verts[0][0][4] = 0;
809  r_clip_verts[0][1][4] = 0;
810  r_clip_verts[0][2][4] = 0;
811  r_clip_verts[0][3][4] = 0;
812 
813  VectorSubtract(d, c, s0);
814  VectorSubtract(c, b, s1);
815  CrossProduct(s0, s1, r_polydesc.vpn);
817 
818  r_polydesc.dist = DotProduct(r_polydesc.vpn, r_clip_verts[0][0]);
819 
820  r_polydesc.alpha = 255 * alpha;
821 
822  r_polyblendcolor[0] = color.u8[0] * r_polydesc.alpha;
823  r_polyblendcolor[1] = color.u8[1] * r_polydesc.alpha;
824  r_polyblendcolor[2] = color.u8[2] * r_polydesc.alpha;
825 
826  R_ClipAndDrawPoly(alpha, qfalse, qfalse);
827 }

Referenced by R_DrawBeam().

◆ R_InitCaches()

void R_InitCaches ( void  )

Definition at line 172 of file surf.c.

173 {
174  int size;
175  int pix;
176 
177  // calculate size to allocate
178  if (sw_surfcacheoverride->integer) {
182  } else {
184 
185  pix = vid.width * vid.height;
186  if (pix > 64000)
187  size += (pix - 64000) * 3;
188  }
189 
190  size *= TEX_BYTES;
191 
192  // round up to page size
193  size = (size + 8191) & ~8191;
194 
195  Com_DPrintf("%ik surface cache\n", size / 1024);
196 
197  sc_size = size;
198  sc_base = (surfcache_t *)R_Malloc(size);
199  sc_rover = sc_base;
200 
201  sc_base->next = NULL;
202  sc_base->owner = NULL;
203  sc_base->size = sc_size;
204 }

Referenced by R_ModeChanged().

◆ R_InitDraw()

void R_InitDraw ( void  )

Definition at line 109 of file draw.c.

110 {
111  memset(&draw, 0, sizeof(draw));
112  draw.colors[0].u32 = U32_WHITE;
113  draw.colors[1].u32 = U32_WHITE;
114  draw.clip.left = 0;
115  draw.clip.top = 0;
116  draw.clip.right = r_config.width;
117  draw.clip.bottom = r_config.height;
118 }

Referenced by R_Init().

◆ R_InitImages()

void R_InitImages ( void  )

Definition at line 164 of file image.c.

165 {
167 
168  IMG_GetPalette();
169 
171 
173 }

Referenced by R_Init().

◆ R_InitSkyBox()

void R_InitSkyBox ( void  )

Definition at line 77 of file sky.c.

78 {
79  int i;
80 
81  for (i = 0; i < 6; i++) {
82  r_skyplanes[i].normal[box_planes[i * 2]] = 1;
83  r_skyplanes[i].dist = box_planes[i * 2 + 1];
84 
85  VectorCopy(box_axis[i][0], r_skytexinfo[i].axis[0]);
86  VectorCopy(box_axis[i][1], r_skytexinfo[i].axis[1]);
87 
88  r_skyfaces[i].plane = &r_skyplanes[i];
89  r_skyfaces[i].drawflags = box_flags[i] | DSURF_SKY;
90  r_skyfaces[i].numsurfedges = 4;
91  r_skyfaces[i].firstsurfedge = &r_skysurfedges[i * 4];
92  r_skyfaces[i].texinfo = &r_skytexinfo[i];
93  r_skyfaces[i].texturemins[0] = -128;
94  r_skyfaces[i].texturemins[1] = -128;
95  r_skyfaces[i].extents[0] = 256;
96  r_skyfaces[i].extents[1] = 256;
97  }
98 
99  for (i = 0; i < 24; i++) {
100  r_skysurfedges[i].edge = &r_skyedges[box_surfedges[i] - 1];
101  r_skysurfedges[i].vert = box_surfverts[i];
102  }
103 
104  for (i = 0; i < 12; i++) {
105  r_skyedges[i].v[0] = &r_skyverts[box_edges[i * 2 + 0] - 1];
106  r_skyedges[i].v[1] = &r_skyverts[box_edges[i * 2 + 1] - 1];
107  r_skyedges[i].cachededgeoffset = 0;
108  }
109 }

Referenced by R_Init().

◆ R_InitTurb()

void R_InitTurb ( void  )

Definition at line 142 of file main.c.

143 {
144  int i;
145 
146  for (i = 0; i < CYCLE * 2; i++) {
147  sintable[i] = AMP + sin(i * M_PI * 2 / CYCLE) * AMP;
148  intsintable[i] = AMP2 + sin(i * M_PI * 2 / CYCLE) * AMP2; // AMP2, not 20
149  blanktable[i] = 0;
150  }
151 }

Referenced by R_Init().

◆ R_LightPoint()

void R_LightPoint ( vec3_t  p,
vec3_t  color 
)

Definition at line 174 of file light.c.

175 {
176  int lnum;
177  dlight_t *dl;
178  float add;
179 
180  if (!r_worldmodel || !r_worldmodel->lightmap || r_fullbright->integer) {
181  VectorSet(color, 1, 1, 1);
182  return;
183  }
184 
185  VectorClear(color);
186 
187  if (!_R_LightPoint(point, color))
188  VectorSet(color, 1, 1, 1);
189 
190  //
191  // add dynamic lights
192  //
193  for (lnum = 0; lnum < r_newrefdef.num_dlights; lnum++) {
194  dl = &r_newrefdef.dlights[lnum];
195  add = dl->intensity - DLIGHT_CUTOFF - Distance(point, dl->origin);
196  if (add > 0) {
197  add *= (1.0f / 255);
198  VectorMA(color, add, dl->color, color);
199  }
200  }
201 
202  VectorScale(color, sw_modulate->value, color);
203 }

◆ R_MarkLights()

void R_MarkLights ( mnode_t *  headnode)

Definition at line 76 of file light.c.

77 {
78  dlight_t *light;
79  vec3_t transformed;
80  int i;
81 
83  for (i = 0, light = r_newrefdef.dlights; i < r_newrefdef.num_dlights; i++, light++) {
84  if (insubmodel) {
85  vec3_t temp;
86 
87  VectorSubtract(light->origin, currententity->origin, temp);
88  transformed[0] = DotProduct(temp, entity_rotation[0]);
89  transformed[1] = DotProduct(temp, entity_rotation[1]);
90  transformed[2] = DotProduct(temp, entity_rotation[2]);
91  } else {
92  VectorCopy(light->origin, transformed);
93  }
94  R_MarkLights_r(headnode, light, transformed, 1 << i);
95  }
96 }

Referenced by R_DrawBEntitiesOnList(), and R_RenderFrame().

◆ R_NewMap()

void R_NewMap ( void  )

Definition at line 331 of file main.c.

332 {
333  r_viewcluster = -1;
334 
335  if (auxsurfaces) {
337  auxsurfaces = NULL;
338  }
339 
340  if (auxedges) {
341  Z_Free(auxedges);
342  auxedges = NULL;
343  }
344 
346 
348  surfaces = auxsurfaces = R_Mallocz(r_cnumsurfs * sizeof(surf_t));
351  // surface 0 doesn't really exist; it's just a dummy because index 0
352  // is used to indicate no edge attached to surface
353  surfaces--;
354  }
355 
356  r_maxedgesseen = 0;
357  r_maxsurfsseen = 0;
358 
360 
362  auxedges = R_Mallocz(r_numallocatededges * sizeof(edge_t));
363  }
364 }

Referenced by R_BeginRegistration().

◆ R_PrintAliasStats()

void R_PrintAliasStats ( void  )

Definition at line 58 of file misc.c.

59 {
60  Com_Printf("%3i polygon model drawn\n", r_amodels_drawn);
61 }

Referenced by R_RenderFrame().

◆ R_PrintTimes()

void R_PrintTimes ( void  )

Definition at line 38 of file misc.c.

39 {
40  int r_time2;
41  int ms;
42 
43  r_time2 = Sys_Milliseconds();
44 
45  ms = r_time2 - r_time1;
46 
47  Com_Printf("%5i ms %3i/%3i/%3i poly %3i surf\n",
49  c_surf = 0;
50 }

Referenced by R_RenderFrame().

◆ R_RenderBmodelFace()

void R_RenderBmodelFace ( bedge_t pedges,
mface_t *  psurf 
)

Definition at line 477 of file raster.c.

478 {
479  int i;
480  unsigned mask;
481  cplane_t *pplane;
482  float distinv;
483  vec3_t p_normal;
484  medge_t tedge;
485  clipplane_t *pclip;
486  qboolean makeleftedge, makerightedge;
487 
488  if (psurf->texinfo->c.flags & SURF_TRANS_MASK) {
489  psurf->next = r_alpha_surfaces;
490  r_alpha_surfaces = psurf;
491  return;
492  }
493 
494 // skip out if no more surfs
495  if (surface_p >= surf_max) {
496  r_outofsurfaces++;
497  return;
498  }
499 
500 // ditto if not enough edges left, or switch to auxedges if possible
501  if ((edge_p + psurf->numsurfedges + 4) >= edge_max) {
502  r_outofedges += psurf->numsurfedges;
503  return;
504  }
505 
506  c_faceclip++;
507 
508 // this is a dummy to give the caching mechanism someplace to write to
509  r_pedge = &tedge;
510 
511 // set up clip planes
512  pclip = NULL;
513 
514  for (i = 3, mask = 0x08; i >= 0; i--, mask >>= 1) {
515  if (r_clipflags & mask) {
516  view_clipplanes[i].next = pclip;
517  pclip = &view_clipplanes[i];
518  }
519  }
520 
521 // push the edges through
522  r_emitted = 0;
523  r_nearzi = 0;
524  r_nearzionly = qfalse;
525  makeleftedge = makerightedge = qfalse;
526 // FIXME: keep clipped bmodel edges in clockwise order so last vertex caching
527 // can be used?
528  r_lastvertvalid = qfalse;
529 
530  for (; pedges; pedges = pedges->pnext) {
531  r_leftclipped = r_rightclipped = qfalse;
532  R_ClipEdge(pedges->v[0], pedges->v[1], pclip);
533 
534  if (r_leftclipped)
535  makeleftedge = qtrue;
536  if (r_rightclipped)
537  makerightedge = qtrue;
538  }
539 
540 // if there was a clip off the left edge, add that edge too
541 // FIXME: faster to do in screen space?
542 // FIXME: share clipped edges?
543  if (makeleftedge) {
544  r_pedge = &tedge;
546  }
547 
548 // if there was a clip off the right edge, get the right r_nearzi
549  if (makerightedge) {
550  r_pedge = &tedge;
551  r_nearzionly = qtrue;
553  }
554 
555 // if no edges made it out, return without posting the surface
556  if (!r_emitted)
557  return;
558 
559  r_polycount++;
560 
561  surface_p->msurf = psurf;
563  surface_p->flags = psurf->drawflags;
564  surface_p->insubmodel = qtrue;
565  surface_p->spanstate = 0;
568  surface_p->spans = NULL;
569 
570  pplane = psurf->plane;
571 // FIXME: cache this?
572  R_TransformVector(pplane->normal, p_normal);
573 // FIXME: cache this?
574  distinv = 1.0 / (pplane->dist - DotProduct(modelorg, pplane->normal));
575 
576  surface_p->d_zistepu = p_normal[0] * r_refdef.xscaleinv * distinv;
577  surface_p->d_zistepv = -p_normal[1] * r_refdef.yscaleinv * distinv;
578  surface_p->d_ziorigin = p_normal[2] * distinv -
581 
582  surface_p++;
583 }

Referenced by R_DrawSolidClippedSubmodelPolygons(), and R_RecursiveClipBPoly().

◆ R_RenderFace()

void R_RenderFace ( mface_t *  fa,
int  clipflags 
)

Definition at line 328 of file raster.c.

329 {
330  int i;
331  unsigned mask;
332  cplane_t *pplane;
333  float distinv;
334  vec3_t p_normal;
335  medge_t tedge;
336  msurfedge_t *surfedge;
337  clipplane_t *pclip;
338  qboolean makeleftedge, makerightedge;
339 
340  // translucent surfaces are not drawn by the edge renderer
341  if (fa->texinfo->c.flags & SURF_TRANS_MASK) {
342  fa->next = r_alpha_surfaces;
343  r_alpha_surfaces = fa;
344  return;
345  }
346 
347  // sky surfaces encountered in the world will cause the
348  // environment box surfaces to be emited
349  if (fa->texinfo->c.flags & SURF_SKY) {
350  R_EmitSkyBox();
351  return;
352  }
353 
354 // skip out if no more surfs
355  if ((surface_p) >= surf_max) {
356  r_outofsurfaces++;
357  return;
358  }
359 
360 // ditto if not enough edges left, or switch to auxedges if possible
361  if ((edge_p + fa->numsurfedges + 4) >= edge_max) {
362  r_outofedges += fa->numsurfedges;
363  return;
364  }
365 
366  c_faceclip++;
367 
368 // set up clip planes
369  pclip = NULL;
370 
371  for (i = 3, mask = 0x08; i >= 0; i--, mask >>= 1) {
372  if (clipflags & mask) {
373  view_clipplanes[i].next = pclip;
374  pclip = &view_clipplanes[i];
375  }
376  }
377 
378 // push the edges through
379  r_emitted = 0;
380  r_nearzi = 0;
381  r_nearzionly = qfalse;
382  makeleftedge = makerightedge = qfalse;
383  r_lastvertvalid = qfalse;
384 
385  surfedge = fa->firstsurfedge;
386  for (i = 0; i < fa->numsurfedges; i++, surfedge++) {
387  r_pedge = surfedge->edge;
388 
389  // if the edge is cached, we can just reuse the edge
390  if (!insubmodel) {
391  if (r_pedge->cachededgeoffset & FULLY_CLIPPED_CACHED) {
392  if ((r_pedge->cachededgeoffset & FRAMECOUNT_MASK) ==
393  r_framecount) {
394  r_lastvertvalid = qfalse;
395  continue;
396  }
397  } else {
398  if ((((byte *)edge_p - (byte *)r_edges) >
399  r_pedge->cachededgeoffset) &&
400  (((edge_t *)((byte *)r_edges +
401  r_pedge->cachededgeoffset))->owner == r_pedge)) {
403  r_lastvertvalid = qfalse;
404  continue;
405  }
406  }
407  }
408 
409  // assume it's cacheable
410  cacheoffset = (byte *)edge_p - (byte *)r_edges;
411  r_leftclipped = r_rightclipped = qfalse;
412  R_ClipEdge(r_pedge->v[surfedge->vert ],
413  r_pedge->v[surfedge->vert ^ 1],
414  pclip);
415  r_pedge->cachededgeoffset = cacheoffset;
416 
417  if (r_leftclipped)
418  makeleftedge = qtrue;
419  if (r_rightclipped)
420  makerightedge = qtrue;
421  r_lastvertvalid = qtrue;
422  }
423 
424 // if there was a clip off the left edge, add that edge too
425 // FIXME: faster to do in screen space?
426 // FIXME: share clipped edges?
427  if (makeleftedge) {
428  r_pedge = &tedge;
429  r_lastvertvalid = qfalse;
431  }
432 
433 // if there was a clip off the right edge, get the right r_nearzi
434  if (makerightedge) {
435  r_pedge = &tedge;
436  r_lastvertvalid = qfalse;
437  r_nearzionly = qtrue;
439  }
440 
441 // if no edges made it out, return without posting the surface
442  if (!r_emitted)
443  return;
444 
445  r_polycount++;
446 
447  surface_p->msurf = fa;
449  surface_p->flags = fa->drawflags;
451  surface_p->spanstate = 0;
454  surface_p->spans = NULL;
455 
456  pplane = fa->plane;
457 // FIXME: cache this?
458  R_TransformVector(pplane->normal, p_normal);
459 // FIXME: cache this?
460  distinv = 1.0 / (pplane->dist - DotProduct(modelorg, pplane->normal));
461 
462  surface_p->d_zistepu = p_normal[0] * r_refdef.xscaleinv * distinv;
463  surface_p->d_zistepv = -p_normal[1] * r_refdef.yscaleinv * distinv;
464  surface_p->d_ziorigin = p_normal[2] * distinv -
467 
468  surface_p++;
469 }

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

◆ R_RenderWorld()

void R_RenderWorld ( void  )

Definition at line 474 of file bsp.c.

475 {
476 
477  if (!r_drawworld->integer)
478  return;
479  if (r_newrefdef.rdflags & RDF_NOWORLDMODEL)
480  return;
481 
482  c_drawnode = 0;
483 
484  // auto cycle the world frame for texture animation
485  r_worldentity.frame = (int)(r_newrefdef.time * 2);
487 
488  VectorCopy(r_origin, modelorg);
489 
491 }

Referenced by R_EdgeDrawing().

◆ R_RotateBmodel()

void R_RotateBmodel ( void  )

Definition at line 71 of file bsp.c.

72 {
73  AnglesToAxis(currententity->angles, entity_rotation);
74 
75 //
76 // rotate modelorg and the transformation matrix
77 //
82 
84 }

Referenced by D_SolidSurf(), D_TurbulentSurf(), and R_DrawBEntitiesOnList().

◆ R_ScanEdges()

void R_ScanEdges ( void  )

Definition at line 556 of file edge.c.

557 {
558  int iv, bottom;
559  byte basespans[MAXSPANS * sizeof(espan_t) + CACHE_SIZE];
560  espan_t *basespan_p;
561  surf_t *s;
562 
563  basespan_p = (espan_t *)
564  ((uintptr_t)(basespans + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
565  max_span_p = &basespan_p[MAXSPANS - r_refdef.vrect.width];
566 
567  span_p = basespan_p;
568 
569 // clear active edges to just the background edges around the whole screen
570 // FIXME: most of this only needs to be set up once
571  edge_head.u = r_refdef.vrect.x << 20;
573  edge_head.u_step = 0;
574  edge_head.prev = NULL;
576  edge_head.surfs[0] = 0;
577  edge_head.surfs[1] = 1;
578 
579  edge_tail.u = (r_refdef.vrectright << 20) + 0xFFFFF;
581  edge_tail.u_step = 0;
584  edge_tail.surfs[0] = 1;
585  edge_tail.surfs[1] = 0;
586 
587  edge_aftertail.u = -1; // force a move
591 
592 // FIXME: do we need this now that we clamp x in r_draw.c?
593  edge_sentinel.u = 2000 << 20; // make sure nothing sorts past this
595 
596 //
597 // process all scan lines
598 //
599  bottom = r_refdef.vrectbottom - 1;
600 
601  for (iv = r_refdef.vrect.y; iv < bottom; iv++) {
602  current_iv = iv;
603  fv = (float)iv;
604 
605  // mark that the head (background start) span is pre-included
606  surfaces[1].spanstate = 1;
607 
608  if (newedges[iv]) {
610  }
611 
612  (*pdrawfunc)();
613 
614  // flush the span list if we can't be sure we have enough spans left for
615  // the next scan
616  if (span_p > max_span_p) {
617  D_DrawSurfaces();
618 
619  // clear the surface span pointers
620  for (s = &surfaces[1]; s < surface_p; s++)
621  s->spans = NULL;
622 
623  span_p = basespan_p;
624  }
625 
626  if (removeedges[iv])
628 
629  if (edge_head.next != &edge_tail)
631  }
632 
633 // do the last scan (no need to step or sort or remove on the last scan)
634 
635  current_iv = iv;
636  fv = (float)iv;
637 
638 // mark that the head (background start) span is pre-included
639  surfaces[1].spanstate = 1;
640 
641  if (newedges[iv])
643 
644  (*pdrawfunc)();
645 
646 // draw whatever's left in the span list
647  D_DrawSurfaces();
648 }

Referenced by R_EdgeDrawing().

◆ R_SetupFrame()

void R_SetupFrame ( void  )

Definition at line 243 of file misc.c.

244 {
245  int i;
246  vrect_t vrect;
247 
248  if (r_fullbright->modified) {
249  r_fullbright->modified = qfalse;
250  D_FlushCaches(); // so all lighting changes
251  }
252 
253  r_framecount++;
254 
255 
256 // build the transformation matrix for the given view angles
257  VectorCopy(r_newrefdef.vieworg, modelorg);
258  VectorCopy(r_newrefdef.vieworg, r_origin);
259 
260  AngleVectors(r_newrefdef.viewangles, vpn, vright, vup);
261 
262 // current viewleaf
263  if (!(r_newrefdef.rdflags & RDF_NOWORLDMODEL)) {
265  r_viewcluster = r_viewleaf->cluster;
266  }
267 
268  if (sw_waterwarp->integer && (r_newrefdef.rdflags & RDF_UNDERWATER))
269  r_dowarp = qtrue;
270  else
271  r_dowarp = qfalse;
272 
273  if (r_dowarp) {
274  // warp into off screen buffer
275  vrect.x = 0;
276  vrect.y = 0;
277  vrect.width = r_newrefdef.width < WARP_WIDTH ? r_newrefdef.width : WARP_WIDTH;
278  vrect.height = r_newrefdef.height < WARP_HEIGHT ? r_newrefdef.height : WARP_HEIGHT;
279 
282  } else {
283  vrect.x = r_newrefdef.x;
284  vrect.y = r_newrefdef.y;
285  vrect.width = r_newrefdef.width;
286  vrect.height = r_newrefdef.height;
287 
288  d_viewbuffer = (void *)vid.buffer;
290  }
291 
292  R_ViewChanged(&vrect);
293 
294 // start off with just the four screen edge clip planes
297 
298 // save base values
299  VectorCopy(vpn, base_vpn);
300  VectorCopy(vright, base_vright);
301  VectorCopy(vup, base_vup);
302 
303 // clear frame counts
304  c_faceclip = 0;
305  r_polycount = 0;
306  r_drawnpolycount = 0;
307  r_wholepolycount = 0;
308  r_amodels_drawn = 0;
309  r_outofsurfaces = 0;
310  r_outofedges = 0;
311 
312 // d_setup
313  for (i = 0; i < vid.height; i++) {
315  d_zspantable[i] = d_pzbuffer + i * d_zwidth;
316  }
317 
318 // clear Z-buffer and color-buffers if we're doing the gallery
319  if (r_newrefdef.rdflags & RDF_NOWORLDMODEL) {
320  memset(d_pzbuffer, 0xff, vid.width * vid.height * sizeof(d_pzbuffer[0]));
321 #if 0
322  R_DrawFill8(r_newrefdef.x, r_newrefdef.y, r_newrefdef.width, r_newrefdef.height, /*(int)sw_clearcolor->value & 0xff*/0);
323 #endif
324  }
325 
327 
328  for (i = 0; i < (NUM_MIPS - 1); i++)
329  d_scalemip[i] = basemip[i] * sw_mipscale->value;
330 }

Referenced by R_RenderFrame().

◆ R_ShutdownImages()

void R_ShutdownImages ( void  )

Definition at line 180 of file image.c.

181 {
182  IMG_FreeAll();
183 }

Referenced by R_Shutdown().

◆ R_TransformFrustum()

void R_TransformFrustum ( void  )

Definition at line 70 of file misc.c.

71 {
72  int i;
73  vec3_t v, v2;
74 
75  for (i = 0; i < 4; i++) {
76  v[0] = screenedge[i].normal[2];
77  v[1] = -screenedge[i].normal[0];
78  v[2] = screenedge[i].normal[1];
79 
80  v2[0] = v[1] * vright[0] + v[2] * vup[0] + v[0] * vpn[0];
81  v2[1] = v[1] * vright[1] + v[2] * vup[1] + v[0] * vpn[1];
82  v2[2] = v[1] * vright[2] + v[2] * vup[2] + v[0] * vpn[2];
83 
84  VectorCopy(v2, view_clipplanes[i].normal);
85 
86  view_clipplanes[i].dist = DotProduct(modelorg, v2);
87  }
88 }

Referenced by D_DrawSurfaces(), D_SolidSurf(), D_TurbulentSurf(), R_DrawBEntitiesOnList(), R_RotateBmodel(), and R_SetupFrame().

◆ R_TransformPlane()

void R_TransformPlane ( cplane_t *  p,
float *  normal,
float *  dist 
)

◆ R_TransformVector()

void R_TransformVector ( vec3_t  in,
vec3_t  out 
)

Definition at line 96 of file misc.c.

97 {
98  out[0] = DotProduct(in, vright);
99  out[1] = DotProduct(in, vup);
100  out[2] = DotProduct(in, vpn);
101 }

Referenced by D_CalcGradients(), D_DrawSurfaces(), D_SolidSurf(), D_TurbulentSurf(), R_ClipAndDrawPoly(), R_EmitEdge(), R_PolygonCalculateGradients(), R_RenderBmodelFace(), and R_RenderFace().

Variable Documentation

◆ aliastriangleparms

aliastriangleparms_t aliastriangleparms

Definition at line 47 of file polyset.c.

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

◆ auxedges

edge_t* auxedges

Definition at line 31 of file edge.c.

Referenced by R_EdgeDrawing(), R_NewMap(), and R_Shutdown().

◆ auxsurfaces

surf_t* auxsurfaces

Definition at line 34 of file edge.c.

Referenced by R_EdgeDrawing(), R_NewMap(), and R_Shutdown().

◆ base_vpn

vec3_t base_vpn

Definition at line 361 of file sw.h.

◆ base_vright

vec3_t base_vright

Definition at line 362 of file sw.h.

◆ base_vup

vec3_t base_vup

Definition at line 360 of file sw.h.

◆ bbextents

fixed16_t bbextents

◆ bbextentt

fixed16_t bbextentt

Definition at line 327 of file sw.h.

◆ blanktable

int blanktable[CYCLE *2]

Definition at line 135 of file main.c.

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

◆ blocklights

Definition at line 207 of file light.c.

Referenced by R_AddDynamicLights(), and R_BuildLightMap().

◆ c_faceclip

int c_faceclip

Definition at line 35 of file raster.c.

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

◆ c_surf

int c_surf

Definition at line 42 of file main.c.

Referenced by D_CacheSurface(), and R_PrintTimes().

◆ cacheblock

◆ cachewidth

◆ currententity

◆ currentmodel

model_t* currentmodel

◆ d_minmip

int d_minmip

Definition at line 27 of file misc.c.

Referenced by D_MipLevelForScale(), and R_SetupFrame().

◆ d_pzbuffer

short* d_pzbuffer

Definition at line 127 of file main.c.

Referenced by R_ApplySIRDAlgorithum(), R_ModeChanged(), R_SetupFrame(), and R_Shutdown().

◆ d_scalemip

float d_scalemip[3]

Definition at line 28 of file misc.c.

Referenced by D_MipLevelForScale(), and R_SetupFrame().

◆ d_screenrowbytes

int d_screenrowbytes

Definition at line 126 of file main.c.

Referenced by R_DrawParticle(), R_PolysetSetUpAndScanLeftEdge(), and R_SetupFrame().

◆ d_sdivzorigin

float d_sdivzorigin

◆ d_sdivzstepu

float d_sdivzstepu

◆ d_sdivzstepv

float d_sdivzstepv

◆ d_spantable

◆ d_tdivzorigin

float d_tdivzorigin

Definition at line 324 of file sw.h.

◆ d_tdivzstepu

float d_tdivzstepu

Definition at line 322 of file sw.h.

◆ d_tdivzstepv

float d_tdivzstepv

Definition at line 323 of file sw.h.

◆ d_viewbuffer

pixel_t* d_viewbuffer

Definition at line 125 of file main.c.

Referenced by R_SetupFrame().

◆ d_ziorigin

float d_ziorigin

Definition at line 324 of file sw.h.

◆ d_zistepu

float d_zistepu

Definition at line 322 of file sw.h.

◆ d_zistepv

float d_zistepv

Definition at line 323 of file sw.h.

◆ d_zrowbytes

int d_zrowbytes

Definition at line 128 of file main.c.

Referenced by R_ModeChanged().

◆ d_zspantable

short* d_zspantable[MAXHEIGHT]

◆ d_zwidth

int d_zwidth

Definition at line 129 of file main.c.

Referenced by R_DrawParticle(), R_ModeChanged(), R_PolysetSetUpAndScanLeftEdge(), and R_SetupFrame().

◆ edge_max

edge_t * edge_max

Definition at line 479 of file sw.h.

◆ edge_p

edge_t * edge_p

Definition at line 479 of file sw.h.

◆ entity_rotation

vec3_t entity_rotation[3]

◆ insubmodel

qboolean insubmodel

Definition at line 25 of file bsp.c.

Referenced by R_DrawBEntitiesOnList(), R_EmitSkyBox(), R_MarkLights(), and R_RenderFace().

◆ intsintable

int intsintable[CYCLE *2]

Definition at line 134 of file main.c.

Referenced by D_WarpScreen(), and R_InitTurb().

◆ modelorg

◆ newedges

edge_t* newedges[MAXHEIGHT]

Definition at line 41 of file edge.c.

Referenced by R_BeginEdgeFrame(), R_EmitEdge(), and R_ScanEdges().

◆ pfrustum_indexes

int* pfrustum_indexes[4]

Definition at line 70 of file main.c.

Referenced by R_BmodelCheckBBox(), R_RecursiveWorldNode(), and R_SetUpFrustumIndexes().

◆ 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_alpha_surfaces

mface_t* r_alpha_surfaces

Definition at line 41 of file poly.c.

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

◆ 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_clipflags

int r_clipflags

Definition at line 44 of file main.c.

Referenced by R_DrawBEntitiesOnList(), and R_RenderBmodelFace().

◆ r_cnumsurfs

int r_cnumsurfs

Definition at line 502 of file sw.h.

◆ r_currentbkey

int r_currentbkey

Definition at line 34 of file bsp.c.

Referenced by R_RecursiveClipBPoly(), and R_RenderBmodelFace().

◆ r_currentkey

int r_currentkey

◆ r_dlightframecount

int r_dlightframecount

Definition at line 22 of file light.c.

Referenced by R_DrawBEntitiesOnList(), R_MarkLights(), and R_MarkLights_r().

◆ r_dowarp

qboolean r_dowarp

Definition at line 40 of file main.c.

Referenced by R_ApplySIRDAlgorithum(), R_RenderFrame(), and R_SetupFrame().

◆ r_drawentities

cvar_t* r_drawentities

Definition at line 97 of file main.c.

Referenced by R_DrawBEntitiesOnList(), R_DrawEntitiesOnList(), and R_Register().

◆ r_drawnpolycount

int r_drawnpolycount

Definition at line 67 of file main.c.

Referenced by D_DrawSurfaces(), R_PrintTimes(), and R_SetupFrame().

◆ r_drawsurf

drawsurf_t r_drawsurf

Definition at line 22 of file surf.c.

Referenced by D_CacheSurface(), R_AddDynamicLights(), R_BuildLightMap(), and R_DrawSurface().

◆ r_drawworld

cvar_t* r_drawworld

Definition at line 96 of file main.c.

Referenced by R_Register(), and R_RenderWorld().

◆ r_edges

edge_t* r_edges

Definition at line 32 of file edge.c.

Referenced by R_BeginEdgeFrame(), R_EdgeDrawing(), R_EmitCachedEdge(), and R_RenderFace().

◆ r_entorigin

vec3_t r_entorigin

Definition at line 29 of file bsp.c.

Referenced by R_DrawBEntitiesOnList(), R_DrawEntities(), R_DrawSprite(), and R_RecursiveClipBPoly().

◆ r_framecount

◆ r_frustum_indexes

int r_frustum_indexes[4 *6]

Definition at line 71 of file main.c.

Referenced by R_SetUpFrustumIndexes().

◆ r_fullbright

cvar_t* r_fullbright

Definition at line 98 of file main.c.

Referenced by R_BuildLightMap(), R_LightPoint(), R_Register(), and R_SetupFrame().

◆ r_lerpmodels

cvar_t* r_lerpmodels

Definition at line 99 of file main.c.

Referenced by R_AliasDrawModel(), and R_Register().

◆ r_maxedgesseen

int r_maxedgesseen

Definition at line 502 of file sw.h.

◆ r_maxsurfsseen

int r_maxsurfsseen

Definition at line 43 of file main.c.

Referenced by R_NewMap().

◆ r_maxvalidedgeoffset

int r_maxvalidedgeoffset

◆ r_newrefdef

◆ r_numallocatededges

int r_numallocatededges

Definition at line 36 of file main.c.

Referenced by R_BeginEdgeFrame(), and R_NewMap().

◆ r_oldviewcluster

int r_oldviewcluster

Definition at line 506 of file sw.h.

◆ r_origin

◆ r_outofedges

int r_outofedges

Definition at line 38 of file main.c.

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

◆ r_outofsurfaces

int r_outofsurfaces

Definition at line 37 of file main.c.

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

◆ r_polycount

int r_polycount

Definition at line 66 of file main.c.

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

◆ r_ptverts

mvertex_t* r_ptverts

◆ r_ptvertsmax

mvertex_t * r_ptvertsmax

Definition at line 469 of file sw.h.

◆ r_refdef

◆ r_speeds

cvar_t* r_speeds

Definition at line 102 of file main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ r_surfsonstack

qboolean r_surfsonstack

◆ r_time1

float r_time1

Definition at line 35 of file main.c.

Referenced by R_PrintTimes(), and R_RenderFrame().

◆ r_viewcluster

int r_viewcluster

Definition at line 74 of file main.c.

Referenced by R_MarkLeaves(), R_NewMap(), and R_SetupFrame().

◆ r_viewleaf

mleaf_t* r_viewleaf

Definition at line 73 of file main.c.

Referenced by R_SetupFrame().

◆ r_visframecount

int r_visframecount

Definition at line 65 of file main.c.

Referenced by R_FindTopnode(), R_MarkLeaves(), R_RecursiveClipBPoly(), and R_RecursiveWorldNode().

◆ r_warpbuffer

byte r_warpbuffer[WARP_WIDTH *WARP_HEIGHT *VID_BYTES]

Definition at line 33 of file main.c.

Referenced by D_WarpScreen(), and R_SetupFrame().

◆ r_wholepolycount

int r_wholepolycount

Definition at line 68 of file main.c.

Referenced by R_SetupFrame().

◆ r_worldentity

entity_t r_worldentity

Definition at line 26 of file main.c.

Referenced by D_SolidSurf(), R_AddDynamicLights(), and R_RenderWorld().

◆ r_worldmodel

◆ removeedges

edge_t* removeedges[MAXHEIGHT]

Definition at line 42 of file edge.c.

Referenced by R_BeginEdgeFrame(), R_EmitEdge(), and R_ScanEdges().

◆ sadjust

fixed16_t sadjust

◆ screenedge

cplane_t screenedge[4]

Definition at line 59 of file main.c.

Referenced by R_TransformFrustum(), and R_ViewChanged().

◆ sintable

int sintable[CYCLE *2]

Definition at line 133 of file main.c.

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

◆ surf_max

surf_t * surf_max

Definition at line 365 of file sw.h.

◆ surface_p

surf_t * surface_p

Definition at line 365 of file sw.h.

◆ surfaces

◆ sw_aliasstats

cvar_t* sw_aliasstats

Definition at line 76 of file main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_clearcolor

cvar_t* sw_clearcolor

Definition at line 77 of file main.c.

Referenced by D_BackgroundSurf(), and R_Register().

◆ sw_drawflat

cvar_t* sw_drawflat

Definition at line 78 of file main.c.

Referenced by D_DrawSurfaces(), and R_Register().

◆ sw_draworder

cvar_t* sw_draworder

Definition at line 79 of file main.c.

Referenced by R_BeginEdgeFrame(), and R_Register().

◆ sw_drawsird

cvar_t* sw_drawsird

Definition at line 93 of file main.c.

Referenced by D_DrawSurfaces(), R_ApplySIRDAlgorithum(), R_Register(), and R_RenderFrame().

◆ sw_dynamic

cvar_t* sw_dynamic

Definition at line 86 of file main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_maxedges

cvar_t* sw_maxedges

Definition at line 80 of file main.c.

Referenced by R_NewMap(), and R_Register().

◆ sw_maxsurfs

cvar_t* sw_maxsurfs

Definition at line 81 of file main.c.

Referenced by R_NewMap(), and R_Register().

◆ sw_mipcap

cvar_t* sw_mipcap

Definition at line 24 of file misc.c.

Referenced by R_Register(), and R_SetupFrame().

◆ sw_mipscale

cvar_t* sw_mipscale

Definition at line 25 of file misc.c.

Referenced by R_Register(), and R_SetupFrame().

◆ sw_mode

cvar_t* sw_mode

◆ sw_modulate

cvar_t* sw_modulate

Definition at line 87 of file main.c.

Referenced by D_CacheSurface(), R_AddDynamicLights(), R_LightPoint(), and R_Register().

◆ sw_reportedgeout

cvar_t* sw_reportedgeout

Definition at line 82 of file main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_reportsurfout

cvar_t* sw_reportsurfout

Definition at line 83 of file main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_surfcacheoverride

cvar_t* sw_surfcacheoverride

Definition at line 84 of file main.c.

Referenced by R_InitCaches(), and R_ModeChanged().

◆ sw_waterwarp

cvar_t* sw_waterwarp

Definition at line 85 of file main.c.

Referenced by R_Register(), and R_SetupFrame().

◆ sxformaxis

vec3_t sxformaxis[4]

◆ tadjust

fixed16_t tadjust

Definition at line 326 of file sw.h.

◆ txformaxis

vec3_t txformaxis[4]

◆ vid

◆ vid_fullscreen

◆ vid_gamma

cvar_t* vid_gamma

Definition at line 104 of file main.c.

Referenced by R_BuildGammaTable(), and R_Register().

◆ view_clipplanes

◆ vpn

◆ vright

◆ vup

oldrefdef_t::xcenter
float xcenter
Definition: sw.h:145
pbedges
static bedge_t * pbedges
Definition: bsp.c:40
base_vright
vec3_t base_vright
Definition: main.c:51
sc_base
static surfcache_t * sc_base
Definition: surf.c:47
MAXSPANS
#define MAXSPANS
Definition: sw.h:84
d_viewbuffer
pixel_t * d_viewbuffer
Definition: main.c:125
surfcache_s::size
int size
Definition: sw.h:212
r_nearzionly
static qboolean r_nearzionly
Definition: raster.c:42
drawsurf_s::surfheight
int surfheight
Definition: sw.h:184
espan_s
Definition: sw.h:220
blocklight_t
int blocklight_t
Definition: sw.h:205
r_dlightframecount
int r_dlightframecount
Definition: light.c:22
MAXWIDTH
#define MAXWIDTH
Definition: sw.h:58
r_origin
vec3_t r_origin
Definition: main.c:52
r_emitted
static int r_emitted
Definition: raster.c:47
IMG_GetPalette
void IMG_GetPalette(void)
Definition: images.c:1376
NUMSTACKSURFACES
#define NUMSTACKSURFACES
Definition: sw.h:81
box_edges
static const int box_edges[24]
Definition: sky.c:47
MINSURFACES
#define MINSURFACES
Definition: sw.h:82
r_leftenter
static mvertex_t r_leftenter
Definition: raster.c:44
SPEED
#define SPEED
Definition: sw.h:110
r_nearzi
static float r_nearzi
Definition: raster.c:48
IMG_FreeAll
void IMG_FreeAll(void)
Definition: images.c:1343
r_newrefdef
refdef_t r_newrefdef
Definition: main.c:28
MAX_BMODEL_EDGES
#define MAX_BMODEL_EDGES
Definition: bsp.c:37
miplevel
static int miplevel
Definition: edge.c:61
surfcache_s
Definition: sw.h:207
finalvert_s::u
int u
Definition: sw.h:163
cacheoffset
static uintptr_t cacheoffset
Definition: raster.c:33
R_AliasSetupLighting
static void R_AliasSetupLighting(void)
Definition: alias.c:491
R_MarkLights_r
static void R_MarkLights_r(mnode_t *node, dlight_t *light, vec3_t transformed, int bit)
Definition: light.c:38
viddef_t::buffer
pixel_t * buffer
Definition: sw.h:124
d_sdivzstepv
float d_sdivzstepv
Definition: main.c:117
sw_maxsurfs
cvar_t * sw_maxsurfs
Definition: main.c:81
r_polydesc
static polydesc_t r_polydesc
Definition: poly.c:39
R_ClipAndDrawPoly
static void R_ClipAndDrawPoly(float alpha, int isturbulent, int textured)
Definition: poly.c:533
r_edges
edge_t * r_edges
Definition: edge.c:32
r_p2
static int r_p2[6]
Definition: polyset.c:49
r_skyedges
static medge_t r_skyedges[12]
Definition: sky.c:30
BBOX_TRIVIAL_REJECT
#define BBOX_TRIVIAL_REJECT
Definition: alias.c:48
entity_rotation
vec3_t entity_rotation[3]
Definition: bsp.c:32
r_SIRDBackground
static byte r_SIRDBackground[R_SIRDw *R_SIRDh *VID_BYTES]
Definition: sird.c:67
aliastriangleparms_t::b
finalvert_t * b
Definition: sw.h:294
basemip
static const float basemip[NUM_MIPS - 1]
Definition: misc.c:30
DPS_MAXSPANS
#define DPS_MAXSPANS
Definition: polyset.c:24
sc_size
static int sc_size
Definition: surf.c:46
r_cnumsurfs
int r_cnumsurfs
Definition: main.c:43
D_BackgroundSurf
static void D_BackgroundSurf(surf_t *s)
Definition: edge.c:777
fv
static float fv
Definition: edge.c:59
transformed_modelorg
static vec3_t transformed_modelorg
Definition: edge.c:659
R_Alias_clip_top
static void R_Alias_clip_top(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: aclip.c:92
box_surfverts
static const int box_surfverts[24]
Definition: sky.c:44
R_TextureAnimation
static image_t * R_TextureAnimation(mtexinfo_t *tex)
Definition: surf.c:56
R_AliasSetUpTransform
static void R_AliasSetUpTransform(void)
Definition: alias.c:387
TURB_MASK
#define TURB_MASK
Definition: sw.h:72
surf_s::flags
int flags
Definition: sw.h:252
base_vup
vec3_t base_vup
Definition: main.c:49
cacheblock
pixel_t * cacheblock
Definition: main.c:122
box_planes
static const int box_planes[12]
Definition: sky.c:38
TEX_BYTES
#define TEX_BYTES
Definition: sw.h:50
viddef_t::width
int width
Definition: sw.h:127
pdrawfunc
static void(* pdrawfunc)(void)
Definition: edge.c:52
r_drawworld
cvar_t * r_drawworld
Definition: main.c:96
r_viewcluster
int r_viewcluster
Definition: main.c:74
surfcache_s::lightadj
int lightadj[MAX_LIGHTMAPS]
Definition: sw.h:210
R_RasterizeAliasPolySmooth
static void R_RasterizeAliasPolySmooth(void)
Definition: polyset.c:595
sw_surfcacheoverride
cvar_t * sw_surfcacheoverride
Definition: main.c:84
r_framecount
int r_framecount
Definition: main.c:64
R_AliasPreparePoints
static void R_AliasPreparePoints(void)
Definition: alias.c:274
espan_s::pnext
struct espan_s * pnext
Definition: sw.h:222
CYCLE
#define CYCLE
Definition: sw.h:74
R_AliasSetUpLerpData
static void R_AliasSetUpLerpData(float backlerp)
Definition: alias.c:575
polydesc_t::pixel_width
int pixel_width
Definition: sw.h:230
R_AddDynamicLights
static void R_AddDynamicLights(void)
Definition: light.c:214
d_screenrowbytes
int d_screenrowbytes
Definition: main.c:126
R_DrawParticle
static void R_DrawParticle(void)
Definition: part.c:43
partparms_t::right
vec3_t right
Definition: part.c:25
oldrefdef_t::xscaleinv
float xscaleinv
Definition: sw.h:147
drawStatic_t::colors
color_t colors[2]
Definition: gl.h:402
viddef_t::height
int height
Definition: sw.h:128
r_refdef
oldrefdef_t r_refdef
Definition: main.c:57
edge_s::surfs
uint16_t surfs[2]
Definition: sw.h:264
d_zistepu
float d_zistepu
Definition: main.c:116
polydesc_t::alpha
int alpha
Definition: sw.h:237
F
#define F(name)
Definition: g_save.c:46
c_surf
int c_surf
Definition: main.c:42
d_8to24table
uint32_t d_8to24table[256]
Definition: images.c:654
R_DrawFill8
void(* R_DrawFill8)(int x, int y, int w, int h, int c)
Definition: refresh.c:422
r_rightclipped
static qboolean r_rightclipped
Definition: raster.c:41
surf_s::msurf
mface_t * msurf
Definition: sw.h:253
AMP2
#define AMP2
Definition: sw.h:109
oldrefdef_t::xscaleshrink
float xscaleshrink
Definition: sw.h:148
finalvert_s::t
int t
Definition: sw.h:163
MAXSURFACES
#define MAXSURFACES
Definition: sw.h:83
DSURF_BACKGROUND
#define DSURF_BACKGROUND
Definition: sw.h:45
AMP
#define AMP
Definition: sw.h:108
surfcache_s::image
image_t * image
Definition: sw.h:216
FRAMECOUNT_MASK
#define FRAMECOUNT_MASK
Definition: raster.c:30
R_Alias_clip_right
static void R_Alias_clip_right(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: aclip.c:69
partparms_t::one_minus_alpha
int one_minus_alpha
Definition: part.c:24
_R_LightPoint
static qboolean _R_LightPoint(vec3_t start, vec3_t color)
Definition: light.c:106
R_EmitSkyBox
void R_EmitSkyBox(void)
Definition: sky.c:116
MINEDGES
#define MINEDGES
Definition: sw.h:79
oldrefdef_t::yscale
float yscale
Definition: sw.h:146
r_dowarp
qboolean r_dowarp
Definition: main.c:40
R_GenerateSpans
static void R_GenerateSpans(void)
Definition: edge.c:490
polydesc_t::vpn
vec3_t vpn
Definition: sw.h:232
R_AliasSetupBlend
static void R_AliasSetupBlend(void)
Definition: alias.c:612
r_amodels_drawn
int r_amodels_drawn
Definition: alias.c:25
r_rightenter
static mvertex_t r_rightenter
Definition: raster.c:45
ALIAS_BOTTOM_CLIP
#define ALIAS_BOTTOM_CLIP
Definition: sw.h:90
finalvert_s
Definition: sw.h:162
polydesc_t::viewer_position
float viewer_position[3]
Definition: sw.h:235
r_viewleaf
mleaf_t * r_viewleaf
Definition: main.c:73
sw_mipcap
cvar_t * sw_mipcap
Definition: misc.c:24
removeedges
edge_t * removeedges[MAXHEIGHT]
Definition: edge.c:42
R_EntityRotate
static void R_EntityRotate(vec3_t vec)
Definition: bsp.c:55
r_leftexit
static mvertex_t r_leftexit
Definition: raster.c:44
R_RenderFace
void R_RenderFace(mface_t *fa, int clipflags)
Definition: raster.c:328
r_SIRDrandValues
static const byte r_SIRDrandValues[]
Definition: sird.c:70
blanktable
int blanktable[CYCLE *2]
Definition: main.c:135
r_maxedgesseen
int r_maxedgesseen
Definition: main.c:43
R_AliasSetupSkin
static void R_AliasSetupSkin(void)
Definition: alias.c:454
vup
vec3_t vup
Definition: main.c:49
c_faceclip
int c_faceclip
Definition: raster.c:35
Sys_Milliseconds
unsigned Sys_Milliseconds(void)
Definition: system.c:644
R_RecursiveWorldNode
static void R_RecursiveWorldNode(mnode_t *node, int clipflags)
Definition: bsp.c:351
surf_s::spans
struct espan_s * spans
Definition: sw.h:246
BSP_PointLeaf
mleaf_t * BSP_PointLeaf(mnode_t *node, vec3_t p)
Definition: bsp.c:1439
espan_s::count
int count
Definition: sw.h:221
R_BuildPolygonFromSurface
static void R_BuildPolygonFromSurface(mface_t *fa)
Definition: poly.c:605
finalvert_s::v
int v
Definition: sw.h:163
edge_p
edge_t * edge_p
Definition: edge.c:32
edge_sentinel
static edge_t edge_sentinel
Definition: edge.c:57
polydesc_t::pixels
byte * pixels
Definition: sw.h:229
edge_s::next
struct edge_s * next
Definition: sw.h:263
sw_draworder
cvar_t * sw_draworder
Definition: main.c:79
espan_t
struct espan_s espan_t
D_TurbulentSurf
static void D_TurbulentSurf(surf_t *s)
Definition: edge.c:794
polydesc_t::t_offset
float t_offset
Definition: sw.h:234
r_polycount
int r_polycount
Definition: main.c:66
D_DrawSurfaces
void D_DrawSurfaces(void)
Definition: edge.c:1001
draw
drawStatic_t draw
Definition: draw.c:21
D_DrawflatSurfaces
static void D_DrawflatSurfaces(void)
Definition: edge.c:952
numbverts
static int numbverts
Definition: bsp.c:41
bedge_s::pnext
struct bedge_s * pnext
Definition: sw.h:190
r_fullbright
cvar_t * r_fullbright
Definition: main.c:98
r_outofedges
int r_outofedges
Definition: main.c:38
ALIAS_RIGHT_CLIP
#define ALIAS_RIGHT_CLIP
Definition: sw.h:89
polydesc_t::s_offset
float s_offset
Definition: sw.h:234
partparms_t::particle
particle_t * particle
Definition: part.c:22
vec3_origin
vec3_t vec3_origin
Definition: shared.c:21
partparms_t::pn
vec3_t pn
Definition: part.c:25
cachewidth
int cachewidth
Definition: main.c:123
currententity
entity_t * currententity
Definition: bsp.c:26
bbextentt
fixed16_t bbextentt
Definition: main.c:120
partparms_t::color
fixed8_t color[3]
Definition: part.c:23
WARP_WIDTH
#define WARP_WIDTH
Definition: sw.h:64
sw_maxedges
cvar_t * sw_maxedges
Definition: main.c:80
r_pedge
static medge_t * r_pedge
Definition: raster.c:39
screenedge
cplane_t screenedge[4]
Definition: main.c:59
box_flags
static const int box_flags[6]
Definition: sky.c:50
gammatable
static byte gammatable[256]
Definition: image.c:21
surf_s::entity
entity_t * entity
Definition: sw.h:254
viddef_t::rowbytes
int rowbytes
Definition: sw.h:125
edge_tail
static edge_t edge_tail
Definition: edge.c:55
r_numallocatededges
int r_numallocatededges
Definition: main.c:36
drawsurf_s::surf
mface_t * surf
Definition: sw.h:179
sw_drawflat
cvar_t * sw_drawflat
Definition: main.c:78
Com_Error
void Com_Error(error_type_t type, const char *fmt,...)
Definition: g_main.c:258
R_RecursiveClipBPoly
static void R_RecursiveClipBPoly(bedge_t *pedges, mnode_t *pnode, mface_t *psurf)
Definition: bsp.c:94
R_BuildLightMap
void R_BuildLightMap(void)
Definition: light.c:290
newedges
edge_t * newedges[MAXHEIGHT]
Definition: edge.c:41
edge_s::u_step
fixed16_t u_step
Definition: sw.h:262
numbedges
static int numbedges
Definition: bsp.c:41
d_xdenom
static int d_xdenom
Definition: polyset.c:51
NUM_MIPS
#define NUM_MIPS
Definition: misc.c:22
R_AliasClip
static int R_AliasClip(finalvert_t *in, finalvert_t *out, int flag, int count, void(*clip)(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out))
Definition: aclip.c:141
espan_s::v
int v
Definition: sw.h:221
polydesc_t::nump
int nump
Definition: sw.h:227
r_skyplanes
static cplane_t r_skyplanes[6]
Definition: sky.c:27
d_tdivzorigin
float d_tdivzorigin
Definition: main.c:118
pixel_t
unsigned char pixel_t
Definition: sw.h:121
R_BuildGammaTable
void R_BuildGammaTable(void)
Definition: image.c:109
intsintable
int intsintable[CYCLE *2]
Definition: main.c:134
r_clip_verts
static vec5_t r_clip_verts[2][MAXWORKINGVERTS+2]
Definition: poly.c:46
NUMSTACKEDGES
#define NUMSTACKEDGES
Definition: sw.h:78
vpn
vec3_t vpn
Definition: main.c:50
d_minmip
int d_minmip
Definition: misc.c:27
drawsurf_s::lightadj
fixed8_t lightadj[MAX_LIGHTMAPS]
Definition: sw.h:180
world_transformed_modelorg
static vec3_t world_transformed_modelorg
Definition: edge.c:660
drawsurf_s::rowbytes
int rowbytes
Definition: sw.h:178
R_SetUpFrustumIndexes
static void R_SetUpFrustumIndexes(void)
Definition: misc.c:125
ALIAS_LEFT_CLIP
#define ALIAS_LEFT_CLIP
Definition: sw.h:87
DSURF_SKY
#define DSURF_SKY
Definition: sw.h:43
DSURF_TURB
#define DSURF_TURB
Definition: sw.h:44
surf_s::nearzi
float nearzi
Definition: sw.h:255
surfcache_s::mipscale
float mipscale
Definition: sw.h:215
edge_tail_u_shift20
static int edge_tail_u_shift20
Definition: edge.c:50
Z_Free
void Z_Free(void *ptr)
Definition: zone.c:147
d_scalemip
float d_scalemip[NUM_MIPS - 1]
Definition: misc.c:28
polydesc_t::dist
float dist
Definition: sw.h:233
D_SolidSurf
static void D_SolidSurf(surf_t *s)
Definition: edge.c:889
d_spantable
byte * d_spantable[MAXHEIGHT]
Definition: main.c:130
ALIAS_Z_CLIP
#define ALIAS_Z_CLIP
Definition: sw.h:91
clipplane_s::next
struct clipplane_s * next
Definition: sw.h:196
drawsurf_s::image
image_t * image
Definition: sw.h:181
surfcache_s::owner
struct surfcache_s ** owner
Definition: sw.h:209
CACHE_SIZE
#define CACHE_SIZE
Definition: sw.h:47
r_time1
float r_time1
Definition: main.c:35
a_spans
static spanpackage_t * a_spans
Definition: polyset.c:77
origin
static vec3_t origin
Definition: mesh.c:27
R_AliasSetupFrames
static void R_AliasSetupFrames(void)
Definition: alias.c:550
clipplane_s
Definition: sw.h:193
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: shared.c:23
d_zwidth
int d_zwidth
Definition: main.c:129
espan_s::u
int u
Definition: sw.h:221
edge_s::u
fixed16_t u
Definition: sw.h:261
box_axis
static const vec3_t box_axis[6][2]
Definition: sky.c:53
d_zspantable
short * d_zspantable[MAXHEIGHT]
Definition: main.c:131
d_tdivzstepv
float d_tdivzstepv
Definition: main.c:117
pbverts
static mvertex_t * pbverts
Definition: bsp.c:39
edge_head_u_shift20
static int edge_head_u_shift20
Definition: edge.c:50
drawStatic_t::clip
clipRect_t clip
Definition: draw.c:92
TURB_SIZE
#define TURB_SIZE
Definition: sw.h:71
R_TransformFrustum
void R_TransformFrustum(void)
Definition: misc.c:70
finalvert_s::zi
int zi
Definition: sw.h:165
r_skyverts
static mvertex_t r_skyverts[8]
Definition: sky.c:29
R_RemoveEdges
static void R_RemoveEdges(edge_t *pedge)
Definition: edge.c:156
R_SIRDh
#define R_SIRDh
Definition: sird.c:36
partparms_t::up
vec3_t up
Definition: part.c:25
bedge_s
Definition: sw.h:188
c_drawnode
int c_drawnode
Definition: bsp.c:344
sintable
int sintable[CYCLE *2]
Definition: main.c:133
r_skysurfedges
static msurfedge_t r_skysurfedges[24]
Definition: sky.c:31
ALIAS_TOP_CLIP
#define ALIAS_TOP_CLIP
Definition: sw.h:88
R_CreateNotexture
static void R_CreateNotexture(void)
Definition: image.c:128
R_SIRDmaxDiff
#define R_SIRDmaxDiff
Definition: sird.c:45
r_entorigin
vec3_t r_entorigin
Definition: bsp.c:29
r_outofsurfaces
int r_outofsurfaces
Definition: main.c:37
R_StepActiveU
static void R_StepActiveU(edge_t *pedge)
Definition: edge.c:170
oldrefdef_t::xscale
float xscale
Definition: sw.h:146
sc_rover
static surfcache_t * sc_rover
Definition: surf.c:47
NUM_BEAM_SEGS
#define NUM_BEAM_SEGS
modelorg
vec3_t modelorg
Definition: bsp.c:27
surf_s::key
int key
Definition: sw.h:247
spanpackage_t
Definition: polyset.c:27
box_verts
static const vec3_t box_verts[8]
Definition: sky.c:61
surf_s::d_zistepv
float d_zistepv
Definition: sw.h:257
surf_s::d_zistepu
float d_zistepu
Definition: sw.h:257
r_polyblendcolor
static fixed8_t r_polyblendcolor[3]
Definition: poly.c:35
drawsurf_s::surfmip
int surfmip
Definition: sw.h:182
r_lerpmodels
cvar_t * r_lerpmodels
Definition: main.c:99
r_drawnpolycount
int r_drawnpolycount
Definition: main.c:67
r_worldentity
entity_t r_worldentity
Definition: main.c:26
RotatePointAroundVector
void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees)
Definition: math.c:348
VID_BYTES
#define VID_BYTES
Definition: sw.h:49
D_SkySurf
static void D_SkySurf(surf_t *s)
Definition: edge.c:851
D_SCAlloc
static surfcache_t * D_SCAlloc(int width, int size)
Definition: surf.c:246
edge_aftertail
static edge_t edge_aftertail
Definition: edge.c:56
R_SIRDZFunc
static int R_SIRDZFunc(int sub)
Definition: sird.c:101
aliastriangleparms_t::a
finalvert_t * a
Definition: sw.h:294
s_ziscale
static float s_ziscale
Definition: alias.c:42
R_SIRDw
#define R_SIRDw
Definition: sird.c:33
max_span_p
static espan_t * max_span_p
Definition: edge.c:44
r_wholepolycount
int r_wholepolycount
Definition: main.c:68
r_currentkey
int r_currentkey
Definition: edge.c:46
surf_s::d_ziorigin
float d_ziorigin
Definition: sw.h:257
c
statCounters_t c
Definition: main.c:30
r_warpbuffer
byte r_warpbuffer[WARP_WIDTH *WARP_HEIGHT *VID_BYTES]
Definition: main.c:33
d_tdivzstepu
float d_tdivzstepu
Definition: main.c:116
r_leftclipped
static qboolean r_leftclipped
Definition: raster.c:41
oldrefdef_t::vrect
vrect_t vrect
Definition: sw.h:132
surfaces
surf_t * surfaces
Definition: edge.c:35
d_zistepv
float d_zistepv
Definition: main.c:117
d_pzbuffer
short * d_pzbuffer
Definition: main.c:127
auxedges
edge_t * auxedges
Definition: edge.c:31
sw_modulate
cvar_t * sw_modulate
Definition: main.c:87
sadjust
fixed16_t sadjust
Definition: main.c:120
d_sdivzstepu
float d_sdivzstepu
Definition: main.c:116
oldrefdef_t::yscaleinv
float yscaleinv
Definition: sw.h:147
d_sdivzorigin
float d_sdivzorigin
Definition: main.c:118
R_ClipEdge
static void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
Definition: raster.c:228
registration_sequence
int registration_sequence
Definition: main.c:34
LIGHTMAP_BYTES
#define LIGHTMAP_BYTES
Definition: sw.h:203
WARP_HEIGHT
#define WARP_HEIGHT
Definition: sw.h:65
up
static vec3_t up
Definition: p_view.c:27
edge_s::prev
struct edge_s * prev
Definition: sw.h:263
edge_max
edge_t * edge_max
Definition: edge.c:32
D_FlushCaches
void D_FlushCaches(void)
Definition: surf.c:222
Cvar_ClampInteger
int Cvar_ClampInteger(cvar_t *var, int min, int max)
Definition: cvar.c:549
finalvert_s::s
int s
Definition: sw.h:163
r_drawsurf
drawsurf_t r_drawsurf
Definition: surf.c:22
sw_waterwarp
cvar_t * sw_waterwarp
Definition: main.c:85
drawsurf_s::surfwidth
int surfwidth
Definition: sw.h:183
oldrefdef_t::yscaleshrink
float yscaleshrink
Definition: sw.h:148
right
static vec3_t right
Definition: p_view.c:27
bedge_s::v
mvertex_t * v[2]
Definition: sw.h:189
surf_s::insubmodel
qboolean insubmodel
Definition: sw.h:256
polydesc_t::vup
vec3_t vup
Definition: sw.h:232
surfcache_s::data
byte data[4]
Definition: sw.h:217
vid_gamma
cvar_t * vid_gamma
Definition: main.c:104
R_SIRDnumRand
#define R_SIRDnumRand
Definition: sird.c:64
r_alpha_surfaces
mface_t * r_alpha_surfaces
Definition: poly.c:41
r_p1
static int r_p1[6]
Definition: polyset.c:49
r_maxsurfsseen
int r_maxsurfsseen
Definition: main.c:43
drawsurf_s::surfdat
byte * surfdat
Definition: sw.h:177
aliastriangleparms_t::c
finalvert_t * c
Definition: sw.h:294
surf_max
surf_t * surf_max
Definition: edge.c:35
oldrefdef_t::vrectright
int vrectright
Definition: sw.h:133
r_skyframe
static int r_skyframe
Definition: sky.c:25
surface_p
surf_t * surface_p
Definition: edge.c:35
r_clipflags
int r_clipflags
Definition: main.c:44
R_DrawSurface
static void R_DrawSurface(void)
Definition: surf.c:77
r_currentbkey
int r_currentbkey
Definition: bsp.c:34
R_DrawTriangle
void R_DrawTriangle(void)
Definition: polyset.c:113
R_Alias_clip_bottom
static void R_Alias_clip_bottom(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: aclip.c:115
current_iv
static int current_iv
Definition: edge.c:48
blocklights
blocklight_t blocklights[MAX_BLOCKLIGHTS *LIGHTMAP_BYTES]
Definition: light.c:207
R_ViewChanged
static void R_ViewChanged(vrect_t *vr)
Definition: misc.c:156
surfcache_s::dlight
int dlight
Definition: sw.h:211
color
static vec4_t color
Definition: mesh.c:33
R_TransformVector
void R_TransformVector(vec3_t in, vec3_t out)
Definition: misc.c:96
D_DrawZSurfaces
static void D_DrawZSurfaces(void)
Definition: edge.c:977
tadjust
fixed16_t tadjust
Definition: main.c:120
clipplane_s::dist
float dist
Definition: sw.h:195
surfcache_s::width
unsigned width
Definition: sw.h:213
insubmodel
qboolean insubmodel
Definition: bsp.c:25
R_RenderBmodelFace
void R_RenderBmodelFace(bedge_t *pedges, mface_t *psurf)
Definition: raster.c:477
R_IMFlatShadedQuad
void R_IMFlatShadedQuad(vec3_t a, vec3_t b, vec3_t c, vec3_t d, color_t color, float alpha)
Definition: poly.c:791
span_p
static espan_t * span_p
Definition: edge.c:44
r_p0
static int r_p0[6]
Definition: polyset.c:49
sw_drawsird
cvar_t * sw_drawsird
Definition: main.c:93
oldrefdef_t::ycenter
float ycenter
Definition: sw.h:145
sw_mipscale
cvar_t * sw_mipscale
Definition: misc.c:25
R_Alias_clip_z
static void R_Alias_clip_z(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: aclip.c:29
FULLY_CLIPPED_CACHED
#define FULLY_CLIPPED_CACHED
Definition: raster.c:28
vid
viddef_t vid
Definition: main.c:22
int
CONST PIXELFORMATDESCRIPTOR int
Definition: wgl.c:26
box_surfedges
static const int box_surfedges[24]
Definition: sky.c:41
r_skytexinfo
static mtexinfo_t r_skytexinfo[6]
Definition: sky.c:28
r_worldmodel
bsp_t * r_worldmodel
Definition: main.c:31
R_GenerateSpansBackward
static void R_GenerateSpansBackward(void)
Definition: edge.c:523
MAXHEIGHT
#define MAXHEIGHT
Definition: sw.h:57
R_InsertNewEdges
static void R_InsertNewEdges(edge_t *edgestoadd, edge_t *edgelist)
Definition: edge.c:121
surfcache_s::next
struct surfcache_s * next
Definition: sw.h:208
R_EmitCachedEdge
static void R_EmitCachedEdge(void)
Definition: raster.c:305
polydesc_t::pixel_height
int pixel_height
Definition: sw.h:231
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
r_rightexit
static mvertex_t r_rightexit
Definition: raster.c:45
bbextents
fixed16_t bbextents
Definition: main.c:120
currentmodel
model_t * currentmodel
Definition: main.c:29
MAX_BLOCKLIGHTS
#define MAX_BLOCKLIGHTS
Definition: surf.c:110
base_vpn
vec3_t base_vpn
Definition: main.c:50
d_ziorigin
float d_ziorigin
Definition: main.c:118
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: shared.c:55
surf_s
Definition: sw.h:243
auxsurfaces
surf_t * auxsurfaces
Definition: edge.c:34
finalvert_s::l
int l
Definition: sw.h:164
r_lastvertvalid
static qboolean r_lastvertvalid
Definition: raster.c:52
MAXEDGES
#define MAXEDGES
Definition: sw.h:80
R_PolysetSetEdgeTable
static void R_PolysetSetEdgeTable(void)
Definition: polyset.c:683
BACKFACE_EPSILON
#define BACKFACE_EPSILON
Definition: world.c:352
r_config
refcfg_t r_config
Definition: refresh.c:401
oldrefdef_t::vrectbottom
int vrectbottom
Definition: sw.h:133
polydesc_t::vright
vec3_t vright
Definition: sw.h:232
R_Alias_clip_left
static void R_Alias_clip_left(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: aclip.c:46
edge_head
static edge_t edge_head
Definition: edge.c:54
partparms
static partparms_t partparms
Definition: part.c:28
SURFCACHE_SIZE_AT_320X240
#define SURFCACHE_SIZE_AT_320X240
Definition: sw.h:94
edge_s
Definition: sw.h:260
surf_s::spanstate
int spanstate
Definition: sw.h:249
MAX_BMODEL_VERTS
#define MAX_BMODEL_VERTS
Definition: bsp.c:36
r_skyfaces
static mface_t r_skyfaces[6]
Definition: sky.c:26
vright
vec3_t vright
Definition: main.c:51