icculus quake2 doxygen  1.0 dev
r_local.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include "../client/ref.h"
#include "r_model.h"

Go to the source code of this file.

Classes

struct  image_s
 
struct  vrect_s
 
struct  viddef_t
 
struct  oldrefdef_t
 
struct  emitpoint_t
 
struct  finalvert_s
 
struct  affinetridesc_t
 
struct  drawsurf_t
 
struct  alight_t
 
struct  bedge_s
 
struct  clipplane_s
 
struct  surfcache_s
 
struct  espan_s
 
struct  polydesc_t
 
struct  surf_s
 
struct  edge_s
 
struct  aliastriangleparms_t
 
struct  swstate_s
 

Macros

#define REF_VERSION   "SOFT 0.01"
 
#define PITCH   0
 
#define YAW   1
 
#define ROLL   2
 
#define CACHE_SIZE   32
 
#define VID_CBITS   6
 
#define VID_GRADES   (1 << VID_CBITS)
 
#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 MAX_LBM_HEIGHT   480
 
#define PARTICLE_Z_CLIP   8.0
 
#define TRANSPARENT_COLOR   0xFF
 
#define TURB_TEX_SIZE   64
 
#define CYCLE   128
 
#define SCANBUFFERPAD   0x1000
 
#define DS_SPAN_LIST_END   -128
 
#define NUMSTACKEDGES   2000
 
#define MINEDGES   NUMSTACKEDGES
 
#define NUMSTACKSURFACES   1000
 
#define MINSURFACES   NUMSTACKSURFACES
 
#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 XCENTERING   (1.0 / 2.0)
 
#define YCENTERING   (1.0 / 2.0)
 
#define CLIP_EPSILON   0.001
 
#define BACKFACE_EPSILON   0.01
 
#define NEAR_CLIP   0.01
 
#define MAXALIASVERTS   2000
 
#define ALIAS_Z_CLIP_PLANE   4
 
#define AMP   8*0x10000
 
#define AMP2   3
 
#define SPEED   20
 
#define SMALL_FINALVERT   0
 
#define FINALVERT_V0   0
 
#define FINALVERT_V1   4
 
#define FINALVERT_V2   8
 
#define FINALVERT_V3   12
 
#define FINALVERT_V4   16
 
#define FINALVERT_V5   20
 
#define FINALVERT_FLAGS   24
 
#define FINALVERT_X   28
 
#define FINALVERT_Y   32
 
#define FINALVERT_Z   36
 
#define FINALVERT_SIZE   40
 

Typedefs

typedef struct image_s image_t
 
typedef unsigned char pixel_t
 
typedef struct vrect_s vrect_t
 
typedef struct finalvert_s finalvert_t
 
typedef struct bedge_s bedge_t
 
typedef struct clipplane_s clipplane_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 swstate_s swstate_t
 

Enumerations

enum  imagetype_t {
  it_skin, it_sprite, it_wall, it_pic,
  it_sky, it_skin, it_sprite, it_wall,
  it_pic, it_sky
}
 
enum  rserr_t {
  rserr_ok, rserr_invalid_fullscreen, rserr_invalid_mode, rserr_unknown,
  rserr_ok, rserr_invalid_fullscreen, rserr_invalid_mode, rserr_unknown
}
 

Functions

void D_DrawSurfaces (void)
 
void R_DrawParticle (void)
 
void D_ViewChanged (void)
 
void D_WarpScreen (void)
 
void R_PolysetUpdateTables (void)
 
void R_DrawSurface (void)
 
void D_DrawSpans16 (espan_t *pspans)
 
void D_DrawZSpans (espan_t *pspans)
 
void Turbulent8 (espan_t *pspan)
 
void NonTurbulent8 (espan_t *pspan)
 
surfcache_tD_CacheSurface (msurface_t *surface, int miplevel)
 
void TransformVector (vec3_t in, vec3_t out)
 
void SetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv)
 
void R_RenderWorld (void)
 
void R_ClearPolyList (void)
 
void R_DrawPolyList (void)
 
void R_DrawAlphaSurfaces (void)
 
void R_DrawSprite (void)
 
void R_DrawBeam (entity_t *e)
 
void R_RenderFace (msurface_t *fa, int clipflags)
 
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
 
void R_TransformPlane (mplane_t *p, float *normal, float *dist)
 
void R_TransformFrustum (void)
 
void R_DrawSurfaceBlock16 (void)
 
void R_DrawSurfaceBlock8 (void)
 
void R_GenSkyTile (void *pdest)
 
void R_GenSkyTile16 (void *pdest)
 
void R_Surf8Patch (void)
 
void R_Surf16Patch (void)
 
void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode)
 
void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel, mnode_t *topnode)
 
void R_AddPolygonEdges (emitpoint_t *pverts, int numverts, int miplevel)
 
surf_tR_GetSurf (void)
 
void R_AliasDrawModel (void)
 
void R_BeginEdgeFrame (void)
 
void R_ScanEdges (void)
 
void R_InsertNewEdges (edge_t *edgestoadd, edge_t *edgelist)
 
void R_StepActiveU (edge_t *pedge)
 
void R_RemoveEdges (edge_t *pedge)
 
void R_PushDlights (model_t *model)
 
void R_Surf8Start (void)
 
void R_Surf8End (void)
 
void R_Surf16Start (void)
 
void R_Surf16End (void)
 
void R_EdgeCodeStart (void)
 
void R_EdgeCodeEnd (void)
 
void R_RotateBmodel (void)
 
void R_InitTurb (void)
 
void R_DrawParticles (void)
 
void R_SurfacePatch (void)
 
void R_DrawTriangle (void)
 
void R_AliasClipTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t *index2)
 
void R_PrintAliasStats (void)
 
void R_PrintTimes (void)
 
void R_PrintDSpeeds (void)
 
void R_AnimateLight (void)
 
void R_LightPoint (vec3_t p, vec3_t color)
 
void R_SetupFrame (void)
 
void R_cshift_f (void)
 
void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1)
 
void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
 
void R_SplitEntityOnNode2 (mnode_t *node)
 
float R_DLightPoint (vec3_t p)
 
void R_NewMap (void)
 
void R_Register (void)
 
void R_UnRegister (void)
 
void Draw_InitLocal (void)
 
int R_Init (void *hInstance, void *wndProc)
 
void R_Shutdown (void)
 
void R_InitCaches (void)
 
void D_FlushCaches (void)
 
void R_ScreenShot_f (void)
 
void R_BeginRegistration (char *map)
 
struct model_sR_RegisterModel (char *name)
 
void R_EndRegistration (void)
 
void R_RenderFrame (refdef_t *fd)
 
struct image_sDraw_FindPic (char *name)
 
void Draw_GetPicSize (int *w, int *h, char *name)
 
void Draw_Pic (int x, int y, char *name)
 
void Draw_StretchPic (int x, int y, int w, int h, char *name)
 
void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data)
 
void Draw_Char (int x, int y, int c)
 
void Draw_TileClear (int x, int y, int w, int h, char *name)
 
void Draw_Fill (int x, int y, int w, int h, int c)
 
void Draw_FadeScreen (void)
 
void Draw_GetPalette (void)
 
void R_BeginFrame (float camera_separation)
 
void R_CinematicSetPalette (const unsigned char *palette)
 
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
 
void Sys_SetFPCW (void)
 
void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height)
 
void R_InitImages (void)
 
void R_ShutdownImages (void)
 
image_tR_FindImage (char *name, imagetype_t type)
 
void R_FreeUnusedImages (void)
 
void R_GammaCorrectAndSetPalette (const unsigned char *pal)
 
void R_InitSkyBox (void)
 
void R_IMFlatShadedQuad (vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, float alpha)
 
void SWimp_BeginFrame (float camera_separation)
 
void SWimp_EndFrame (void)
 
int SWimp_Init (void *hInstance, void *wndProc)
 
void SWimp_SetPalette (const unsigned char *palette)
 
void SWimp_Shutdown (void)
 
rserr_t SWimp_SetMode (int *pwidth, int *pheight, int mode, qboolean fullscreen)
 
void SWimp_AppActivate (qboolean active)
 

Variables

viddef_t vid
 
oldrefdef_t r_refdef
 
int d_spanpixcount
 
int r_framecount
 
float r_aliasuvscale
 
qboolean r_dowarp
 
affinetridesc_t r_affinetridesc
 
vec3_t r_pright
 
vec3_t r_pup
 
vec3_t r_ppn
 
voidacolormap
 
drawsurf_t r_drawsurf
 
int c_surf
 
byte r_warpbuffer [WARP_WIDTH *WARP_HEIGHT]
 
float scale_for_mip
 
qboolean d_roverwrapped
 
surfcache_tsc_rover
 
surfcache_td_initial_rover
 
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
 
int d_vrectx
 
int d_vrecty
 
int d_vrectright_particle
 
int d_vrectbottom_particle
 
int d_pix_min
 
int d_pix_max
 
int d_pix_shift
 
pixel_td_viewbuffer
 
short * d_pzbuffer
 
unsigned int d_zrowbytes
 
unsigned int d_zwidth
 
short * zspantable [MAXHEIGHT]
 
int d_scantable [MAXHEIGHT]
 
int d_minmip
 
float d_scalemip [3]
 
int cachewidth
 
pixel_tcacheblock
 
int r_screenwidth
 
int r_drawnpolycount
 
int sintable [1280]
 
int intsintable [1280]
 
int blanktable [1280]
 
vec3_t vup
 
vec3_t base_vup
 
vec3_t vpn
 
vec3_t base_vpn
 
vec3_t vright
 
vec3_t base_vright
 
surf_tsurfaces
 
surf_tsurface_p
 
surf_tsurf_max
 
vec3_t sxformaxis [4]
 
vec3_t txformaxis [4]
 
float xcenter
 
float ycenter
 
float xscale
 
float yscale
 
float xscaleinv
 
float yscaleinv
 
float xscaleshrink
 
float yscaleshrink
 
int ubasestep
 
int errorterm
 
int erroradjustup
 
int erroradjustdown
 
cvar_tsw_aliasstats
 
cvar_tsw_clearcolor
 
cvar_tsw_drawflat
 
cvar_tsw_draworder
 
cvar_tsw_maxedges
 
cvar_tsw_maxsurfs
 
cvar_tsw_mipcap
 
cvar_tsw_mipscale
 
cvar_tsw_mode
 
cvar_tsw_reportsurfout
 
cvar_tsw_reportedgeout
 
cvar_tsw_stipplealpha
 
cvar_tsw_surfcacheoverride
 
cvar_tsw_waterwarp
 
cvar_tr_fullbright
 
cvar_tr_lefthand
 
cvar_tr_drawentities
 
cvar_tr_drawworld
 
cvar_tr_dspeeds
 
cvar_tr_lerpmodels
 
cvar_tr_speeds
 
cvar_tr_lightlevel
 
cvar_tvid_fullscreen
 
cvar_tvid_gamma
 
clipplane_t view_clipplanes [4]
 
intpfrustum_indexes [4]
 
mplane_t screenedge [4]
 
vec3_t r_origin
 
entity_t r_worldentity
 
model_tcurrentmodel
 
entity_tcurrententity
 
vec3_t modelorg
 
vec3_t r_entorigin
 
float verticalFieldOfView
 
float xOrigin
 
float yOrigin
 
int r_visframecount
 
msurface_tr_alpha_surfaces
 
qboolean insubmodel
 
int c_faceclip
 
int r_polycount
 
int r_wholepolycount
 
mvertex_tr_ptverts
 
mvertex_tr_ptvertsmax
 
float entity_rotation [3][3]
 
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]
 
edge_t edge_head
 
edge_t edge_tail
 
edge_t edge_aftertail
 
int r_aliasblendcolor
 
float aliasxscale
 
float aliasyscale
 
float aliasxcenter
 
float aliasycenter
 
int r_outofsurfaces
 
int r_outofedges
 
mvertex_tr_pcurrentvertbase
 
int r_maxvalidedgeoffset
 
aliastriangleparms_t aliastriangleparms
 
float r_time1
 
float da_time1
 
float da_time2
 
float dp_time1
 
float dp_time2
 
float db_time1
 
float db_time2
 
float rw_time1
 
float rw_time2
 
float se_time1
 
float se_time2
 
float de_time1
 
float de_time2
 
float dv_time1
 
float dv_time2
 
int r_frustum_indexes [4 *6]
 
int r_maxsurfsseen
 
int r_maxedgesseen
 
int r_cnumsurfs
 
qboolean r_surfsonstack
 
mleaf_tr_viewleaf
 
int r_viewcluster
 
int r_oldviewcluster
 
int r_clipflags
 
int r_dlightframecount
 
qboolean r_fov_greater_than_90
 
image_tr_notexture_mip
 
model_tr_worldmodel
 
refdef_t r_newrefdef
 
surfcache_tsc_base
 
voidcolormap
 
unsigned d_8to24table [256]
 
mtexinfo_tsky_texinfo [6]
 
swstate_t sw_state
 
refimport_t ri
 

Macro Definition Documentation

◆ ALIAS_BOTTOM_CLIP

#define ALIAS_BOTTOM_CLIP   0x0008

Definition at line 206 of file r_local.h.

◆ ALIAS_LEFT_CLIP

#define ALIAS_LEFT_CLIP   0x0001

Definition at line 203 of file r_local.h.

◆ ALIAS_RIGHT_CLIP

#define ALIAS_RIGHT_CLIP   0x0004

Definition at line 205 of file r_local.h.

◆ ALIAS_TOP_CLIP

#define ALIAS_TOP_CLIP   0x0002

Definition at line 204 of file r_local.h.

◆ ALIAS_XY_CLIP_MASK

#define ALIAS_XY_CLIP_MASK   0x000F

Definition at line 208 of file r_local.h.

◆ ALIAS_Z_CLIP

#define ALIAS_Z_CLIP   0x0010

Definition at line 207 of file r_local.h.

◆ ALIAS_Z_CLIP_PLANE

#define ALIAS_Z_CLIP_PLANE   4

Definition at line 227 of file r_local.h.

◆ AMP

#define AMP   8*0x10000

Definition at line 231 of file r_local.h.

◆ AMP2

#define AMP2   3

Definition at line 232 of file r_local.h.

◆ BACKFACE_EPSILON

#define BACKFACE_EPSILON   0.01

Definition at line 220 of file r_local.h.

◆ BMODEL_FULLY_CLIPPED

#define BMODEL_FULLY_CLIPPED   0x10

Definition at line 212 of file r_local.h.

◆ CACHE_SIZE

#define CACHE_SIZE   32

Definition at line 142 of file r_local.h.

◆ CLIP_EPSILON

#define CLIP_EPSILON   0.001

Definition at line 218 of file r_local.h.

◆ CYCLE

#define CYCLE   128

Definition at line 190 of file r_local.h.

◆ DS_SPAN_LIST_END

#define DS_SPAN_LIST_END   -128

Definition at line 194 of file r_local.h.

◆ FINALVERT_FLAGS

#define FINALVERT_FLAGS   24

Definition at line 295 of file r_local.h.

◆ FINALVERT_SIZE

#define FINALVERT_SIZE   40

Definition at line 299 of file r_local.h.

◆ FINALVERT_V0

#define FINALVERT_V0   0

Definition at line 289 of file r_local.h.

◆ FINALVERT_V1

#define FINALVERT_V1   4

Definition at line 290 of file r_local.h.

◆ FINALVERT_V2

#define FINALVERT_V2   8

Definition at line 291 of file r_local.h.

◆ FINALVERT_V3

#define FINALVERT_V3   12

Definition at line 292 of file r_local.h.

◆ FINALVERT_V4

#define FINALVERT_V4   16

Definition at line 293 of file r_local.h.

◆ FINALVERT_V5

#define FINALVERT_V5   20

Definition at line 294 of file r_local.h.

◆ FINALVERT_X

#define FINALVERT_X   28

Definition at line 296 of file r_local.h.

◆ FINALVERT_Y

#define FINALVERT_Y   32

Definition at line 297 of file r_local.h.

◆ FINALVERT_Z

#define FINALVERT_Z   36

Definition at line 298 of file r_local.h.

◆ INFINITE_DISTANCE

#define INFINITE_DISTANCE   0x10000

Definition at line 167 of file r_local.h.

◆ MAX_LBM_HEIGHT

#define MAX_LBM_HEIGHT   480

Definition at line 177 of file r_local.h.

◆ MAXALIASVERTS

#define MAXALIASVERTS   2000

Definition at line 226 of file r_local.h.

◆ MAXHEIGHT

#define MAXHEIGHT   1200

Definition at line 164 of file r_local.h.

◆ MAXSPANS

#define MAXSPANS   3000

Definition at line 200 of file r_local.h.

◆ MAXVERTS

#define MAXVERTS   64

Definition at line 160 of file r_local.h.

◆ MAXWIDTH

#define MAXWIDTH   1600

Definition at line 165 of file r_local.h.

◆ MAXWORKINGVERTS

#define MAXWORKINGVERTS   (MAXVERTS+4)

Definition at line 161 of file r_local.h.

◆ MINEDGES

#define MINEDGES   NUMSTACKEDGES

Definition at line 197 of file r_local.h.

◆ MINSURFACES

#define MINSURFACES   NUMSTACKSURFACES

Definition at line 199 of file r_local.h.

◆ NEAR_CLIP

#define NEAR_CLIP   0.01

Definition at line 223 of file r_local.h.

◆ NUMSTACKEDGES

#define NUMSTACKEDGES   2000

Definition at line 196 of file r_local.h.

◆ NUMSTACKSURFACES

#define NUMSTACKSURFACES   1000

Definition at line 198 of file r_local.h.

◆ PARTICLE_Z_CLIP

#define PARTICLE_Z_CLIP   8.0

Definition at line 180 of file r_local.h.

◆ PITCH

#define PITCH   0

Definition at line 34 of file r_local.h.

◆ REF_VERSION

#define REF_VERSION   "SOFT 0.01"

Definition at line 31 of file r_local.h.

◆ ROLL

#define ROLL   2

Definition at line 40 of file r_local.h.

◆ SCANBUFFERPAD

#define SCANBUFFERPAD   0x1000

Definition at line 192 of file r_local.h.

◆ SMALL_FINALVERT

#define SMALL_FINALVERT   0

Definition at line 255 of file r_local.h.

◆ SPEED

#define SPEED   20

Definition at line 233 of file r_local.h.

◆ SURFCACHE_SIZE_AT_320X240

#define SURFCACHE_SIZE_AT_320X240   1024*768

Definition at line 210 of file r_local.h.

◆ TRANSPARENT_COLOR

#define TRANSPARENT_COLOR   0xFF

Definition at line 183 of file r_local.h.

◆ TURB_TEX_SIZE

#define TURB_TEX_SIZE   64

Definition at line 187 of file r_local.h.

◆ VID_CBITS

#define VID_CBITS   6

Definition at line 152 of file r_local.h.

◆ VID_GRADES

#define VID_GRADES   (1 << VID_CBITS)

Definition at line 153 of file r_local.h.

◆ WARP_HEIGHT

#define WARP_HEIGHT   240

Definition at line 175 of file r_local.h.

◆ WARP_WIDTH

#define WARP_WIDTH   320

Definition at line 174 of file r_local.h.

◆ XCENTERING

#define XCENTERING   (1.0 / 2.0)

Definition at line 215 of file r_local.h.

◆ YAW

#define YAW   1

Definition at line 37 of file r_local.h.

◆ YCENTERING

#define YCENTERING   (1.0 / 2.0)

Definition at line 216 of file r_local.h.

Typedef Documentation

◆ bedge_t

typedef struct bedge_s bedge_t

◆ clipplane_t

typedef struct clipplane_s clipplane_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

◆ image_t

typedef struct image_s image_t

◆ pixel_t

typedef unsigned char pixel_t

Definition at line 78 of file r_local.h.

◆ surf_t

typedef struct surf_s surf_t

◆ surfcache_t

typedef struct surfcache_s surfcache_t

◆ swstate_t

typedef struct swstate_s swstate_t

◆ vrect_t

typedef struct vrect_s vrect_t

Enumeration Type Documentation

◆ imagetype_t

Enumerator
it_skin 
it_sprite 
it_wall 
it_pic 
it_sky 
it_skin 
it_sprite 
it_wall 
it_pic 
it_sky 

Definition at line 56 of file r_local.h.

57 {
58  it_skin,
59  it_sprite,
60  it_wall,
61  it_pic,
62  it_sky
63 } imagetype_t;

◆ rserr_t

enum rserr_t
Enumerator
rserr_ok 
rserr_invalid_fullscreen 
rserr_invalid_mode 
rserr_unknown 
rserr_ok 
rserr_invalid_fullscreen 
rserr_invalid_mode 
rserr_unknown 

Definition at line 97 of file r_local.h.

98 {
99  rserr_ok,
100 
103 
105 } rserr_t;

Function Documentation

◆ D_CacheSurface()

surfcache_t* D_CacheSurface ( msurface_t surface,
int  miplevel 
)

Definition at line 575 of file r_surf.c.

576 {
577  surfcache_t *cache;
578 
579 //
580 // if the surface is animating or flashing, flush the cache
581 //
583  r_drawsurf.lightadj[0] = r_newrefdef.lightstyles[surface->styles[0]].white*128;
584  r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white*128;
585  r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white*128;
586  r_drawsurf.lightadj[3] = r_newrefdef.lightstyles[surface->styles[3]].white*128;
587 
588 //
589 // see if the cache holds apropriate data
590 //
591  cache = surface->cachespots[miplevel];
592 
593  if (cache && !cache->dlight && surface->dlightframe != r_framecount
594  && cache->image == r_drawsurf.image
595  && cache->lightadj[0] == r_drawsurf.lightadj[0]
596  && cache->lightadj[1] == r_drawsurf.lightadj[1]
597  && cache->lightadj[2] == r_drawsurf.lightadj[2]
598  && cache->lightadj[3] == r_drawsurf.lightadj[3] )
599  return cache;
600 
601 //
602 // determine shape of surface
603 //
604  surfscale = 1.0 / (1<<miplevel);
606  r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
608  r_drawsurf.surfheight = surface->extents[1] >> miplevel;
609 
610 //
611 // allocate memory if needed
612 //
613  if (!cache) // if a texture just animated, don't reallocate it
614  {
615  cache = D_SCAlloc (r_drawsurf.surfwidth,
617  surface->cachespots[miplevel] = cache;
618  cache->owner = &surface->cachespots[miplevel];
619  cache->mipscale = surfscale;
620  }
621 
622  if (surface->dlightframe == r_framecount)
623  cache->dlight = 1;
624  else
625  cache->dlight = 0;
626 
627  r_drawsurf.surfdat = (pixel_t *)cache->data;
628 
629  cache->image = r_drawsurf.image;
630  cache->lightadj[0] = r_drawsurf.lightadj[0];
631  cache->lightadj[1] = r_drawsurf.lightadj[1];
632  cache->lightadj[2] = r_drawsurf.lightadj[2];
633  cache->lightadj[3] = r_drawsurf.lightadj[3];
634 
635 //
636 // draw and light the surface texture
637 //
638  r_drawsurf.surf = surface;
639 
640  c_surf++;
641 
642  // calculate the lightings
643  R_BuildLightMap ();
644 
645  // rasterize the surface into the cache
646  R_DrawSurface ();
647 
648  return cache;
649 }

Referenced by D_SolidSurf(), and R_BuildPolygonFromSurface().

◆ D_DrawSpans16()

void D_DrawSpans16 ( espan_t pspans)

Definition at line 399 of file r_scan.c.

400 {
401  int count, spancount;
402  unsigned char *pbase, *pdest;
403  fixed16_t s, t, snext, tnext, sstep, tstep;
404  float sdivz, tdivz, zi, z, du, dv, spancountminus1;
405  float sdivz8stepu, tdivz8stepu, zi8stepu;
406 
407  sstep = 0; // keep compiler happy
408  tstep = 0; // ditto
409 
410  pbase = (unsigned char *)cacheblock;
411 
412  sdivz8stepu = d_sdivzstepu * 8;
413  tdivz8stepu = d_tdivzstepu * 8;
414  zi8stepu = d_zistepu * 8;
415 
416  do
417  {
418  pdest = (unsigned char *)((byte *)d_viewbuffer +
419  (r_screenwidth * pspan->v) + pspan->u);
420 
421  count = pspan->count;
422 
423  // calculate the initial s/z, t/z, 1/z, s, and t and clamp
424  du = (float)pspan->u;
425  dv = (float)pspan->v;
426 
427  sdivz = d_sdivzorigin + dv*d_sdivzstepv + du*d_sdivzstepu;
428  tdivz = d_tdivzorigin + dv*d_tdivzstepv + du*d_tdivzstepu;
429  zi = d_ziorigin + dv*d_zistepv + du*d_zistepu;
430  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
431 
432  s = (int)(sdivz * z) + sadjust;
433  if (s > bbextents)
434  s = bbextents;
435  else if (s < 0)
436  s = 0;
437 
438  t = (int)(tdivz * z) + tadjust;
439  if (t > bbextentt)
440  t = bbextentt;
441  else if (t < 0)
442  t = 0;
443 
444  do
445  {
446  // calculate s and t at the far end of the span
447  if (count >= 8)
448  spancount = 8;
449  else
450  spancount = count;
451 
452  count -= spancount;
453 
454  if (count)
455  {
456  // calculate s/z, t/z, zi->fixed s and t at far end of span,
457  // calculate s and t steps across span by shifting
458  sdivz += sdivz8stepu;
459  tdivz += tdivz8stepu;
460  zi += zi8stepu;
461  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
462 
463  snext = (int)(sdivz * z) + sadjust;
464  if (snext > bbextents)
465  snext = bbextents;
466  else if (snext < 8)
467  snext = 8; // prevent round-off error on <0 steps from
468  // from causing overstepping & running off the
469  // edge of the texture
470 
471  tnext = (int)(tdivz * z) + tadjust;
472  if (tnext > bbextentt)
473  tnext = bbextentt;
474  else if (tnext < 8)
475  tnext = 8; // guard against round-off error on <0 steps
476 
477  sstep = (snext - s) >> 3;
478  tstep = (tnext - t) >> 3;
479  }
480  else
481  {
482  // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
483  // can't step off polygon), clamp, calculate s and t steps across
484  // span by division, biasing steps low so we don't run off the
485  // texture
486  spancountminus1 = (float)(spancount - 1);
487  sdivz += d_sdivzstepu * spancountminus1;
488  tdivz += d_tdivzstepu * spancountminus1;
489  zi += d_zistepu * spancountminus1;
490  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
491  snext = (int)(sdivz * z) + sadjust;
492  if (snext > bbextents)
493  snext = bbextents;
494  else if (snext < 8)
495  snext = 8; // prevent round-off error on <0 steps from
496  // from causing overstepping & running off the
497  // edge of the texture
498 
499  tnext = (int)(tdivz * z) + tadjust;
500  if (tnext > bbextentt)
501  tnext = bbextentt;
502  else if (tnext < 8)
503  tnext = 8; // guard against round-off error on <0 steps
504 
505  if (spancount > 1)
506  {
507  sstep = (snext - s) / (spancount - 1);
508  tstep = (tnext - t) / (spancount - 1);
509  }
510  }
511 
512  do
513  {
514  *pdest++ = *(pbase + (s >> 16) + (t >> 16) * cachewidth);
515  s += sstep;
516  t += tstep;
517  } while (--spancount > 0);
518 
519  s = snext;
520  t = tnext;
521 
522  } while (count > 0);
523 
524  } while ((pspan = pspan->pnext) != NULL);
525 }

Referenced by D_SkySurf(), and D_SolidSurf().

◆ D_DrawSurfaces()

void D_DrawSurfaces ( void  )

Definition at line 1090 of file r_edge.c.

1091 {
1092  surf_t *s;
1093 
1094 // currententity = NULL; //&r_worldentity;
1098 
1099  if (!sw_drawflat->value)
1100  {
1101  for (s = &surfaces[1] ; s<surface_p ; s++)
1102  {
1103  if (!s->spans)
1104  continue;
1105 
1106  r_drawnpolycount++;
1107 
1109  D_SolidSurf (s);
1110  else if (s->flags & SURF_DRAWSKYBOX)
1111  D_SkySurf (s);
1112  else if (s->flags & SURF_DRAWBACKGROUND)
1113  D_BackgroundSurf (s);
1114  else if (s->flags & SURF_DRAWTURB)
1115  D_TurbulentSurf (s);
1116  }
1117  }
1118  else
1119  D_DrawflatSurfaces ();
1120 
1121  currententity = NULL; //&r_worldentity;
1123  R_TransformFrustum ();
1124 }

Referenced by R_ScanEdges().

◆ D_DrawZSpans()

void D_DrawZSpans ( espan_t pspans)

Definition at line 537 of file r_scan.c.

538 {
539  int count, doublecount, izistep;
540  int izi;
541  short *pdest;
542  unsigned ltemp;
543  float zi;
544  float du, dv;
545 
546 // FIXME: check for clamping/range problems
547 // we count on FP exceptions being turned off to avoid range problems
548  izistep = (int)(d_zistepu * 0x8000 * 0x10000);
549 
550  do
551  {
552  pdest = d_pzbuffer + (d_zwidth * pspan->v) + pspan->u;
553 
554  count = pspan->count;
555 
556  // calculate the initial 1/z
557  du = (float)pspan->u;
558  dv = (float)pspan->v;
559 
560  zi = d_ziorigin + dv*d_zistepv + du*d_zistepu;
561  // we count on FP exceptions being turned off to avoid range problems
562  izi = (int)(zi * 0x8000 * 0x10000);
563 
564  if ((long)pdest & 0x02)
565  {
566  *pdest++ = (short)(izi >> 16);
567  izi += izistep;
568  count--;
569  }
570 
571  if ((doublecount = count >> 1) > 0)
572  {
573  do
574  {
575  ltemp = izi >> 16;
576  izi += izistep;
577  ltemp |= izi & 0xFFFF0000;
578  izi += izistep;
579  *(int *)pdest = ltemp;
580  pdest += 2;
581  } while (--doublecount > 0);
582  }
583 
584  if (count & 1)
585  *pdest = (short)(izi >> 16);
586 
587  } while ((pspan = pspan->pnext) != NULL);
588 }

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

◆ D_FlushCaches()

void D_FlushCaches ( void  )

Definition at line 418 of file r_surf.c.

419 {
420  surfcache_t *c;
421 
422  if (!sc_base)
423  return;
424 
425  for (c = sc_base ; c ; c = c->next)
426  {
427  if (c->owner)
428  *c->owner = NULL;
429  }
430 
431  sc_rover = sc_base;
432  sc_base->next = NULL;
433  sc_base->owner = NULL;
434  sc_base->size = sc_size;
435 }

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

◆ D_ViewChanged()

void D_ViewChanged ( void  )

Definition at line 78 of file r_misc.c.

79 {
80  int i;
81 
83  if (yscale > xscale)
85 
86  d_zrowbytes = vid.width * 2;
87  d_zwidth = vid.width;
88 
89  d_pix_min = r_refdef.vrect.width / 320;
90  if (d_pix_min < 1)
91  d_pix_min = 1;
92 
93  d_pix_max = (int)((float)r_refdef.vrect.width / (320.0 / 4.0) + 0.5);
94  d_pix_shift = 8 - (int)((float)r_refdef.vrect.width / 320.0 + 0.5);
95  if (d_pix_max < 1)
96  d_pix_max = 1;
97 
103 
104  for (i=0 ; i<vid.height; i++)
105  {
108  }
109 
110  /*
111  ** clear Z-buffer and color-buffers if we're doing the gallery
112  */
114  {
115  memset( d_pzbuffer, 0xff, vid.width * vid.height * sizeof( d_pzbuffer[0] ) );
117  }
118 
120 
121  D_Patch ();
122 }

Referenced by R_ViewChanged().

◆ D_WarpScreen()

void D_WarpScreen ( void  )

Definition at line 42 of file r_scan.c.

43 {
44  int w, h;
45  int u,v, u2, v2;
46  byte *dest;
47  int *turb;
48  int *col;
49  byte **row;
50 
51  static int cached_width, cached_height;
52  static byte *rowptr[1200+AMP2*2];
53  static int column[1600+AMP2*2];
54 
55  //
56  // these are constant over resolutions, and can be saved
57  //
59  h = r_newrefdef.height;
60  if (w != cached_width || h != cached_height)
61  {
62  cached_width = w;
63  cached_height = h;
64  for (v=0 ; v<h+AMP2*2 ; v++)
65  {
66  v2 = (int)((float)v/(h + AMP2 * 2) * r_refdef.vrect.height);
67  rowptr[v] = r_warpbuffer + (WARP_WIDTH * v2);
68  }
69 
70  for (u=0 ; u<w+AMP2*2 ; u++)
71  {
72  u2 = (int)((float)u/(w + AMP2 * 2) * r_refdef.vrect.width);
73  column[u] = u2;
74  }
75  }
76 
77  turb = intsintable + ((int)(r_newrefdef.time*SPEED)&(CYCLE-1));
79 
80  for (v=0 ; v<h ; v++, dest += vid.rowbytes)
81  {
82  col = &column[turb[v]];
83  row = &rowptr[v];
84  for (u=0 ; u<w ; u+=4)
85  {
86  dest[u+0] = row[turb[u+0]][col[u+0]];
87  dest[u+1] = row[turb[u+1]][col[u+1]];
88  dest[u+2] = row[turb[u+2]][col[u+2]];
89  dest[u+3] = row[turb[u+3]][col[u+3]];
90  }
91  }
92 }

Referenced by R_RenderFrame().

◆ Draw_Char()

void Draw_Char ( int  x,
int  y,
int  c 
)

Definition at line 74 of file r_draw.c.

75 {
76  byte *dest;
77  byte *source;
78  int drawline;
79  int row, col;
80 
81  num &= 255;
82 
83  if (num == 32 || num == 32+128)
84  return;
85 
86  if (y <= -8)
87  return; // totally off screen
88 
89 // if ( ( y + 8 ) >= vid.height )
90  if ( ( y + 8 ) > vid.height ) // PGM - status text was missing in sw...
91  return;
92 
93 #ifdef PARANOID
94  if (y > vid.height - 8 || x < 0 || x > vid.width - 8)
95  ri.Sys_Error (ERR_FATAL,"Con_DrawCharacter: (%i, %i)", x, y);
96  if (num < 0 || num > 255)
97  ri.Sys_Error (ERR_FATAL,"Con_DrawCharacter: char %i", num);
98 #endif
99 
100  row = num>>4;
101  col = num&15;
102  source = draw_chars->pixels[0] + (row<<10) + (col<<3);
103 
104  if (y < 0)
105  { // clipped
106  drawline = 8 + y;
107  source -= 128*y;
108  y = 0;
109  }
110  else
111  drawline = 8;
112 
113 
114  dest = vid.buffer + y*vid.rowbytes + x;
115 
116  while (drawline--)
117  {
118  if (source[0] != TRANSPARENT_COLOR)
119  dest[0] = source[0];
120  if (source[1] != TRANSPARENT_COLOR)
121  dest[1] = source[1];
122  if (source[2] != TRANSPARENT_COLOR)
123  dest[2] = source[2];
124  if (source[3] != TRANSPARENT_COLOR)
125  dest[3] = source[3];
126  if (source[4] != TRANSPARENT_COLOR)
127  dest[4] = source[4];
128  if (source[5] != TRANSPARENT_COLOR)
129  dest[5] = source[5];
130  if (source[6] != TRANSPARENT_COLOR)
131  dest[6] = source[6];
132  if (source[7] != TRANSPARENT_COLOR)
133  dest[7] = source[7];
134  source += 128;
135  dest += vid.rowbytes;
136  }
137 }

◆ Draw_FadeScreen()

void Draw_FadeScreen ( void  )

Definition at line 428 of file r_draw.c.

429 {
430  int x,y;
431  byte *pbuf;
432  int t;
433 
434  for (y=0 ; y<vid.height ; y++)
435  {
436  pbuf = (byte *)(vid.buffer + vid.rowbytes*y);
437  t = (y & 1) << 1;
438 
439  for (x=0 ; x<vid.width ; x++)
440  {
441  if ((x & 3) != t)
442  pbuf[x] = 0;
443  }
444  }
445 }

◆ Draw_Fill()

void Draw_Fill ( int  x,
int  y,
int  w,
int  h,
int  c 
)

Definition at line 394 of file r_draw.c.

395 {
396  byte *dest;
397  int u, v;
398 
399  if (x+w > vid.width)
400  w = vid.width - x;
401  if (y+h > vid.height)
402  h = vid.height - y;
403  if (x < 0)
404  {
405  w += x;
406  x = 0;
407  }
408  if (y < 0)
409  {
410  h += y;
411  y = 0;
412  }
413  if (w < 0 || h < 0)
414  return;
415  dest = vid.buffer + y*vid.rowbytes + x;
416  for (v=0 ; v<h ; v++, dest += vid.rowbytes)
417  for (u=0 ; u<w ; u++)
418  dest[u] = c;
419 }

◆ Draw_FindPic()

struct image_s* Draw_FindPic ( char *  name)

Definition at line 35 of file r_draw.c.

36 {
37  image_t *image;
38  char fullname[MAX_QPATH];
39 
40  if (name[0] != '/' && name[0] != '\\')
41  {
42  Com_sprintf (fullname, sizeof(fullname), "pics/%s.pcx", name);
43  image = R_FindImage (fullname, it_pic);
44  }
45  else
46  image = R_FindImage (name+1, it_pic);
47 
48  return image;
49 }

◆ Draw_GetPalette()

void Draw_GetPalette ( void  )

Definition at line 1326 of file r_main.c.

1327 {
1328  byte *pal, *out;
1329  int i;
1330  int r, g, b;
1331 
1332  // get the palette and colormap
1333  LoadPCX ("pics/colormap.pcx", &vid.colormap, &pal, NULL, NULL);
1334  if (!vid.colormap)
1335  ri.Sys_Error (ERR_FATAL, "Couldn't load pics/colormap.pcx");
1336  vid.alphamap = vid.colormap + 64*256;
1337 
1338  out = (byte *)d_8to24table;
1339  for (i=0 ; i<256 ; i++, out+=4)
1340  {
1341  r = pal[i*3+0];
1342  g = pal[i*3+1];
1343  b = pal[i*3+2];
1344 
1345  out[0] = r;
1346  out[1] = g;
1347  out[2] = b;
1348  }
1349 
1350  free (pal);
1351 }

Referenced by R_Init().

◆ Draw_GetPicSize()

void Draw_GetPicSize ( int w,
int h,
char *  name 
)

Definition at line 144 of file r_draw.c.

145 {
146  image_t *gl;
147 
148  gl = Draw_FindPic (pic);
149  if (!gl)
150  {
151  *w = *h = -1;
152  return;
153  }
154  *w = gl->width;
155  *h = gl->height;
156 }

◆ Draw_InitLocal()

void Draw_InitLocal ( void  )

Definition at line 58 of file r_draw.c.

59 {
60  draw_chars = Draw_FindPic ("conchars");
61 }

◆ Draw_Pic()

void Draw_Pic ( int  x,
int  y,
char *  name 
)

Definition at line 253 of file r_draw.c.

254 {
255  image_t *pic;
256  byte *dest, *source;
257  int v, u;
258  int tbyte;
259  int height;
260 
261  pic = Draw_FindPic (name);
262  if (!pic)
263  {
264  ri.Con_Printf (PRINT_ALL, "Can't find pic: %s\n", name);
265  return;
266  }
267 
268  if ((x < 0) ||
269  (x + pic->width > vid.width) ||
270  (y + pic->height > vid.height))
271  return; // ri.Sys_Error (ERR_FATAL,"Draw_Pic: bad coordinates");
272 
273  height = pic->height;
274  source = pic->pixels[0];
275  if (y < 0)
276  {
277  height += y;
278  source += pic->width*-y;
279  y = 0;
280  }
281 
282  dest = vid.buffer + y * vid.rowbytes + x;
283 
284  if (!pic->transparent)
285  {
286  for (v=0 ; v<height ; v++)
287  {
288  memcpy (dest, source, pic->width);
289  dest += vid.rowbytes;
290  source += pic->width;
291  }
292  }
293  else
294  {
295  if (pic->width & 7)
296  { // general
297  for (v=0 ; v<height ; v++)
298  {
299  for (u=0 ; u<pic->width ; u++)
300  if ( (tbyte=source[u]) != TRANSPARENT_COLOR)
301  dest[u] = tbyte;
302 
303  dest += vid.rowbytes;
304  source += pic->width;
305  }
306  }
307  else
308  { // unwound
309  for (v=0 ; v<height ; v++)
310  {
311  for (u=0 ; u<pic->width ; u+=8)
312  {
313  if ( (tbyte=source[u]) != TRANSPARENT_COLOR)
314  dest[u] = tbyte;
315  if ( (tbyte=source[u+1]) != TRANSPARENT_COLOR)
316  dest[u+1] = tbyte;
317  if ( (tbyte=source[u+2]) != TRANSPARENT_COLOR)
318  dest[u+2] = tbyte;
319  if ( (tbyte=source[u+3]) != TRANSPARENT_COLOR)
320  dest[u+3] = tbyte;
321  if ( (tbyte=source[u+4]) != TRANSPARENT_COLOR)
322  dest[u+4] = tbyte;
323  if ( (tbyte=source[u+5]) != TRANSPARENT_COLOR)
324  dest[u+5] = tbyte;
325  if ( (tbyte=source[u+6]) != TRANSPARENT_COLOR)
326  dest[u+6] = tbyte;
327  if ( (tbyte=source[u+7]) != TRANSPARENT_COLOR)
328  dest[u+7] = tbyte;
329  }
330  dest += vid.rowbytes;
331  source += pic->width;
332  }
333  }
334  }
335 }

◆ Draw_StretchPic()

void Draw_StretchPic ( int  x,
int  y,
int  w,
int  h,
char *  name 
)

Definition at line 220 of file r_draw.c.

221 {
222  image_t *pic;
223 
224  pic = Draw_FindPic (name);
225  if (!pic)
226  {
227  ri.Con_Printf (PRINT_ALL, "Can't find pic: %s\n", name);
228  return;
229  }
230  Draw_StretchPicImplementation (x, y, w, h, pic);
231 }

◆ Draw_StretchRaw()

void Draw_StretchRaw ( int  x,
int  y,
int  w,
int  h,
int  cols,
int  rows,
byte data 
)

Definition at line 238 of file r_draw.c.

239 {
240  image_t pic;
241 
242  pic.pixels[0] = data;
243  pic.width = cols;
244  pic.height = rows;
245  Draw_StretchPicImplementation (x, y, w, h, &pic);
246 }

◆ Draw_TileClear()

void Draw_TileClear ( int  x,
int  y,
int  w,
int  h,
char *  name 
)

Definition at line 345 of file r_draw.c.

346 {
347  int i, j;
348  byte *psrc;
349  byte *pdest;
350  image_t *pic;
351  int x2;
352 
353  if (x < 0)
354  {
355  w += x;
356  x = 0;
357  }
358  if (y < 0)
359  {
360  h += y;
361  y = 0;
362  }
363  if (x + w > vid.width)
364  w = vid.width - x;
365  if (y + h > vid.height)
366  h = vid.height - y;
367  if (w <= 0 || h <= 0)
368  return;
369 
370  pic = Draw_FindPic (name);
371  if (!pic)
372  {
373  ri.Con_Printf (PRINT_ALL, "Can't find pic: %s\n", name);
374  return;
375  }
376  x2 = x + w;
377  pdest = vid.buffer + y*vid.rowbytes;
378  for (i=0 ; i<h ; i++, pdest += vid.rowbytes)
379  {
380  psrc = pic->pixels[0] + pic->width * ((i+y)&63);
381  for (j=x ; j<x2 ; j++)
382  pdest[j] = psrc[j&63];
383  }
384 }

◆ LoadPCX()

void LoadPCX ( char *  filename,
byte **  pic,
byte **  palette,
int width,
int height 
)

Definition at line 87 of file r_image.c.

88 {
89  byte *raw;
90  pcx_t *pcx;
91  int x, y;
92  int len;
93  int dataByte, runLength;
94  byte *out, *pix;
95 
96  *pic = NULL;
97 
98  //
99  // load the file
100  //
101  len = ri.FS_LoadFile (filename, (void **)&raw);
102  if (!raw)
103  {
104  ri.Con_Printf (PRINT_DEVELOPER, "Bad pcx file %s\n", filename);
105  return;
106  }
107 
108  //
109  // parse the PCX file
110  //
111  pcx = (pcx_t *)raw;
112 
113  pcx->xmin = LittleShort(pcx->xmin);
114  pcx->ymin = LittleShort(pcx->ymin);
115  pcx->xmax = LittleShort(pcx->xmax);
116  pcx->ymax = LittleShort(pcx->ymax);
117  pcx->hres = LittleShort(pcx->hres);
118  pcx->vres = LittleShort(pcx->vres);
121 
122  raw = &pcx->data;
123 
124  if (pcx->manufacturer != 0x0a
125  || pcx->version != 5
126  || pcx->encoding != 1
127  || pcx->bits_per_pixel != 8
128  || pcx->xmax >= 640
129  || pcx->ymax >= 480)
130  {
131  ri.Con_Printf (PRINT_ALL, "Bad pcx file %s\n", filename);
132  return;
133  }
134 
135  out = malloc ( (pcx->ymax+1) * (pcx->xmax+1) );
136 
137  *pic = out;
138 
139  pix = out;
140 
141  if (palette)
142  {
143  *palette = malloc(768);
144  memcpy (*palette, (byte *)pcx + len - 768, 768);
145  }
146 
147  if (width)
148  *width = pcx->xmax+1;
149  if (height)
150  *height = pcx->ymax+1;
151 
152  for (y=0 ; y<=pcx->ymax ; y++, pix += pcx->xmax+1)
153  {
154  for (x=0 ; x<=pcx->xmax ; )
155  {
156  dataByte = *raw++;
157 
158  if((dataByte & 0xC0) == 0xC0)
159  {
160  runLength = dataByte & 0x3F;
161  dataByte = *raw++;
162  }
163  else
164  runLength = 1;
165 
166  while(runLength-- > 0)
167  pix[x++] = dataByte;
168  }
169 
170  }
171 
172  if ( raw - (byte *)pcx > len)
173  {
174  ri.Con_Printf (PRINT_DEVELOPER, "PCX file %s was malformed", filename);
175  free (*pic);
176  *pic = NULL;
177  }
178 
179  ri.FS_FreeFile (pcx);
180 }

◆ NonTurbulent8()

void NonTurbulent8 ( espan_t pspan)

Definition at line 259 of file r_scan.c.

260 {
261  int count;
262  fixed16_t snext, tnext;
263  float sdivz, tdivz, zi, z, du, dv, spancountminus1;
264  float sdivz16stepu, tdivz16stepu, zi16stepu;
265 
266 // r_turb_turb = sintable + ((int)(r_newrefdef.time*SPEED)&(CYCLE-1));
268 
269  r_turb_sstep = 0; // keep compiler happy
270  r_turb_tstep = 0; // ditto
271 
272  r_turb_pbase = (unsigned char *)cacheblock;
273 
274  sdivz16stepu = d_sdivzstepu * 16;
275  tdivz16stepu = d_tdivzstepu * 16;
276  zi16stepu = d_zistepu * 16;
277 
278  do
279  {
280  r_turb_pdest = (unsigned char *)((byte *)d_viewbuffer +
281  (r_screenwidth * pspan->v) + pspan->u);
282 
283  count = pspan->count;
284 
285  // calculate the initial s/z, t/z, 1/z, s, and t and clamp
286  du = (float)pspan->u;
287  dv = (float)pspan->v;
288 
289  sdivz = d_sdivzorigin + dv*d_sdivzstepv + du*d_sdivzstepu;
290  tdivz = d_tdivzorigin + dv*d_tdivzstepv + du*d_tdivzstepu;
291  zi = d_ziorigin + dv*d_zistepv + du*d_zistepu;
292  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
293 
294  r_turb_s = (int)(sdivz * z) + sadjust;
295  if (r_turb_s > bbextents)
297  else if (r_turb_s < 0)
298  r_turb_s = 0;
299 
300  r_turb_t = (int)(tdivz * z) + tadjust;
301  if (r_turb_t > bbextentt)
303  else if (r_turb_t < 0)
304  r_turb_t = 0;
305 
306  do
307  {
308  // calculate s and t at the far end of the span
309  if (count >= 16)
310  r_turb_spancount = 16;
311  else
313 
315 
316  if (count)
317  {
318  // calculate s/z, t/z, zi->fixed s and t at far end of span,
319  // calculate s and t steps across span by shifting
320  sdivz += sdivz16stepu;
321  tdivz += tdivz16stepu;
322  zi += zi16stepu;
323  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
324 
325  snext = (int)(sdivz * z) + sadjust;
326  if (snext > bbextents)
327  snext = bbextents;
328  else if (snext < 16)
329  snext = 16; // prevent round-off error on <0 steps from
330  // from causing overstepping & running off the
331  // edge of the texture
332 
333  tnext = (int)(tdivz * z) + tadjust;
334  if (tnext > bbextentt)
335  tnext = bbextentt;
336  else if (tnext < 16)
337  tnext = 16; // guard against round-off error on <0 steps
338 
339  r_turb_sstep = (snext - r_turb_s) >> 4;
340  r_turb_tstep = (tnext - r_turb_t) >> 4;
341  }
342  else
343  {
344  // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
345  // can't step off polygon), clamp, calculate s and t steps across
346  // span by division, biasing steps low so we don't run off the
347  // texture
348  spancountminus1 = (float)(r_turb_spancount - 1);
349  sdivz += d_sdivzstepu * spancountminus1;
350  tdivz += d_tdivzstepu * spancountminus1;
351  zi += d_zistepu * spancountminus1;
352  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
353  snext = (int)(sdivz * z) + sadjust;
354  if (snext > bbextents)
355  snext = bbextents;
356  else if (snext < 16)
357  snext = 16; // prevent round-off error on <0 steps from
358  // from causing overstepping & running off the
359  // edge of the texture
360 
361  tnext = (int)(tdivz * z) + tadjust;
362  if (tnext > bbextentt)
363  tnext = bbextentt;
364  else if (tnext < 16)
365  tnext = 16; // guard against round-off error on <0 steps
366 
367  if (r_turb_spancount > 1)
368  {
369  r_turb_sstep = (snext - r_turb_s) / (r_turb_spancount - 1);
370  r_turb_tstep = (tnext - r_turb_t) / (r_turb_spancount - 1);
371  }
372  }
373 
374  r_turb_s = r_turb_s & ((CYCLE<<16)-1);
375  r_turb_t = r_turb_t & ((CYCLE<<16)-1);
376 
378 
379  r_turb_s = snext;
380  r_turb_t = tnext;
381 
382  } while (count > 0);
383 
384  } while ((pspan = pspan->pnext) != NULL);
385 }

Referenced by D_TurbulentSurf().

◆ R_AddPolygonEdges()

void R_AddPolygonEdges ( emitpoint_t pverts,
int  numverts,
int  miplevel 
)

◆ R_AliasClipTriangle()

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

Definition at line 231 of file r_aclip.c.

232 {
233  int i, k, pingpong;
234  unsigned clipflags;
235 
236 // copy vertexes and fix seam texture coordinates
237  fv[0][0] = *index0;
238  fv[0][1] = *index1;
239  fv[0][2] = *index2;
240 
241 // clip
242  clipflags = fv[0][0].flags | fv[0][1].flags | fv[0][2].flags;
243 
244  if (clipflags & ALIAS_Z_CLIP)
245  {
246  k = R_AliasClip (fv[0], fv[1], ALIAS_Z_CLIP, 3, R_Alias_clip_z);
247  if (k == 0)
248  return;
249 
250  pingpong = 1;
251  clipflags = fv[1][0].flags | fv[1][1].flags | fv[1][2].flags;
252  }
253  else
254  {
255  pingpong = 0;
256  k = 3;
257  }
258 
259  if (clipflags & ALIAS_LEFT_CLIP)
260  {
261  k = R_AliasClip (fv[pingpong], fv[pingpong ^ 1],
263  if (k == 0)
264  return;
265 
266  pingpong ^= 1;
267  }
268 
269  if (clipflags & ALIAS_RIGHT_CLIP)
270  {
271  k = R_AliasClip (fv[pingpong], fv[pingpong ^ 1],
273  if (k == 0)
274  return;
275 
276  pingpong ^= 1;
277  }
278 
279  if (clipflags & ALIAS_BOTTOM_CLIP)
280  {
281  k = R_AliasClip (fv[pingpong], fv[pingpong ^ 1],
283  if (k == 0)
284  return;
285 
286  pingpong ^= 1;
287  }
288 
289  if (clipflags & ALIAS_TOP_CLIP)
290  {
291  k = R_AliasClip (fv[pingpong], fv[pingpong ^ 1],
293  if (k == 0)
294  return;
295 
296  pingpong ^= 1;
297  }
298 
299  for (i=0 ; i<k ; i++)
300  {
301  if (fv[pingpong][i].u < r_refdef.aliasvrect.x)
302  fv[pingpong][i].u = r_refdef.aliasvrect.x;
303  else if (fv[pingpong][i].u > r_refdef.aliasvrectright)
304  fv[pingpong][i].u = r_refdef.aliasvrectright;
305 
306  if (fv[pingpong][i].v < r_refdef.aliasvrect.y)
307  fv[pingpong][i].v = r_refdef.aliasvrect.y;
308  else if (fv[pingpong][i].v > r_refdef.aliasvrectbottom)
309  fv[pingpong][i].v = r_refdef.aliasvrectbottom;
310 
311  fv[pingpong][i].flags = 0;
312  }
313 
314 // draw triangles
315  for (i=1 ; i<k-1 ; i++)
316  {
317  aliastriangleparms.a = &fv[pingpong][0];
318  aliastriangleparms.b = &fv[pingpong][i];
319  aliastriangleparms.c = &fv[pingpong][i+1];
320  R_DrawTriangle();
321  }
322 }

Referenced by R_AliasPreparePoints().

◆ R_AliasDrawModel()

void R_AliasDrawModel ( void  )

Definition at line 1038 of file r_alias.c.

1039 {
1040  extern void (*d_pdrawspans)(void *);
1041  extern void R_PolysetDrawSpans8_Opaque( void * );
1042  extern void R_PolysetDrawSpans8_33( void * );
1043  extern void R_PolysetDrawSpans8_66( void * );
1044  extern void R_PolysetDrawSpansConstant8_33( void * );
1045  extern void R_PolysetDrawSpansConstant8_66( void * );
1046 
1048 
1049  if ( r_lerpmodels->value == 0 )
1050  currententity->backlerp = 0;
1051 
1053  {
1054  if ( r_lefthand->value == 1.0F )
1056  else if ( r_lefthand->value == 2.0F )
1057  return;
1058  }
1059 
1060  /*
1061  ** we have to set our frame pointers and transformations before
1062  ** doing any real work
1063  */
1066 
1067  // see if the bounding box lets us trivially reject, also sets
1068  // trivial accept status
1070  {
1071  if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
1072  {
1074  }
1075  return;
1076  }
1077 
1078  // set up the skin and verify it exists
1079  if ( !R_AliasSetupSkin () )
1080  {
1081  ri.Con_Printf( PRINT_ALL, "R_AliasDrawModel %s: NULL skin found\n",
1082  currentmodel->name);
1083  return;
1084  }
1085 
1086  r_amodels_drawn++;
1088 
1089  /*
1090  ** select the proper span routine based on translucency
1091  */
1092  // PMM - added double damage shell
1093  // PMM - reordered to handle blending
1095  {
1096  int color;
1097 
1098  // PMM - added double
1100  // PMM - reordered, new shells after old shells (so they get overriden)
1101 
1102  if ( color == RF_SHELL_RED )
1104  else if ( color == RF_SHELL_GREEN )
1106  else if ( color == RF_SHELL_BLUE )
1108  else if ( color == (RF_SHELL_RED | RF_SHELL_GREEN) )
1110  else if ( color == (RF_SHELL_RED | RF_SHELL_BLUE) )
1112  else if ( color == (RF_SHELL_BLUE | RF_SHELL_GREEN) )
1114  // PMM - added this .. it's yellowish
1115  else if ( color == (RF_SHELL_DOUBLE) )
1117  else if ( color == (RF_SHELL_HALF_DAM) )
1119  // pmm
1120  else
1122 /* if ( color & RF_SHELL_RED )
1123  {
1124  if ( ( color & RF_SHELL_BLUE) && ( color & RF_SHELL_GREEN) )
1125  r_aliasblendcolor = SHELL_WHITE_COLOR;
1126  else if ( color & (RF_SHELL_BLUE | RF_SHELL_DOUBLE))
1127  r_aliasblendcolor = SHELL_RB_COLOR;
1128  else
1129  r_aliasblendcolor = SHELL_RED_COLOR;
1130  }
1131  else if ( color & RF_SHELL_BLUE)
1132  {
1133  if ( color & RF_SHELL_DOUBLE )
1134  r_aliasblendcolor = SHELL_CYAN_COLOR;
1135  else
1136  r_aliasblendcolor = SHELL_BLUE_COLOR;
1137  }
1138  else if ( color & (RF_SHELL_DOUBLE) )
1139  r_aliasblendcolor = SHELL_DOUBLE_COLOR;
1140  else if ( color & (RF_SHELL_HALF_DAM) )
1141  r_aliasblendcolor = SHELL_HALF_DAM_COLOR;
1142  else if ( color & RF_SHELL_GREEN )
1143  r_aliasblendcolor = SHELL_GREEN_COLOR;
1144  else
1145  r_aliasblendcolor = SHELL_WHITE_COLOR;
1146 */
1147 
1148  if ( currententity->alpha > 0.33 )
1150  else
1152  }
1153  else if ( currententity->flags & RF_TRANSLUCENT )
1154  {
1155  if ( currententity->alpha > 0.66 )
1157  else if ( currententity->alpha > 0.33 )
1159  else
1161  }
1162  else
1163  {
1165  }
1166 
1167  /*
1168  ** compute this_frame and old_frame addresses
1169  */
1171 
1173  s_ziscale = (float)0x8000 * (float)0x10000 * 3.0;
1174  else
1175  s_ziscale = (float)0x8000 * (float)0x10000;
1176 
1178 
1179  if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
1180  {
1182  }
1183 }

Referenced by R_DrawEntitiesOnList().

◆ R_AnimateLight()

void R_AnimateLight ( void  )

◆ R_BeginEdgeFrame()

void R_BeginEdgeFrame ( void  )

Definition at line 109 of file r_edge.c.

110 {
111  int v;
112 
113  edge_p = r_edges;
115 
116  surface_p = &surfaces[2]; // background is surface 1,
117  // surface 0 is a dummy
118  surfaces[1].spans = NULL; // no background spans yet
120 
121 // put the background behind everything in the world
122  if (sw_draworder->value)
123  {
125  surfaces[1].key = 0;
126  r_currentkey = 1;
127  }
128  else
129  {
131  surfaces[1].key = 0x7FFfFFFF;
132  r_currentkey = 0;
133  }
134 
135 // FIXME: set with memset
136  for (v=r_refdef.vrect.y ; v<r_refdef.vrectbottom ; v++)
137  {
138  newedges[v] = removeedges[v] = NULL;
139  }
140 }

Referenced by R_EdgeDrawing().

◆ R_BeginFrame()

void R_BeginFrame ( float  camera_separation)

Definition at line 1099 of file r_main.c.

1100 {
1101  extern void Draw_BuildGammaTable( void );
1102 #ifdef REDBLUE
1103  SetStereoBuffer((camera_separation <= 0.0) ? 0 : 1);
1104 #endif
1105  /*
1106  ** rebuild the gamma correction palette if necessary
1107  */
1108  if ( vid_gamma->modified )
1109  {
1111  R_GammaCorrectAndSetPalette( ( const unsigned char * ) d_8to24table );
1112 
1113  vid_gamma->modified = false;
1114  }
1115 
1116  while ( sw_mode->modified || vid_fullscreen->modified )
1117  {
1118  rserr_t err;
1119 
1120  /*
1121  ** if this returns rserr_invalid_fullscreen then it set the mode but not as a
1122  ** fullscreen mode, e.g. 320x200 on a system that doesn't support that res
1123  */
1124  if ( ( err = SWimp_SetMode( &vid.width, &vid.height, sw_mode->value, vid_fullscreen->value ) ) == rserr_ok )
1125  {
1127 
1129  vid_fullscreen->modified = false;
1130  sw_mode->modified = false;
1131  }
1132  else
1133  {
1134  if ( err == rserr_invalid_mode )
1135  {
1136  ri.Cvar_SetValue( "sw_mode", sw_state.prev_mode );
1137  ri.Con_Printf( PRINT_ALL, "ref_soft::R_BeginFrame() - could not set mode\n" );
1138  }
1139  else if ( err == rserr_invalid_fullscreen )
1140  {
1142 
1143  ri.Cvar_SetValue( "vid_fullscreen", 0);
1144  ri.Con_Printf( PRINT_ALL, "ref_soft::R_BeginFrame() - fullscreen unavailable in this mode\n" );
1146 // vid_fullscreen->modified = false;
1147 // sw_mode->modified = false;
1148  }
1149  else
1150  {
1151  ri.Sys_Error( ERR_FATAL, "ref_soft::R_BeginFrame() - catastrophic mode change failure\n" );
1152  }
1153  }
1154  }
1155 }

◆ R_BeginRegistration()

void R_BeginRegistration ( char *  map)

Definition at line 1139 of file r_model.c.

1140 {
1141  char fullname[MAX_QPATH];
1142  cvar_t *flushmap;
1143 
1145  r_oldviewcluster = -1; // force markleafs
1146  Com_sprintf (fullname, sizeof(fullname), "maps/%s.bsp", model);
1147 
1148  D_FlushCaches ();
1149  // explicitly free the old map if different
1150  // this guarantees that mod_known[0] is the world map
1151  flushmap = ri.Cvar_Get ("flushmap", "0", 0);
1152  if ( strcmp(mod_known[0].name, fullname) || flushmap->value)
1153  Mod_Free (&mod_known[0]);
1154  r_worldmodel = R_RegisterModel (fullname);
1155  R_NewMap ();
1156 }

Referenced by GetRefAPI().

◆ R_CinematicSetPalette()

void R_CinematicSetPalette ( const unsigned char *  palette)

Definition at line 1177 of file r_main.c.

1178 {
1179  byte palette32[1024];
1180  int i, j, w;
1181  int *d;
1182 
1183  // clear screen to black to avoid any palette flash
1184  w = abs(vid.rowbytes)>>2; // stupid negative pitch win32 stuff...
1185  for (i=0 ; i<vid.height ; i++, d+=w)
1186  {
1187  d = (int *)(vid.buffer + i*vid.rowbytes);
1188  for (j=0 ; j<w ; j++)
1189  d[j] = 0;
1190  }
1191  // flush it to the screen
1192  SWimp_EndFrame ();
1193 
1194  if ( palette )
1195  {
1196  for ( i = 0; i < 256; i++ )
1197  {
1198  palette32[i*4+0] = palette[i*3+0];
1199  palette32[i*4+1] = palette[i*3+1];
1200  palette32[i*4+2] = palette[i*3+2];
1201  palette32[i*4+3] = 0xFF;
1202  }
1203 
1204  R_GammaCorrectAndSetPalette( palette32 );
1205  }
1206  else
1207  {
1208  R_GammaCorrectAndSetPalette( ( const unsigned char * ) d_8to24table );
1209  }
1210 }

Referenced by GetRefAPI().

◆ R_ClearPolyList()

void R_ClearPolyList ( void  )

◆ R_ClipEdge()

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

Definition at line 398 of file r_rast.c.

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

Referenced by R_RenderBmodelFace(), and R_RenderFace().

◆ R_cshift_f()

void R_cshift_f ( void  )

◆ R_DLightPoint()

float R_DLightPoint ( vec3_t  p)

◆ R_DrawAlphaSurfaces()

void R_DrawAlphaSurfaces ( void  )

Definition at line 1192 of file r_poly.c.

1193 {
1195 
1197 
1198  modelorg[0] = -r_origin[0];
1199  modelorg[1] = -r_origin[1];
1200  modelorg[2] = -r_origin[2];
1201 
1202  while ( s )
1203  {
1205 
1206 //=======
1207 //PGM
1208 // if (s->texinfo->flags & SURF_TRANS66)
1209 // R_ClipAndDrawPoly( 0.60f, ( s->texinfo->flags & SURF_WARP) != 0, true );
1210 // else
1211 // R_ClipAndDrawPoly( 0.30f, ( s->texinfo->flags & SURF_WARP) != 0, true );
1212 
1213  // PGM - pass down all the texinfo flags, not just SURF_WARP.
1214  if (s->texinfo->flags & SURF_TRANS66)
1215  R_ClipAndDrawPoly( 0.60f, (s->texinfo->flags & (SURF_WARP|SURF_FLOWING)), true );
1216  else
1217  R_ClipAndDrawPoly( 0.30f, (s->texinfo->flags & (SURF_WARP|SURF_FLOWING)), true );
1218 //PGM
1219 //=======
1220 
1221  s = s->nextalphasurface;
1222  }
1223 
1225 }

Referenced by R_RenderFrame(), and R_RenderView().

◆ R_DrawBeam()

void R_DrawBeam ( entity_t e)

Definition at line 1245 of file r_main.c.

1246 {
1247 #define NUM_BEAM_SEGS 6
1248 
1249  int i;
1250 
1251  vec3_t perpvec;
1252  vec3_t direction, normalized_direction;
1253  vec3_t start_points[NUM_BEAM_SEGS], end_points[NUM_BEAM_SEGS];
1254  vec3_t oldorigin, origin;
1255 
1256  oldorigin[0] = e->oldorigin[0];
1257  oldorigin[1] = e->oldorigin[1];
1258  oldorigin[2] = e->oldorigin[2];
1259 
1260  origin[0] = e->origin[0];
1261  origin[1] = e->origin[1];
1262  origin[2] = e->origin[2];
1263 
1264  normalized_direction[0] = direction[0] = oldorigin[0] - origin[0];
1265  normalized_direction[1] = direction[1] = oldorigin[1] - origin[1];
1266  normalized_direction[2] = direction[2] = oldorigin[2] - origin[2];
1267 
1268  if ( VectorNormalize( normalized_direction ) == 0 )
1269  return;
1270 
1271  PerpendicularVector( perpvec, normalized_direction );
1272  VectorScale( perpvec, e->frame / 2, perpvec );
1273 
1274  for ( i = 0; i < NUM_BEAM_SEGS; i++ )
1275  {
1276  RotatePointAroundVector( start_points[i], normalized_direction, perpvec, (360.0/NUM_BEAM_SEGS)*i );
1277  VectorAdd( start_points[i], origin, start_points[i] );
1278  VectorAdd( start_points[i], direction, end_points[i] );
1279  }
1280 
1281  for ( i = 0; i < NUM_BEAM_SEGS; i++ )
1282  {
1283  R_IMFlatShadedQuad( start_points[i],
1284  end_points[i],
1285  end_points[(i+1)%NUM_BEAM_SEGS],
1286  start_points[(i+1)%NUM_BEAM_SEGS],
1287  e->skinnum & 0xFF,
1288  e->alpha );
1289  }
1290 }

◆ R_DrawParticle()

void R_DrawParticle ( void  )

Definition at line 467 of file r_part.c.

468 {
469  particle_t *pparticle = partparms.particle;
470  int level = partparms.level;
471  vec3_t local, transformed;
472  float zi;
473  byte *pdest;
474  short *pz;
475  int color = pparticle->color;
476  int i, izi, pix, count, u, v;
477  byte (*blendparticle)( int, int );
478 
479  /*
480  ** transform the particle
481  */
482  VectorSubtract (pparticle->origin, r_origin, local);
483 
484  transformed[0] = DotProduct(local, r_pright);
485  transformed[1] = DotProduct(local, r_pup);
486  transformed[2] = DotProduct(local, r_ppn);
487 
488  if (transformed[2] < PARTICLE_Z_CLIP)
489  return;
490 
491  /*
492  ** bind the blend function pointer to the appropriate blender
493  */
494  if ( level == PARTICLE_33 )
495  blendparticle = BlendParticle33;
496  else if ( level == PARTICLE_66 )
497  blendparticle = BlendParticle66;
498  else
499  blendparticle = BlendParticle100;
500 
501  /*
502  ** project the point
503  */
504  // FIXME: preadjust xcenter and ycenter
505  zi = 1.0 / transformed[2];
506  u = (int)(xcenter + zi * transformed[0] + 0.5);
507  v = (int)(ycenter - zi * transformed[1] + 0.5);
508 
509  if ((v > d_vrectbottom_particle) ||
510  (u > d_vrectright_particle) ||
511  (v < d_vrecty) ||
512  (u < d_vrectx))
513  {
514  return;
515  }
516 
517  /*
518  ** compute addresses of zbuffer, framebuffer, and
519  ** compute the Z-buffer reference value.
520  */
521  pz = d_pzbuffer + (d_zwidth * v) + u;
522  pdest = d_viewbuffer + d_scantable[v] + u;
523  izi = (int)(zi * 0x8000);
524 
525  /*
526  ** determine the screen area covered by the particle,
527  ** which also means clamping to a min and max
528  */
529  pix = izi >> d_pix_shift;
530  if (pix < d_pix_min)
531  pix = d_pix_min;
532  else if (pix > d_pix_max)
533  pix = d_pix_max;
534 
535  /*
536  ** render the appropriate pixels
537  */
538  count = pix;
539 
540  switch (level) {
541  case PARTICLE_33 :
542  for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
543  {
544 //FIXME--do it in blocks of 8?
545  for (i=0 ; i<pix ; i++)
546  {
547  if (pz[i] <= izi)
548  {
549  pz[i] = izi;
550  pdest[i] = vid.alphamap[color + ((int)pdest[i]<<8)];
551  }
552  }
553  }
554  break;
555 
556  case PARTICLE_66 :
557  for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
558  {
559  for (i=0 ; i<pix ; i++)
560  {
561  if (pz[i] <= izi)
562  {
563  pz[i] = izi;
564  pdest[i] = vid.alphamap[(color<<8) + (int)pdest[i]];
565  }
566  }
567  }
568  break;
569 
570  default: //100
571  for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
572  {
573  for (i=0 ; i<pix ; i++)
574  {
575  if (pz[i] <= izi)
576  {
577  pz[i] = izi;
578  pdest[i] = color;
579  }
580  }
581  }
582  break;
583  }
584 }

Referenced by R_DrawParticles().

◆ R_DrawParticles()

void R_DrawParticles ( void  )

Definition at line 596 of file r_part.c.

597 {
598  particle_t *p;
599  int i;
600 
601 #if id386 && !defined __linux__ && !defined __FreeBSD__
602  extern unsigned long fpu_sp24_cw, fpu_chop_cw;
603 #endif
604 
607  VectorCopy( vpn, r_ppn );
608 
609 #if id386 && !defined __linux__ && !defined __FreeBSD__
610  __asm fldcw word ptr [fpu_sp24_cw]
611 #endif
612 
613  for (p=r_newrefdef.particles, i=0 ; i<r_newrefdef.num_particles ; i++,p++)
614  {
615 
616  if ( p->alpha > 0.66 )
618  else if ( p->alpha > 0.33 )
620  else
622 
623  partparms.particle = p;
624  partparms.color = p->color;
625 
626 #if id386 && !defined __linux__ && !defined __FreeBSD__
627  if ( i < r_newrefdef.num_particles-1 )
628  s_prefetch_address = ( unsigned int ) ( p + 1 );
629  else
630  s_prefetch_address = ( unsigned int ) r_newrefdef.particles;
631 #endif
632 
633  R_DrawParticle();
634  }
635 
636 #if id386 && !defined __linux__ && !defined __FreeBSD__
637  __asm fldcw word ptr [fpu_chop_cw]
638 #endif
639 
640 }

Referenced by R_RenderFrame(), and R_RenderView().

◆ R_DrawPolyList()

void R_DrawPolyList ( void  )

◆ R_DrawSolidClippedSubmodelPolygons()

void R_DrawSolidClippedSubmodelPolygons ( model_t pmodel,
mnode_t topnode 
)

Definition at line 336 of file r_bsp.c.

337 {
338  int i, j, lindex;
339  vec_t dot;
340  msurface_t *psurf;
341  int numsurfaces;
342  mplane_t *pplane;
343  mvertex_t bverts[MAX_BMODEL_VERTS];
344  bedge_t bedges[MAX_BMODEL_EDGES], *pbedge;
345  medge_t *pedge, *pedges;
346 
347 // FIXME: use bounding-box-based frustum clipping info?
348 
349  psurf = &pmodel->surfaces[pmodel->firstmodelsurface];
350  numsurfaces = pmodel->nummodelsurfaces;
351  pedges = pmodel->edges;
352 
353  for (i=0 ; i<numsurfaces ; i++, psurf++)
354  {
355  // find which side of the node we are on
356  pplane = psurf->plane;
357 
358  dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
359 
360  // draw the polygon
361  if (( !(psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
362  ((psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
363  continue;
364 
365  // FIXME: use bounding-box-based frustum clipping info?
366 
367  // copy the edges to bedges, flipping if necessary so always
368  // clockwise winding
369  // FIXME: if edges and vertices get caches, these assignments must move
370  // outside the loop, and overflow checking must be done here
371  pbverts = bverts;
372  pbedges = bedges;
373  numbverts = numbedges = 0;
374  pbedge = &bedges[numbedges];
375  numbedges += psurf->numedges;
376 
377  for (j=0 ; j<psurf->numedges ; j++)
378  {
379  lindex = pmodel->surfedges[psurf->firstedge+j];
380 
381  if (lindex > 0)
382  {
383  pedge = &pedges[lindex];
384  pbedge[j].v[0] = &r_pcurrentvertbase[pedge->v[0]];
385  pbedge[j].v[1] = &r_pcurrentvertbase[pedge->v[1]];
386  }
387  else
388  {
389  lindex = -lindex;
390  pedge = &pedges[lindex];
391  pbedge[j].v[0] = &r_pcurrentvertbase[pedge->v[1]];
392  pbedge[j].v[1] = &r_pcurrentvertbase[pedge->v[0]];
393  }
394 
395  pbedge[j].pnext = &pbedge[j+1];
396  }
397 
398  pbedge[j-1].pnext = NULL; // mark end of edges
399 
400  if ( !( psurf->texinfo->flags & ( SURF_TRANS66 | SURF_TRANS33 ) ) )
401  R_RecursiveClipBPoly (pbedge, topnode, psurf);
402  else
403  R_RenderBmodelFace( pbedge, psurf );
404  }
405 }

Referenced by R_DrawBEntitiesOnList().

◆ R_DrawSprite()

void R_DrawSprite ( void  )

Definition at line 40 of file r_sprite.c.

41 {
42  vec5_t *pverts;
43  vec3_t left, up, right, down;
44  dsprite_t *s_psprite;
45  dsprframe_t *s_psprframe;
46 
47 
48  s_psprite = (dsprite_t *)currentmodel->extradata;
49 #if 0
50  if (currententity->frame >= s_psprite->numframes
51  || currententity->frame < 0)
52  {
53  ri.Con_Printf (PRINT_ALL, "No such sprite frame %i\n",
55  currententity->frame = 0;
56  }
57 #endif
58  currententity->frame %= s_psprite->numframes;
59 
60  s_psprframe = &s_psprite->frames[currententity->frame];
61 
63  r_polydesc.pixel_width = s_psprframe->width;
64  r_polydesc.pixel_height = s_psprframe->height;
65  r_polydesc.dist = 0;
66 
67  // generate the sprite's axes, completely parallel to the viewplane.
71 
72 // build the sprite poster in worldspace
74  s_psprframe->width - s_psprframe->origin_x, right);
76  s_psprframe->height - s_psprframe->origin_y, up);
78  -s_psprframe->origin_x, left);
80  -s_psprframe->origin_y, down);
81 
82  // invert UP vector for sprites
84 
85  pverts = r_clip_verts[0];
86 
87  pverts[0][0] = r_entorigin[0] + up[0] + left[0];
88  pverts[0][1] = r_entorigin[1] + up[1] + left[1];
89  pverts[0][2] = r_entorigin[2] + up[2] + left[2];
90  pverts[0][3] = 0;
91  pverts[0][4] = 0;
92 
93  pverts[1][0] = r_entorigin[0] + up[0] + right[0];
94  pverts[1][1] = r_entorigin[1] + up[1] + right[1];
95  pverts[1][2] = r_entorigin[2] + up[2] + right[2];
96  pverts[1][3] = s_psprframe->width;
97  pverts[1][4] = 0;
98 
99  pverts[2][0] = r_entorigin[0] + down[0] + right[0];
100  pverts[2][1] = r_entorigin[1] + down[1] + right[1];
101  pverts[2][2] = r_entorigin[2] + down[2] + right[2];
102  pverts[2][3] = s_psprframe->width;
103  pverts[2][4] = s_psprframe->height;
104 
105  pverts[3][0] = r_entorigin[0] + down[0] + left[0];
106  pverts[3][1] = r_entorigin[1] + down[1] + left[1];
107  pverts[3][2] = r_entorigin[2] + down[2] + left[2];
108  pverts[3][3] = 0;
109  pverts[3][4] = s_psprframe->height;
110 
111  r_polydesc.nump = 4;
115 
118  R_ClipAndDrawPoly ( currententity->alpha, false, true );
119  else
120  R_ClipAndDrawPoly ( 1.0F, false, true );
122 }

Referenced by R_DrawEntitiesOnList().

◆ R_DrawSubmodelPolygons()

void R_DrawSubmodelPolygons ( model_t pmodel,
int  clipflags,
mnode_t topnode 
)

Definition at line 415 of file r_bsp.c.

416 {
417  int i;
418  vec_t dot;
419  msurface_t *psurf;
420  int numsurfaces;
421  mplane_t *pplane;
422 
423 // FIXME: use bounding-box-based frustum clipping info?
424 
425  psurf = &pmodel->surfaces[pmodel->firstmodelsurface];
426  numsurfaces = pmodel->nummodelsurfaces;
427 
428  for (i=0 ; i<numsurfaces ; i++, psurf++)
429  {
430  // find which side of the node we are on
431  pplane = psurf->plane;
432 
433  dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
434 
435  // draw the polygon
436  if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
437  (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
438  {
439  r_currentkey = ((mleaf_t *)topnode)->key;
440 
441  // FIXME: use bounding-box-based frustum clipping info?
442  R_RenderFace (psurf, clipflags);
443  }
444  }
445 }

Referenced by R_DrawBEntitiesOnList().

◆ R_DrawSurface()

void R_DrawSurface ( void  )

Definition at line 90 of file r_surf.c.

91 {
92  unsigned char *basetptr;
93  int smax, tmax, twidth;
94  int u;
95  int soffset, basetoffset, texwidth;
96  int horzblockstep;
97  unsigned char *pcolumndest;
98  void (*pblockdrawer)(void);
99  image_t *mt;
100 
102 
103  mt = r_drawsurf.image;
104 
106 
107 // the fractional light values should range from 0 to (VID_GRADES - 1) << 16
108 // from a source range of 0 - 255
109 
110  texwidth = mt->width >> r_drawsurf.surfmip;
111 
112  blocksize = 16 >> r_drawsurf.surfmip;
114  blockdivmask = (1 << blockdivshift) - 1;
115 
116  r_lightwidth = (r_drawsurf.surf->extents[0]>>4)+1;
117 
120 
121 //==============================
122 
123  pblockdrawer = surfmiptable[r_drawsurf.surfmip];
124 // TODO: only needs to be set when there is a display settings change
125  horzblockstep = blocksize;
126 
127  smax = mt->width >> r_drawsurf.surfmip;
128  twidth = texwidth;
129  tmax = mt->height >> r_drawsurf.surfmip;
130  sourcetstep = texwidth;
131  r_stepback = tmax * twidth;
132 
133  r_sourcemax = r_source + (tmax * smax);
134 
135  soffset = r_drawsurf.surf->texturemins[0];
136  basetoffset = r_drawsurf.surf->texturemins[1];
137 
138 // << 16 components are to guarantee positive values for %
139  soffset = ((soffset >> r_drawsurf.surfmip) + (smax << 16)) % smax;
140  basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip)
141  + (tmax << 16)) % tmax) * twidth)];
142 
143  pcolumndest = r_drawsurf.surfdat;
144 
145  for (u=0 ; u<r_numhblocks; u++)
146  {
147  r_lightptr = blocklights + u;
148 
149  prowdestbase = pcolumndest;
150 
151  pbasesource = basetptr + soffset;
152 
153  (*pblockdrawer)();
154 
155  soffset = soffset + blocksize;
156  if (soffset >= smax)
157  soffset = 0;
158 
159  pcolumndest += horzblockstep;
160  }
161 }

Referenced by D_CacheSurface().

◆ R_DrawSurfaceBlock16()

void R_DrawSurfaceBlock16 ( void  )

◆ R_DrawSurfaceBlock8()

void R_DrawSurfaceBlock8 ( void  )

◆ R_DrawTriangle()

void R_DrawTriangle ( void  )

Definition at line 204 of file r_polyse.c.

205 {
207 
208  int dv1_ab, dv0_ac;
209  int dv0_ab, dv1_ac;
210 
211  /*
212  d_xdenom = ( aliastriangleparms.a->v[1] - aliastriangleparms.b->v[1] ) * ( aliastriangleparms.a->v[0] - aliastriangleparms.c->v[0] ) -
213  ( aliastriangleparms.a->v[0] - aliastriangleparms.b->v[0] ) * ( aliastriangleparms.a->v[1] - aliastriangleparms.c->v[1] );
214  */
215 
218 
219  if ( !( dv0_ab | dv1_ab ) )
220  return;
221 
224 
225  if ( !( dv0_ac | dv1_ac ) )
226  return;
227 
228  d_xdenom = ( dv0_ac * dv1_ab ) - ( dv0_ab * dv1_ac );
229 
230  if ( d_xdenom < 0 )
231  {
232  a_spans = spans;
233 
234  r_p0[0] = aliastriangleparms.a->u; // u
235  r_p0[1] = aliastriangleparms.a->v; // v
236  r_p0[2] = aliastriangleparms.a->s; // s
237  r_p0[3] = aliastriangleparms.a->t; // t
238  r_p0[4] = aliastriangleparms.a->l; // light
239  r_p0[5] = aliastriangleparms.a->zi; // iz
240 
241  r_p1[0] = aliastriangleparms.b->u;
242  r_p1[1] = aliastriangleparms.b->v;
243  r_p1[2] = aliastriangleparms.b->s;
244  r_p1[3] = aliastriangleparms.b->t;
245  r_p1[4] = aliastriangleparms.b->l;
246  r_p1[5] = aliastriangleparms.b->zi;
247 
248  r_p2[0] = aliastriangleparms.c->u;
249  r_p2[1] = aliastriangleparms.c->v;
250  r_p2[2] = aliastriangleparms.c->s;
251  r_p2[3] = aliastriangleparms.c->t;
252  r_p2[4] = aliastriangleparms.c->l;
253  r_p2[5] = aliastriangleparms.c->zi;
254 
257  }
258 }

Referenced by R_AliasClipTriangle(), and R_AliasPreparePoints().

◆ R_EdgeCodeEnd()

void R_EdgeCodeEnd ( void  )

Referenced by R_Init().

◆ R_EdgeCodeStart()

void R_EdgeCodeStart ( void  )

Referenced by R_Init().

◆ R_EmitEdge()

void R_EmitEdge ( mvertex_t pv0,
mvertex_t pv1 
)

Definition at line 219 of file r_rast.c.

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

Referenced by R_ClipEdge().

◆ R_EndRegistration()

void R_EndRegistration ( void  )

Definition at line 1208 of file r_model.c.

1209 {
1210  int i;
1211  model_t *mod;
1212 
1213  for (i=0, mod=mod_known ; i<mod_numknown ; i++, mod++)
1214  {
1215  if (!mod->name[0])
1216  continue;
1218  { // don't need this model
1219  Hunk_Free (mod->extradata);
1220  memset (mod, 0, sizeof(*mod));
1221  }
1222  else
1223  { // make sure it is paged in
1225  }
1226  }
1227 
1228  R_FreeUnusedImages ();
1229 }

Referenced by GetRefAPI().

◆ R_FindImage()

image_t* R_FindImage ( char *  name,
imagetype_t  type 
)

Definition at line 497 of file r_image.c.

498 {
499  image_t *image;
500  int i, len;
501  byte *pic, *palette;
502  int width, height;
503  char *ptr;
504 
505  if (!name)
506  return NULL; // ri.Sys_Error (ERR_DROP, "R_FindImage: NULL name");
507  len = strlen(name);
508  if (len<5)
509  return NULL; // ri.Sys_Error (ERR_DROP, "R_FindImage: bad name: %s", name);
510 
511 #ifndef _WIN32
512  // fix backslashes
513  while ((ptr=strchr(name,'\\'))) {
514  *ptr = '/';
515  }
516 #endif
517 
518  // look for it
519  for (i=0, image=r_images ; i<numr_images ; i++,image++)
520  {
521  if (!strcmp(name, image->name))
522  {
524  return image;
525  }
526  }
527 
528  //
529  // load the pic from disk
530  //
531  pic = NULL;
532  palette = NULL;
533  if (!strcmp(name+len-4, ".pcx"))
534  {
535  LoadPCX (name, &pic, &palette, &width, &height);
536  if (!pic)
537  return NULL; // ri.Sys_Error (ERR_DROP, "R_FindImage: can't load %s", name);
538  image = GL_LoadPic (name, pic, width, height, type);
539  }
540  else if (!strcmp(name+len-4, ".wal"))
541  {
542  image = R_LoadWal (name);
543  }
544  else if (!strcmp(name+len-4, ".tga"))
545  return NULL; // ri.Sys_Error (ERR_DROP, "R_FindImage: can't load %s in software renderer", name);
546  else
547  return NULL; // ri.Sys_Error (ERR_DROP, "R_FindImage: bad extension on: %s", name);
548 
549  if (pic)
550  free(pic);
551  if (palette)
552  free(palette);
553 
554  return image;
555 }

Referenced by Draw_FindPic(), Mod_LoadAliasModel(), Mod_LoadSpriteModel(), Mod_LoadTexinfo(), R_RegisterModel(), R_RegisterSkin(), and R_SetSky().

◆ R_FreeUnusedImages()

void R_FreeUnusedImages ( void  )

Definition at line 578 of file r_image.c.

579 {
580  int i;
581  image_t *image;
582 
583  for (i=0, image=r_images ; i<numr_images ; i++, image++)
584  {
586  {
587  Com_PageInMemory ((byte *)image->pixels[0], image->width*image->height);
588  continue; // used this sequence
589  }
590  if (!image->registration_sequence)
591  continue; // free texture
592  if (image->type == it_pic)
593  continue; // don't free pics
594  // free it
595  free (image->pixels[0]); // the other mip levels just follow
596  memset (image, 0, sizeof(*image));
597  }
598 }

Referenced by R_EndRegistration().

◆ R_GammaCorrectAndSetPalette()

void R_GammaCorrectAndSetPalette ( const unsigned char *  pal)

Definition at line 1160 of file r_main.c.

1161 {
1162  int i;
1163 
1164  for ( i = 0; i < 256; i++ )
1165  {
1166  sw_state.currentpalette[i*4+0] = sw_state.gammatable[palette[i*4+0]];
1167  sw_state.currentpalette[i*4+1] = sw_state.gammatable[palette[i*4+1]];
1168  sw_state.currentpalette[i*4+2] = sw_state.gammatable[palette[i*4+2]];
1169  }
1170 
1172 }

Referenced by R_BeginFrame(), R_CalcPalette(), R_CinematicSetPalette(), R_InitGraphics(), and SWimp_SetMode().

◆ R_GenSkyTile()

void R_GenSkyTile ( void pdest)

◆ R_GenSkyTile16()

void R_GenSkyTile16 ( void pdest)

◆ R_GetSurf()

surf_t* R_GetSurf ( void  )

◆ R_IMFlatShadedQuad()

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

Definition at line 1230 of file r_poly.c.

1231 {
1232  vec3_t s0, s1;
1233 
1234  r_polydesc.nump = 4;
1236 
1237  VectorCopy( a, r_clip_verts[0][0] );
1238  VectorCopy( b, r_clip_verts[0][1] );
1239  VectorCopy( c, r_clip_verts[0][2] );
1240  VectorCopy( d, r_clip_verts[0][3] );
1241 
1242  r_clip_verts[0][0][3] = 0;
1243  r_clip_verts[0][1][3] = 0;
1244  r_clip_verts[0][2][3] = 0;
1245  r_clip_verts[0][3][3] = 0;
1246 
1247  r_clip_verts[0][0][4] = 0;
1248  r_clip_verts[0][1][4] = 0;
1249  r_clip_verts[0][2][4] = 0;
1250  r_clip_verts[0][3][4] = 0;
1251 
1252  VectorSubtract( d, c, s0 );
1253  VectorSubtract( c, b, s1 );
1254  CrossProduct( s0, s1, r_polydesc.vpn );
1256 
1258 
1259  r_polyblendcolor = color;
1260 
1261  R_ClipAndDrawPoly( alpha, false, false );
1262 }

Referenced by R_DrawBeam().

◆ R_Init()

int R_Init ( void hInstance,
void wndProc 
)

Definition at line 300 of file r_main.c.

301 {
302  R_InitImages ();
303  Mod_Init ();
304  Draw_InitLocal ();
305  R_InitTextures ();
306 
307  R_InitTurb ();
308 
309  view_clipplanes[0].leftedge = true;
310  view_clipplanes[1].rightedge = true;
312  view_clipplanes[3].leftedge = false;
314  view_clipplanes[3].rightedge = false;
315 
318 
319 // TODO: collect 386-specific code in one place
320 #if id386
322  (long)R_EdgeCodeEnd - (long)R_EdgeCodeStart);
323  Sys_SetFPCW (); // get bit masks for FPCW (FIXME: is this id386?)
324 #endif // id386
325 
326  r_aliasuvscale = 1.0;
327 
328  R_Register ();
329  Draw_GetPalette ();
330  if (SWimp_Init( hInstance, wndProc ) == false)
331  return -1;
332 
333  // create the window
334  R_BeginFrame( 0 );
335 
336  ri.Con_Printf (PRINT_ALL, "ref_soft version: "REF_VERSION"\n");
337 
338  return true;
339 }

◆ R_InitCaches()

void R_InitCaches ( void  )

Definition at line 379 of file r_surf.c.

380 {
381  int size;
382  int pix;
383 
384  // calculate size to allocate
386  {
387  size = sw_surfcacheoverride->value;
388  }
389  else
390  {
392 
393  pix = vid.width*vid.height;
394  if (pix > 64000)
395  size += (pix-64000)*3;
396  }
397 
398  // round up to page size
399  size = (size + 8191) & ~8191;
400 
401  ri.Con_Printf (PRINT_ALL,"%ik surface cache\n", size/1024);
402 
403  sc_size = size;
404  sc_base = (surfcache_t *)malloc(size);
405  sc_rover = sc_base;
406 
407  sc_base->next = NULL;
408  sc_base->owner = NULL;
409  sc_base->size = sc_size;
410 }

Referenced by R_InitGraphics().

◆ R_InitImages()

void R_InitImages ( void  )

Definition at line 607 of file r_image.c.

608 {
610 }

Referenced by R_Init().

◆ R_InitSkyBox()

void R_InitSkyBox ( void  )

Definition at line 113 of file r_rast.c.

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

Referenced by Mod_LoadBrushModel().

◆ R_InitTurb()

void R_InitTurb ( void  )

Definition at line 231 of file r_main.c.

232 {
233  int i;
234 
235  for (i=0 ; i<1280 ; i++)
236  {
237  sintable[i] = AMP + sin(i*3.14159*2/CYCLE)*AMP;
238  intsintable[i] = AMP2 + sin(i*3.14159*2/CYCLE)*AMP2; // AMP2, not 20
239  blanktable[i] = 0; //PGM
240  }
241 }

Referenced by R_Init().

◆ R_InsertNewEdges()

void R_InsertNewEdges ( edge_t edgestoadd,
edge_t edgelist 
)

Definition at line 155 of file r_edge.c.

156 {
157  edge_t *next_edge;
158 
159  do
160  {
161  next_edge = edgestoadd->next;
162 edgesearch:
163  if (edgelist->u >= edgestoadd->u)
164  goto addedge;
165  edgelist=edgelist->next;
166  if (edgelist->u >= edgestoadd->u)
167  goto addedge;
168  edgelist=edgelist->next;
169  if (edgelist->u >= edgestoadd->u)
170  goto addedge;
171  edgelist=edgelist->next;
172  if (edgelist->u >= edgestoadd->u)
173  goto addedge;
174  edgelist=edgelist->next;
175  goto edgesearch;
176 
177  // insert edgestoadd before edgelist
178 addedge:
179  edgestoadd->next = edgelist;
180  edgestoadd->prev = edgelist->prev;
181  edgelist->prev->next = edgestoadd;
182  edgelist->prev = edgestoadd;
183  } while ((edgestoadd = next_edge) != NULL);
184 }

Referenced by R_ScanEdges().

◆ R_LightPoint()

void R_LightPoint ( vec3_t  p,
vec3_t  color 
)

Definition at line 224 of file r_light.c.

225 {
226  vec3_t end;
227  float r;
228  int lnum;
229  dlight_t *dl;
230  float light;
231  vec3_t dist;
232  float add;
233 
234  if (!r_worldmodel->lightdata)
235  {
236  color[0] = color[1] = color[2] = 1.0;
237  return;
238  }
239 
240  end[0] = p[0];
241  end[1] = p[1];
242  end[2] = p[2] - 2048;
243 
245 
246  if (r == -1)
247  {
248  VectorCopy (vec3_origin, color);
249  }
250  else
251  {
252  VectorCopy (pointcolor, color);
253  }
254 
255  //
256  // add dynamic lights
257  //
258  light = 0;
259  for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++)
260  {
261  dl = &r_newrefdef.dlights[lnum];
263  dl->origin,
264  dist);
265  add = dl->intensity - VectorLength(dist);
266  add *= (1.0/256);
267  if (add > 0)
268  {
269  VectorMA (color, add, dl->color, color);
270  }
271  }
272 }

◆ R_NewMap()

void R_NewMap ( void  )

Definition at line 380 of file r_main.c.

381 {
382  r_viewcluster = -1;
383 
385 
386  if (r_cnumsurfs <= MINSURFACES)
388 
390  {
391  surfaces = malloc (r_cnumsurfs * sizeof(surf_t));
394  r_surfsonstack = false;
395  // surface 0 doesn't really exist; it's just a dummy because index 0
396  // is used to indicate no edge attached to surface
397  surfaces--;
398  R_SurfacePatch ();
399  }
400  else
401  {
402  r_surfsonstack = true;
403  }
404 
405  r_maxedgesseen = 0;
406  r_maxsurfsseen = 0;
407 
409 
412 
414  {
415  auxedges = NULL;
416  }
417  else
418  {
419  auxedges = malloc (r_numallocatededges * sizeof(edge_t));
420  }
421 }

Referenced by R_BeginRegistration().

◆ R_PolysetUpdateTables()

void R_PolysetUpdateTables ( void  )

Definition at line 182 of file r_polyse.c.

183 {
184  int i;
185  byte *s;
186 
189  {
192  s = skinstart;
193  for (i=0 ; i<MAX_LBM_HEIGHT ; i++, s+=skinwidth)
194  skintable[i] = s;
195  }
196 }

Referenced by R_AliasSetupSkin().

◆ R_PrintAliasStats()

void R_PrintAliasStats ( void  )

Definition at line 175 of file r_misc.c.

176 {
177  ri.Con_Printf (PRINT_ALL,"%3i polygon model drawn\n", r_amodels_drawn);
178 }

Referenced by R_RenderFrame().

◆ R_PrintDSpeeds()

void R_PrintDSpeeds ( void  )

Definition at line 151 of file r_misc.c.

152 {
153  int ms, dp_time, r_time2, rw_time, db_time, se_time, de_time, da_time;
154 
155  r_time2 = Sys_Milliseconds ();
156 
157  da_time = (da_time2 - da_time1);
158  dp_time = (dp_time2 - dp_time1);
159  rw_time = (rw_time2 - rw_time1);
160  db_time = (db_time2 - db_time1);
161  se_time = (se_time2 - se_time1);
162  de_time = (de_time2 - de_time1);
163  ms = (r_time2 - r_time1);
164 
165  ri.Con_Printf (PRINT_ALL,"%3i %2ip %2iw %2ib %2is %2ie %2ia\n",
166  ms, dp_time, rw_time, db_time, se_time, de_time, da_time);
167 }

Referenced by R_RenderFrame().

◆ R_PrintTimes()

void R_PrintTimes ( void  )

Definition at line 131 of file r_misc.c.

132 {
133  int r_time2;
134  int ms;
135 
136  r_time2 = Sys_Milliseconds ();
137 
138  ms = r_time2 - r_time1;
139 
140  ri.Con_Printf (PRINT_ALL,"%5i ms %3i/%3i/%3i poly %3i surf\n",
142  c_surf = 0;
143 }

Referenced by R_RenderFrame().

◆ R_PushDlights()

void R_PushDlights ( model_t model)

Definition at line 94 of file r_light.c.

95 {
96  int i;
97  dlight_t *l;
98 
100  for (i=0, l = r_newrefdef.dlights ; i<r_newrefdef.num_dlights ; i++, l++)
101  {
102  R_MarkLights ( l, 1<<i,
103  model->nodes + model->firstnode);
104  }
105 }

Referenced by R_DrawBEntitiesOnList(), R_RenderFrame(), and R_RenderView().

◆ R_Register()

void R_Register ( void  )

Definition at line 245 of file r_main.c.

246 {
247  sw_aliasstats = ri.Cvar_Get ("sw_polymodelstats", "0", 0);
248  sw_allow_modex = ri.Cvar_Get( "sw_allow_modex", "1", CVAR_ARCHIVE );
249  sw_clearcolor = ri.Cvar_Get ("sw_clearcolor", "2", 0);
250  sw_drawflat = ri.Cvar_Get ("sw_drawflat", "0", 0);
251  sw_draworder = ri.Cvar_Get ("sw_draworder", "0", 0);
252  sw_maxedges = ri.Cvar_Get ("sw_maxedges", STRINGER(MAXSTACKSURFACES), 0);
253  sw_maxsurfs = ri.Cvar_Get ("sw_maxsurfs", "0", 0);
254  sw_mipcap = ri.Cvar_Get ("sw_mipcap", "0", 0);
255  sw_mipscale = ri.Cvar_Get ("sw_mipscale", "1", 0);
256  sw_reportedgeout = ri.Cvar_Get ("sw_reportedgeout", "0", 0);
257  sw_reportsurfout = ri.Cvar_Get ("sw_reportsurfout", "0", 0);
258  sw_stipplealpha = ri.Cvar_Get( "sw_stipplealpha", "0", CVAR_ARCHIVE );
259  sw_surfcacheoverride = ri.Cvar_Get ("sw_surfcacheoverride", "0", 0);
260  sw_waterwarp = ri.Cvar_Get ("sw_waterwarp", "1", 0);
261  sw_mode = ri.Cvar_Get( "sw_mode", "0", CVAR_ARCHIVE );
262 
263  r_lefthand = ri.Cvar_Get( "hand", "0", CVAR_USERINFO | CVAR_ARCHIVE );
264  r_speeds = ri.Cvar_Get ("r_speeds", "0", 0);
265  r_fullbright = ri.Cvar_Get ("r_fullbright", "0", 0);
266  r_drawentities = ri.Cvar_Get ("r_drawentities", "1", 0);
267  r_drawworld = ri.Cvar_Get ("r_drawworld", "1", 0);
268  r_dspeeds = ri.Cvar_Get ("r_dspeeds", "0", 0);
269  r_lightlevel = ri.Cvar_Get ("r_lightlevel", "0", 0);
270  r_lerpmodels = ri.Cvar_Get( "r_lerpmodels", "1", 0 );
271  r_novis = ri.Cvar_Get( "r_novis", "0", 0 );
272 
273  vid_fullscreen = ri.Cvar_Get( "vid_fullscreen", "0", CVAR_ARCHIVE );
274  vid_gamma = ri.Cvar_Get( "vid_gamma", "1.0", CVAR_ARCHIVE );
275 
276  ri.Cmd_AddCommand ("modellist", Mod_Modellist_f);
277  ri.Cmd_AddCommand( "screenshot", R_ScreenShot_f );
278  ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
279 
280  sw_mode->modified = true; // force us to do mode specific stuff later
281  vid_gamma->modified = true; // force us to rebuild the gamma table later
282 
283 //PGM
284  sw_lockpvs = ri.Cvar_Get ("sw_lockpvs", "0", 0);
285 //PGM
286 }

Referenced by R_Init().

◆ R_RegisterModel()

struct model_s* R_RegisterModel ( char *  name)

Definition at line 1165 of file r_model.c.

1166 {
1167  model_t *mod;
1168  int i;
1169  dsprite_t *sprout;
1170  dmdl_t *pheader;
1171 
1172  mod = Mod_ForName (name, false);
1173  if (mod)
1174  {
1176 
1177  // register any images used by the models
1178  if (mod->type == mod_sprite)
1179  {
1180  sprout = (dsprite_t *)mod->extradata;
1181  for (i=0 ; i<sprout->numframes ; i++)
1182  mod->skins[i] = R_FindImage (sprout->frames[i].name, it_sprite);
1183  }
1184  else if (mod->type == mod_alias)
1185  {
1186  pheader = (dmdl_t *)mod->extradata;
1187  for (i=0 ; i<pheader->num_skins ; i++)
1188  mod->skins[i] = R_FindImage ((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, it_skin);
1189 //PGM
1190  mod->numframes = pheader->num_frames;
1191 //PGM
1192  }
1193  else if (mod->type == mod_brush)
1194  {
1195  for (i=0 ; i<mod->numtexinfo ; i++)
1197  }
1198  }
1199  return mod;
1200 }

Referenced by GetRefAPI().

◆ R_RemoveEdges()

void R_RemoveEdges ( edge_t pedge)

Definition at line 196 of file r_edge.c.

197 {
198 
199  do
200  {
201  pedge->next->prev = pedge->prev;
202  pedge->prev->next = pedge->next;
203  } while ((pedge = pedge->nextremove) != NULL);
204 }

Referenced by R_ScanEdges().

◆ R_RenderBmodelFace()

void R_RenderBmodelFace ( bedge_t pedges,
msurface_t psurf 
)

Definition at line 738 of file r_rast.c.

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

Referenced by R_DrawSolidClippedSubmodelPolygons(), and R_RecursiveClipBPoly().

◆ R_RenderFace()

void R_RenderFace ( msurface_t fa,
int  clipflags 
)

Definition at line 525 of file r_rast.c.

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

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

◆ R_RenderFrame()

void R_RenderFrame ( refdef_t fd)

Definition at line 992 of file r_main.c.

993 {
994  r_newrefdef = *fd;
995 
997  ri.Sys_Error (ERR_FATAL,"R_RenderView: NULL worldmodel");
998 
1001 
1002  if (r_speeds->value || r_dspeeds->value)
1004 
1005  R_SetupFrame ();
1006 
1007  R_MarkLeaves (); // done here so we know if we're in water
1008 
1010 
1011  R_EdgeDrawing ();
1012 
1013  if (r_dspeeds->value)
1014  {
1016  de_time1 = se_time2;
1017  }
1018 
1020 
1021  if (r_dspeeds->value)
1022  {
1025  }
1026 
1027  R_DrawParticles ();
1028 
1029  if (r_dspeeds->value)
1031 
1033 
1034  R_SetLightLevel ();
1035 
1036  if (r_dowarp)
1037  D_WarpScreen ();
1038 
1039  if (r_dspeeds->value)
1041 
1042  if (r_dspeeds->value)
1044 
1045  R_CalcPalette ();
1046 
1047  if (sw_aliasstats->value)
1048  R_PrintAliasStats ();
1049 
1050  if (r_speeds->value)
1051  R_PrintTimes ();
1052 
1053  if (r_dspeeds->value)
1054  R_PrintDSpeeds ();
1055 
1057  ri.Con_Printf (PRINT_ALL,"Short %d surfaces\n", r_outofsurfaces);
1058 
1060  ri.Con_Printf (PRINT_ALL,"Short roughly %d edges\n", r_outofedges * 2 / 3);
1061 }

Referenced by GetRefAPI().

◆ R_RenderWorld()

void R_RenderWorld ( void  )

Definition at line 616 of file r_bsp.c.

617 {
618 
619  if (!r_drawworld->value)
620  return;
622  return;
623 
624  c_drawnode=0;
625 
626  // auto cycle the world frame for texture animation
629 
633 
635 }

Referenced by R_EdgeDrawing().

◆ R_RotateBmodel()

void R_RotateBmodel ( void  )

Definition at line 75 of file r_bsp.c.

76 {
77  float angle, s, c, temp1[3][3], temp2[3][3], temp3[3][3];
78 
79 // TODO: should use a look-up table
80 // TODO: should really be stored with the entity instead of being reconstructed
81 // TODO: could cache lazily, stored in the entity
82 // TODO: share work with R_SetUpAliasTransform
83 
84 // yaw
85  angle = currententity->angles[YAW];
86  angle = angle * M_PI*2 / 360;
87  s = sin(angle);
88  c = cos(angle);
89 
90  temp1[0][0] = c;
91  temp1[0][1] = s;
92  temp1[0][2] = 0;
93  temp1[1][0] = -s;
94  temp1[1][1] = c;
95  temp1[1][2] = 0;
96  temp1[2][0] = 0;
97  temp1[2][1] = 0;
98  temp1[2][2] = 1;
99 
100 
101 // pitch
102  angle = currententity->angles[PITCH];
103  angle = angle * M_PI*2 / 360;
104  s = sin(angle);
105  c = cos(angle);
106 
107  temp2[0][0] = c;
108  temp2[0][1] = 0;
109  temp2[0][2] = -s;
110  temp2[1][0] = 0;
111  temp2[1][1] = 1;
112  temp2[1][2] = 0;
113  temp2[2][0] = s;
114  temp2[2][1] = 0;
115  temp2[2][2] = c;
116 
117  R_ConcatRotations (temp2, temp1, temp3);
118 
119 // roll
120  angle = currententity->angles[ROLL];
121  angle = angle * M_PI*2 / 360;
122  s = sin(angle);
123  c = cos(angle);
124 
125  temp1[0][0] = 1;
126  temp1[0][1] = 0;
127  temp1[0][2] = 0;
128  temp1[1][0] = 0;
129  temp1[1][1] = c;
130  temp1[1][2] = s;
131  temp1[2][0] = 0;
132  temp1[2][1] = -s;
133  temp1[2][2] = c;
134 
135  R_ConcatRotations (temp1, temp3, entity_rotation);
136 
137 //
138 // rotate modelorg and the transformation matrix
139 //
144 
146 }

Referenced by R_DrawBEntitiesOnList().

◆ R_ScanEdges()

void R_ScanEdges ( void  )

Definition at line 635 of file r_edge.c.

636 {
637  int iv, bottom;
638  byte basespans[MAXSPANS*sizeof(espan_t)+CACHE_SIZE];
639  espan_t *basespan_p;
640  surf_t *s;
641 
642  basespan_p = (espan_t *)
643  ((long)(basespans + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
644  max_span_p = &basespan_p[MAXSPANS - r_refdef.vrect.width];
645 
646  span_p = basespan_p;
647 
648 // clear active edges to just the background edges around the whole screen
649 // FIXME: most of this only needs to be set up once
650  edge_head.u = r_refdef.vrect.x << 20;
652  edge_head.u_step = 0;
653  edge_head.prev = NULL;
655  edge_head.surfs[0] = 0;
656  edge_head.surfs[1] = 1;
657 
658  edge_tail.u = (r_refdef.vrectright << 20) + 0xFFFFF;
660  edge_tail.u_step = 0;
663  edge_tail.surfs[0] = 1;
664  edge_tail.surfs[1] = 0;
665 
666  edge_aftertail.u = -1; // force a move
670 
671 // FIXME: do we need this now that we clamp x in r_draw.c?
672  edge_sentinel.u = 2000 << 24; // make sure nothing sorts past this
674 
675 //
676 // process all scan lines
677 //
679 
680  for (iv=r_refdef.vrect.y ; iv<bottom ; iv++)
681  {
682  current_iv = iv;
683  fv = (float)iv;
684 
685  // mark that the head (background start) span is pre-included
686  surfaces[1].spanstate = 1;
687 
688  if (newedges[iv])
689  {
691  }
692 
693  (*pdrawfunc) ();
694 
695  // flush the span list if we can't be sure we have enough spans left for
696  // the next scan
697  if (span_p > max_span_p)
698  {
699  D_DrawSurfaces ();
700 
701  // clear the surface span pointers
702  for (s = &surfaces[1] ; s<surface_p ; s++)
703  s->spans = NULL;
704 
705  span_p = basespan_p;
706  }
707 
708  if (removeedges[iv])
710 
711  if (edge_head.next != &edge_tail)
713  }
714 
715 // do the last scan (no need to step or sort or remove on the last scan)
716 
717  current_iv = iv;
718  fv = (float)iv;
719 
720 // mark that the head (background start) span is pre-included
721  surfaces[1].spanstate = 1;
722 
723  if (newedges[iv])
725 
726  (*pdrawfunc) ();
727 
728 // draw whatever's left in the span list
729  D_DrawSurfaces ();
730 }

Referenced by R_EdgeDrawing().

◆ R_ScreenShot_f()

void R_ScreenShot_f ( void  )

Definition at line 619 of file r_misc.c.

620 {
621  int i;
622  char pcxname[80];
623  char checkname[MAX_OSPATH];
624  FILE *f;
625  byte palette[768];
626 
627  // create the scrnshots directory if it doesn't exist
628  Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir());
629  Sys_Mkdir (checkname);
630 
631 //
632 // find a file name to save it to
633 //
634  strcpy(pcxname,"quake00.pcx");
635 
636  for (i=0 ; i<=99 ; i++)
637  {
638  pcxname[5] = i/10 + '0';
639  pcxname[6] = i%10 + '0';
640  Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), pcxname);
641  f = fopen (checkname, "r");
642  if (!f)
643  break; // file doesn't exist
644  fclose (f);
645  }
646  if (i==100)
647  {
648  ri.Con_Printf (PRINT_ALL, "R_ScreenShot_f: Couldn't create a PCX");
649  return;
650  }
651 
652  // turn the current 32 bit palette into a 24 bit palette
653  for (i=0 ; i<256 ; i++)
654  {
655  palette[i*3+0] = sw_state.currentpalette[i*4+0];
656  palette[i*3+1] = sw_state.currentpalette[i*4+1];
657  palette[i*3+2] = sw_state.currentpalette[i*4+2];
658  }
659 
660 //
661 // save the pcx file
662 //
663 
665  palette);
666 
667  ri.Con_Printf (PRINT_ALL, "Wrote %s\n", checkname);
668 }

Referenced by R_Register().

◆ R_SetupFrame()

void R_SetupFrame ( void  )

Definition at line 426 of file r_misc.c.

427 {
428  int i;
429  vrect_t vrect;
430 
431  if (r_fullbright->modified)
432  {
433  r_fullbright->modified = false;
434  D_FlushCaches (); // so all lighting changes
435  }
436 
437  r_framecount++;
438 
439 
440 // build the transformation matrix for the given view angles
443 
445 
446 // current viewleaf
447  if ( !( r_newrefdef.rdflags & RDF_NOWORLDMODEL ) )
448  {
451  }
452 
454  r_dowarp = true;
455  else
456  r_dowarp = false;
457 
458  if (r_dowarp)
459  { // warp into off screen buffer
460  vrect.x = 0;
461  vrect.y = 0;
464 
467  }
468  else
469  {
470  vrect.x = r_newrefdef.x;
471  vrect.y = r_newrefdef.y;
472  vrect.width = r_newrefdef.width;
473  vrect.height = r_newrefdef.height;
474 
475  d_viewbuffer = (void *)vid.buffer;
477  }
478 
479  R_ViewChanged (&vrect);
480 
481 // start off with just the four screen edge clip planes
484 
485 // save base values
489 
490 // clear frame counts
491  c_faceclip = 0;
492  d_spanpixcount = 0;
493  r_polycount = 0;
494  r_drawnpolycount = 0;
495  r_wholepolycount = 0;
496  r_amodels_drawn = 0;
497  r_outofsurfaces = 0;
498  r_outofedges = 0;
499 
500 // d_setup
501  d_roverwrapped = false;
503 
505  if (d_minmip > 3)
506  d_minmip = 3;
507  else if (d_minmip < 0)
508  d_minmip = 0;
509 
510  for (i=0 ; i<(NUM_MIPS-1) ; i++)
512 
513  d_aflatcolor = 0;
514 }

Referenced by R_RenderFrame(), and R_RenderView().

◆ R_Shutdown()

void R_Shutdown ( void  )

Definition at line 346 of file r_main.c.

347 {
348  // free z buffer
349  if (d_pzbuffer)
350  {
351  free (d_pzbuffer);
352  d_pzbuffer = NULL;
353  }
354  // free surface cache
355  if (sc_base)
356  {
357  D_FlushCaches ();
358  free (sc_base);
359  sc_base = NULL;
360  }
361 
362  // free colormap
363  if (vid.colormap)
364  {
365  free (vid.colormap);
366  vid.colormap = NULL;
367  }
368  R_UnRegister ();
369  Mod_FreeAll ();
370  R_ShutdownImages ();
371 
372  SWimp_Shutdown();
373 }

◆ R_ShutdownImages()

void R_ShutdownImages ( void  )

Definition at line 617 of file r_image.c.

618 {
619  int i;
620  image_t *image;
621 
622  for (i=0, image=r_images ; i<numr_images ; i++, image++)
623  {
624  if (!image->registration_sequence)
625  continue; // free texture
626  // free it
627  free (image->pixels[0]); // the other mip levels just follow
628  memset (image, 0, sizeof(*image));
629  }
630 }

Referenced by R_Shutdown().

◆ R_SplitEntityOnNode2()

void R_SplitEntityOnNode2 ( mnode_t node)

◆ R_StepActiveU()

void R_StepActiveU ( edge_t pedge)

Definition at line 216 of file r_edge.c.

217 {
218  edge_t *pnext_edge, *pwedge;
219 
220  while (1)
221  {
222 nextedge:
223  pedge->u += pedge->u_step;
224  if (pedge->u < pedge->prev->u)
225  goto pushback;
226  pedge = pedge->next;
227 
228  pedge->u += pedge->u_step;
229  if (pedge->u < pedge->prev->u)
230  goto pushback;
231  pedge = pedge->next;
232 
233  pedge->u += pedge->u_step;
234  if (pedge->u < pedge->prev->u)
235  goto pushback;
236  pedge = pedge->next;
237 
238  pedge->u += pedge->u_step;
239  if (pedge->u < pedge->prev->u)
240  goto pushback;
241  pedge = pedge->next;
242 
243  goto nextedge;
244 
245 pushback:
246  if (pedge == &edge_aftertail)
247  return;
248 
249  // push it back to keep it sorted
250  pnext_edge = pedge->next;
251 
252  // pull the edge out of the edge list
253  pedge->next->prev = pedge->prev;
254  pedge->prev->next = pedge->next;
255 
256  // find out where the edge goes in the edge list
257  pwedge = pedge->prev->prev;
258 
259  while (pwedge->u > pedge->u)
260  {
261  pwedge = pwedge->prev;
262  }
263 
264  // put the edge back into the edge list
265  pedge->next = pwedge->next;
266  pedge->prev = pwedge;
267  pedge->next->prev = pedge;
268  pwedge->next = pedge;
269 
270  pedge = pnext_edge;
271  if (pedge == &edge_tail)
272  return;
273  }
274 }

Referenced by R_ScanEdges().

◆ R_Surf16End()

void R_Surf16End ( void  )

◆ R_Surf16Patch()

void R_Surf16Patch ( void  )

◆ R_Surf16Start()

void R_Surf16Start ( void  )

◆ R_Surf8End()

void R_Surf8End ( void  )

Referenced by D_Patch().

◆ R_Surf8Patch()

void R_Surf8Patch ( void  )

Referenced by D_Patch().

◆ R_Surf8Start()

void R_Surf8Start ( void  )

Referenced by D_Patch().

◆ R_SurfacePatch()

void R_SurfacePatch ( void  )

Definition at line 524 of file r_misc.c.

525 {
526  // we only patch code on Intel
527 }

Referenced by R_EdgeDrawing(), and R_NewMap().

◆ R_TransformFrustum()

void R_TransformFrustum ( void  )

Definition at line 187 of file r_misc.c.

188 {
189  int i;
190  vec3_t v, v2;
191 
192  for (i=0 ; i<4 ; i++)
193  {
194  v[0] = screenedge[i].normal[2];
195  v[1] = -screenedge[i].normal[0];
196  v[2] = screenedge[i].normal[1];
197 
198  v2[0] = v[1]*vright[0] + v[2]*vup[0] + v[0]*vpn[0];
199  v2[1] = v[1]*vright[1] + v[2]*vup[1] + v[0]*vpn[1];
200  v2[2] = v[1]*vright[2] + v[2]*vup[2] + v[0]*vpn[2];
201 
202  VectorCopy (v2, view_clipplanes[i].normal);
203 
205  }
206 }

Referenced by R_SetupFrame().

◆ R_TransformPlane()

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

Definition at line 279 of file r_misc.c.

280 {
281  float d;
282 
283  d = DotProduct (r_origin, p->normal);
284  *dist = p->dist - d;
285 // TODO: when we have rotating entities, this will need to use the view matrix
286  TransformVector (p->normal, normal);
287 }

◆ R_UnRegister()

void R_UnRegister ( void  )

Definition at line 288 of file r_main.c.

289 {
290  ri.Cmd_RemoveCommand( "screenshot" );
291  ri.Cmd_RemoveCommand ("modellist");
292  ri.Cmd_RemoveCommand( "imagelist" );
293 }

Referenced by R_Shutdown().

◆ SetUpForLineScan()

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

◆ SWimp_AppActivate()

void SWimp_AppActivate ( qboolean  active)

Definition at line 378 of file rw_imp.c.

379 {
380  if ( active )
381  {
382  if ( sww_state.hWnd )
383  {
384  SetForegroundWindow( sww_state.hWnd );
385  ShowWindow( sww_state.hWnd, SW_RESTORE );
386  }
387  }
388  else
389  {
390  if ( sww_state.hWnd )
391  {
392  if ( sww_state.initializing )
393  return;
394  if ( vid_fullscreen->value )
395  ShowWindow( sww_state.hWnd, SW_MINIMIZE );
396  }
397  }
398 }

Referenced by GetRefAPI().

◆ SWimp_BeginFrame()

void SWimp_BeginFrame ( float  camera_separation)

◆ SWimp_EndFrame()

void SWimp_EndFrame ( void  )

Definition at line 176 of file rw_imp.c.

177 {
178  if ( !sw_state.fullscreen )
179  {
180  if ( sww_state.palettized )
181  {
182 // holdpal = SelectPalette(hdcScreen, hpalDIB, FALSE);
183 // RealizePalette(hdcScreen);
184  }
185 
186 
187  BitBlt( sww_state.hDC,
188  0, 0,
189  vid.width,
190  vid.height,
192  0, 0,
193  SRCCOPY );
194 
195  if ( sww_state.palettized )
196  {
197 // SelectPalette(hdcScreen, holdpal, FALSE);
198  }
199  }
200  else
201  {
202  RECT r;
203  HRESULT rval;
204  DDSURFACEDESC ddsd;
205 
206  r.left = 0;
207  r.top = 0;
208  r.right = vid.width;
209  r.bottom = vid.height;
210 
212 
213  if ( sww_state.modex )
214  {
215  if ( ( rval = sww_state.lpddsBackBuffer->lpVtbl->BltFast( sww_state.lpddsBackBuffer,
216  0, 0,
218  &r,
219  DDBLTFAST_WAIT ) ) == DDERR_SURFACELOST )
220  {
223  0, 0,
225  &r,
226  DDBLTFAST_WAIT );
227  }
228 
229  if ( ( rval = sww_state.lpddsFrontBuffer->lpVtbl->Flip( sww_state.lpddsFrontBuffer,
230  NULL, DDFLIP_WAIT ) ) == DDERR_SURFACELOST )
231  {
233  sww_state.lpddsFrontBuffer->lpVtbl->Flip( sww_state.lpddsFrontBuffer, NULL, DDFLIP_WAIT );
234  }
235  }
236  else
237  {
238  if ( ( rval = sww_state.lpddsBackBuffer->lpVtbl->BltFast( sww_state.lpddsFrontBuffer,
239  0, 0,
241  &r,
242  DDBLTFAST_WAIT ) ) == DDERR_SURFACELOST )
243  {
246  0, 0,
248  &r,
249  DDBLTFAST_WAIT );
250  }
251  }
252 
253  memset( &ddsd, 0, sizeof( ddsd ) );
254  ddsd.dwSize = sizeof( ddsd );
255 
256  sww_state.lpddsOffScreenBuffer->lpVtbl->Lock( sww_state.lpddsOffScreenBuffer, NULL, &ddsd, DDLOCK_WAIT, NULL );
257 
258  vid.buffer = ddsd.lpSurface;
259  vid.rowbytes = ddsd.lPitch;
260  }
261 }

Referenced by GetRefAPI(), and R_CinematicSetPalette().

◆ SWimp_Init()

int SWimp_Init ( void hInstance,
void wndProc 
)

Definition at line 118 of file rw_imp.c.

119 {
120  sww_state.hInstance = ( HINSTANCE ) hInstance;
121  sww_state.wndproc = wndProc;
122 
123  return true;
124 }

Referenced by R_Init().

◆ SWimp_SetMode()

rserr_t SWimp_SetMode ( int pwidth,
int pheight,
int  mode,
qboolean  fullscreen 
)

Definition at line 266 of file rw_imp.c.

267 {
268  const char *win_fs[] = { "W", "FS" };
269  rserr_t retval = rserr_ok;
270 
271  ri.Con_Printf (PRINT_ALL, "setting mode %d:", mode );
272 
273  if ( !ri.Vid_GetModeInfo( pwidth, pheight, mode ) )
274  {
275  ri.Con_Printf( PRINT_ALL, " invalid mode\n" );
276  return rserr_invalid_mode;
277  }
278 
279  ri.Con_Printf( PRINT_ALL, " %d %d %s\n", *pwidth, *pheight, win_fs[fullscreen] );
280 
281  sww_state.initializing = true;
282  if ( fullscreen )
283  {
284  if ( !SWimp_InitGraphics( 1 ) )
285  {
286  if ( SWimp_InitGraphics( 0 ) )
287  {
288  // mode is legal but not as fullscreen
289  fullscreen = 0;
290  retval = rserr_invalid_fullscreen;
291  }
292  else
293  {
294  // failed to set a valid mode in windowed mode
295  retval = rserr_unknown;
296  }
297  }
298  }
299  else
300  {
301  // failure to set a valid mode in windowed mode
302  if ( !SWimp_InitGraphics( fullscreen ) )
303  {
304  sww_state.initializing = true;
305  return rserr_unknown;
306  }
307  }
308 
309  sw_state.fullscreen = fullscreen;
310 #if 0
311  if ( retval != rserr_unknown )
312  {
313  if ( retval == rserr_invalid_fullscreen ||
314  ( retval == rserr_ok && !fullscreen ) )
315  {
316  SetWindowLong( sww_state.hWnd, GWL_STYLE, WINDOW_STYLE );
317  }
318  }
319 #endif
320  R_GammaCorrectAndSetPalette( ( const unsigned char * ) d_8to24table );
321  sww_state.initializing = true;
322 
323  return retval;
324 }

Referenced by R_BeginFrame().

◆ SWimp_SetPalette()

void SWimp_SetPalette ( const unsigned char *  palette)

Definition at line 333 of file rw_imp.c.

334 {
335  // MGL - what the fuck was kendall doing here?!
336  // clear screen to black and change palette
337  // for (i=0 ; i<vid.height ; i++)
338  // memset (vid.buffer + i*vid.rowbytes, 0, vid.width);
339 
340  if ( !palette )
341  palette = ( const unsigned char * ) sw_state.currentpalette;
342 
343  if ( !sw_state.fullscreen )
344  {
345  DIB_SetPalette( ( const unsigned char * ) palette );
346  }
347  else
348  {
349  DDRAW_SetPalette( ( const unsigned char * ) palette );
350  }
351 }

Referenced by R_GammaCorrectAndSetPalette().

◆ SWimp_Shutdown()

void SWimp_Shutdown ( void  )

Definition at line 359 of file rw_imp.c.

360 {
361  ri.Con_Printf( PRINT_ALL, "Shutting down SW imp\n" );
362  DIB_Shutdown();
363  DDRAW_Shutdown();
364 
365  if ( sww_state.hWnd )
366  {
367  ri.Con_Printf( PRINT_ALL, "...destroying window\n" );
368  ShowWindow( sww_state.hWnd, SW_SHOWNORMAL ); // prevents leaving empty slots in the taskbar
369  DestroyWindow (sww_state.hWnd);
370  sww_state.hWnd = NULL;
371  UnregisterClass (WINDOW_CLASS_NAME, sww_state.hInstance);
372  }
373 }

Referenced by R_Shutdown(), and SWimp_InitGraphics().

◆ Sys_MakeCodeWriteable()

void Sys_MakeCodeWriteable ( unsigned long  startaddr,
unsigned long  length 
)

Definition at line 408 of file rw_imp.c.

409 {
410  DWORD flOldProtect;
411 
412  if (!VirtualProtect((LPVOID)startaddr, length, PAGE_READWRITE, &flOldProtect))
413  ri.Sys_Error(ERR_FATAL, "Protection change failed\n");
414 }

Referenced by D_Patch(), and R_Init().

◆ Sys_SetFPCW()

void Sys_SetFPCW ( void  )

Definition at line 437 of file rw_imp.c.

438 {
439 }

Referenced by R_Init().

◆ TransformVector()

void TransformVector ( vec3_t  in,
vec3_t  out 
)

◆ Turbulent8()

void Turbulent8 ( espan_t pspan)

Definition at line 124 of file r_scan.c.

125 {
126  int count;
127  fixed16_t snext, tnext;
128  float sdivz, tdivz, zi, z, du, dv, spancountminus1;
129  float sdivz16stepu, tdivz16stepu, zi16stepu;
130 
132 
133  r_turb_sstep = 0; // keep compiler happy
134  r_turb_tstep = 0; // ditto
135 
136  r_turb_pbase = (unsigned char *)cacheblock;
137 
138  sdivz16stepu = d_sdivzstepu * 16;
139  tdivz16stepu = d_tdivzstepu * 16;
140  zi16stepu = d_zistepu * 16;
141 
142  do
143  {
144  r_turb_pdest = (unsigned char *)((byte *)d_viewbuffer +
145  (r_screenwidth * pspan->v) + pspan->u);
146 
147  count = pspan->count;
148 
149  // calculate the initial s/z, t/z, 1/z, s, and t and clamp
150  du = (float)pspan->u;
151  dv = (float)pspan->v;
152 
153  sdivz = d_sdivzorigin + dv*d_sdivzstepv + du*d_sdivzstepu;
154  tdivz = d_tdivzorigin + dv*d_tdivzstepv + du*d_tdivzstepu;
155  zi = d_ziorigin + dv*d_zistepv + du*d_zistepu;
156  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
157 
158  r_turb_s = (int)(sdivz * z) + sadjust;
159  if (r_turb_s > bbextents)
161  else if (r_turb_s < 0)
162  r_turb_s = 0;
163 
164  r_turb_t = (int)(tdivz * z) + tadjust;
165  if (r_turb_t > bbextentt)
167  else if (r_turb_t < 0)
168  r_turb_t = 0;
169 
170  do
171  {
172  // calculate s and t at the far end of the span
173  if (count >= 16)
174  r_turb_spancount = 16;
175  else
177 
179 
180  if (count)
181  {
182  // calculate s/z, t/z, zi->fixed s and t at far end of span,
183  // calculate s and t steps across span by shifting
184  sdivz += sdivz16stepu;
185  tdivz += tdivz16stepu;
186  zi += zi16stepu;
187  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
188 
189  snext = (int)(sdivz * z) + sadjust;
190  if (snext > bbextents)
191  snext = bbextents;
192  else if (snext < 16)
193  snext = 16; // prevent round-off error on <0 steps from
194  // from causing overstepping & running off the
195  // edge of the texture
196 
197  tnext = (int)(tdivz * z) + tadjust;
198  if (tnext > bbextentt)
199  tnext = bbextentt;
200  else if (tnext < 16)
201  tnext = 16; // guard against round-off error on <0 steps
202 
203  r_turb_sstep = (snext - r_turb_s) >> 4;
204  r_turb_tstep = (tnext - r_turb_t) >> 4;
205  }
206  else
207  {
208  // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
209  // can't step off polygon), clamp, calculate s and t steps across
210  // span by division, biasing steps low so we don't run off the
211  // texture
212  spancountminus1 = (float)(r_turb_spancount - 1);
213  sdivz += d_sdivzstepu * spancountminus1;
214  tdivz += d_tdivzstepu * spancountminus1;
215  zi += d_zistepu * spancountminus1;
216  z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
217  snext = (int)(sdivz * z) + sadjust;
218  if (snext > bbextents)
219  snext = bbextents;
220  else if (snext < 16)
221  snext = 16; // prevent round-off error on <0 steps from
222  // from causing overstepping & running off the
223  // edge of the texture
224 
225  tnext = (int)(tdivz * z) + tadjust;
226  if (tnext > bbextentt)
227  tnext = bbextentt;
228  else if (tnext < 16)
229  tnext = 16; // guard against round-off error on <0 steps
230 
231  if (r_turb_spancount > 1)
232  {
233  r_turb_sstep = (snext - r_turb_s) / (r_turb_spancount - 1);
234  r_turb_tstep = (tnext - r_turb_t) / (r_turb_spancount - 1);
235  }
236  }
237 
238  r_turb_s = r_turb_s & ((CYCLE<<16)-1);
239  r_turb_t = r_turb_t & ((CYCLE<<16)-1);
240 
242 
243  r_turb_s = snext;
244  r_turb_t = tnext;
245 
246  } while (count > 0);
247 
248  } while ((pspan = pspan->pnext) != NULL);
249 }

Referenced by D_TurbulentSurf().

Variable Documentation

◆ acolormap

void* acolormap

◆ aliastriangleparms

aliastriangleparms_t aliastriangleparms

Definition at line 59 of file r_polyse.c.

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

◆ aliasxcenter

float aliasxcenter

Definition at line 702 of file r_local.h.

Referenced by R_AliasProjectAndClipTestFinalVert(), and R_ViewChanged().

◆ aliasxscale

float aliasxscale

Definition at line 79 of file r_main.c.

Referenced by R_AliasDrawModel(), R_AliasProjectAndClipTestFinalVert(), and R_ViewChanged().

◆ aliasycenter

float aliasycenter

Definition at line 702 of file r_local.h.

Referenced by R_AliasProjectAndClipTestFinalVert(), and R_ViewChanged().

◆ aliasyscale

float aliasyscale

Definition at line 702 of file r_local.h.

Referenced by R_AliasProjectAndClipTestFinalVert(), and R_ViewChanged().

◆ auxedges

edge_t* auxedges

Definition at line 48 of file r_edge.c.

Referenced by R_EdgeDrawing(), and R_NewMap().

◆ base_vpn

vec3_t base_vpn

Definition at line 522 of file r_local.h.

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

◆ base_vright

vec3_t base_vright

Definition at line 523 of file r_local.h.

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

◆ base_vup

vec3_t base_vup

Definition at line 521 of file r_local.h.

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

◆ bbextents

◆ bbextentt

◆ blanktable

int blanktable[1280]

Definition at line 49 of file r_rast.c.

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

◆ c_faceclip

int c_faceclip

Definition at line 34 of file r_rast.c.

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

◆ c_surf

int c_surf

Definition at line 58 of file r_main.c.

Referenced by D_CacheSurface(), and R_PrintTimes().

◆ cacheblock

◆ cachewidth

◆ colormap

void* colormap

Definition at line 45 of file r_main.c.

Referenced by D_Patch().

◆ currententity

entity_t* currententity

Definition at line 28 of file r_bsp.c.

◆ currentmodel

◆ d_8to24table

unsigned d_8to24table[256]

◆ d_initial_rover

surfcache_t* d_initial_rover

Definition at line 29 of file r_misc.c.

Referenced by D_SCAlloc(), and R_SetupFrame().

◆ d_minmip

int d_minmip

Definition at line 31 of file r_misc.c.

Referenced by D_MipLevelForScale(), and R_SetupFrame().

◆ d_pix_max

int d_pix_max

Definition at line 498 of file r_local.h.

Referenced by R_DrawParticle().

◆ d_pix_min

int d_pix_min

Definition at line 40 of file r_misc.c.

Referenced by D_ViewChanged(), and R_DrawParticle().

◆ d_pix_shift

int d_pix_shift

Definition at line 498 of file r_local.h.

Referenced by R_DrawParticle().

◆ d_pzbuffer

◆ d_roverwrapped

qboolean d_roverwrapped

Definition at line 30 of file r_misc.c.

Referenced by D_SCAlloc(), and R_SetupFrame().

◆ d_scalemip

float d_scalemip[3]

Definition at line 32 of file r_misc.c.

Referenced by D_MipLevelForScale(), and R_SetupFrame().

◆ d_scantable

int d_scantable[MAXHEIGHT]

Definition at line 42 of file r_misc.c.

Referenced by D_ViewChanged(), R_DrawParticle(), and R_PolygonDrawSpans().

◆ d_sdivzorigin

float d_sdivzorigin

◆ d_sdivzstepu

float d_sdivzstepu

◆ d_sdivzstepv

float d_sdivzstepv

◆ d_spanpixcount

int d_spanpixcount

Definition at line 93 of file r_main.c.

Referenced by R_SetupFrame().

◆ d_tdivzorigin

float d_tdivzorigin

◆ d_tdivzstepu

float d_tdivzstepu

◆ d_tdivzstepv

float d_tdivzstepv

◆ d_viewbuffer

◆ d_vrectbottom_particle

int d_vrectbottom_particle

Definition at line 496 of file r_local.h.

Referenced by R_DrawParticle().

◆ d_vrectright_particle

int d_vrectright_particle

Definition at line 496 of file r_local.h.

Referenced by R_DrawParticle().

◆ d_vrectx

int d_vrectx

Definition at line 38 of file r_misc.c.

Referenced by D_ViewChanged(), and R_DrawParticle().

◆ d_vrecty

int d_vrecty

Definition at line 496 of file r_local.h.

Referenced by R_DrawParticle().

◆ d_ziorigin

◆ d_zistepu

◆ d_zistepv

◆ d_zrowbytes

unsigned int d_zrowbytes

Definition at line 183 of file r_main.c.

Referenced by D_ViewChanged().

◆ d_zwidth

unsigned int d_zwidth

◆ da_time1

float da_time1

Definition at line 106 of file r_main.c.

Referenced by R_PrintDSpeeds(), and R_RenderFrame().

◆ da_time2

float da_time2

Definition at line 723 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ db_time1

float db_time1

Definition at line 724 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ db_time2

float db_time2

Definition at line 724 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ de_time1

float de_time1

Definition at line 725 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ de_time2

float de_time2

Definition at line 725 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ dp_time1

float dp_time1

Definition at line 106 of file r_main.c.

Referenced by R_PrintDSpeeds(), and R_RenderFrame().

◆ dp_time2

float dp_time2

Definition at line 724 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ dv_time1

float dv_time1

Definition at line 725 of file r_local.h.

◆ dv_time2

float dv_time2

Definition at line 725 of file r_local.h.

◆ edge_aftertail

edge_t edge_aftertail

Definition at line 72 of file r_edge.c.

Referenced by R_ScanEdges(), and R_StepActiveU().

◆ edge_head

edge_t edge_head

Definition at line 70 of file r_edge.c.

Referenced by R_GenerateSpans(), R_GenerateSpansBackward(), and R_ScanEdges().

◆ edge_max

edge_t * edge_max

Definition at line 690 of file r_local.h.

◆ edge_p

edge_t * edge_p

Definition at line 690 of file r_local.h.

◆ edge_tail

edge_t edge_tail

Definition at line 71 of file r_edge.c.

Referenced by R_GenerateSpans(), R_GenerateSpansBackward(), R_ScanEdges(), and R_StepActiveU().

◆ entity_rotation

float entity_rotation[3][3]

Definition at line 34 of file r_bsp.c.

Referenced by R_EntityRotate(), R_RecursiveClipBPoly(), and R_RotateBmodel().

◆ erroradjustdown

int erroradjustdown

Definition at line 547 of file r_local.h.

◆ erroradjustup

int erroradjustup

Definition at line 547 of file r_local.h.

◆ errorterm

int errorterm

Definition at line 547 of file r_local.h.

◆ insubmodel

qboolean insubmodel

Definition at line 27 of file r_bsp.c.

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

◆ intsintable

int intsintable[1280]

Definition at line 48 of file r_rast.c.

Referenced by D_WarpScreen(), and R_InitTurb().

◆ modelorg

◆ newedges

edge_t* newedges[MAXHEIGHT]

Definition at line 57 of file r_edge.c.

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

◆ pfrustum_indexes

int* pfrustum_indexes[4]

Definition at line 98 of file r_main.c.

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

◆ r_affinetridesc

◆ r_aliasblendcolor

int r_aliasblendcolor

◆ r_aliasuvscale

float r_aliasuvscale

Definition at line 50 of file r_main.c.

Referenced by R_Init(), and R_ViewChanged().

◆ r_alpha_surfaces

msurface_t* r_alpha_surfaces

◆ r_amodels_drawn

int r_amodels_drawn

Definition at line 34 of file r_alias.c.

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

◆ r_clipflags

int r_clipflags

Definition at line 61 of file r_main.c.

Referenced by R_DrawBEntitiesOnList(), and R_RenderBmodelFace().

◆ r_cnumsurfs

int r_cnumsurfs

Definition at line 727 of file r_local.h.

◆ r_currentbkey

int r_currentbkey

Definition at line 36 of file r_bsp.c.

Referenced by R_RecursiveClipBPoly(), and R_RenderBmodelFace().

◆ r_currentkey

int r_currentkey

◆ r_dlightframecount

int r_dlightframecount

Definition at line 24 of file r_light.c.

Referenced by R_DrawBEntitiesOnList(), R_MarkLights(), R_PushDlights(), and R_RenderDlights().

◆ r_dowarp

qboolean r_dowarp

Definition at line 54 of file r_main.c.

Referenced by R_RenderFrame(), and R_SetupFrame().

◆ r_drawentities

cvar_t* r_drawentities

Definition at line 127 of file r_main.c.

◆ r_drawnpolycount

int r_drawnpolycount

Definition at line 95 of file r_main.c.

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

◆ r_drawsurf

drawsurf_t r_drawsurf

Definition at line 24 of file r_surf.c.

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

◆ r_drawworld

cvar_t* r_drawworld

Definition at line 126 of file r_main.c.

Referenced by R_DrawWorld(), and R_RenderWorld().

◆ r_dspeeds

cvar_t* r_dspeeds

Definition at line 128 of file r_main.c.

Referenced by R_EdgeDrawing(), R_Register(), and R_RenderFrame().

◆ r_edges

edge_t* r_edges

Definition at line 49 of file r_edge.c.

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

◆ r_entorigin

vec3_t r_entorigin

◆ r_fov_greater_than_90

qboolean r_fov_greater_than_90

◆ r_framecount

◆ r_frustum_indexes

int r_frustum_indexes[4 *6]

Definition at line 99 of file r_main.c.

Referenced by R_SetUpFrustumIndexes().

◆ r_fullbright

cvar_t* r_fullbright

Definition at line 129 of file r_main.c.

Referenced by R_BlendLightmaps(), R_BuildLightMap(), and R_SetupFrame().

◆ r_lefthand

cvar_t* r_lefthand

Definition at line 111 of file r_main.c.

Referenced by R_AliasDrawModel(), R_AliasPreparePoints(), and R_DrawAliasModel().

◆ r_lerpmodels

cvar_t* r_lerpmodels

Definition at line 130 of file r_main.c.

Referenced by R_AliasDrawModel(), and R_DrawAliasModel().

◆ r_lightlevel

cvar_t* r_lightlevel

Definition at line 134 of file r_main.c.

Referenced by R_AliasSetupLighting(), and R_DrawAliasModel().

◆ r_maxedgesseen

int r_maxedgesseen

Definition at line 727 of file r_local.h.

◆ r_maxsurfsseen

int r_maxsurfsseen

Definition at line 59 of file r_main.c.

Referenced by R_NewMap().

◆ r_maxvalidedgeoffset

int r_maxvalidedgeoffset

◆ r_newrefdef

◆ r_notexture_mip

image_t* r_notexture_mip

Definition at line 104 of file r_main.c.

Referenced by Mod_LoadTexinfo(), R_InitTextures(), and R_LoadWal().

◆ r_numallocatededges

int r_numallocatededges

Definition at line 49 of file r_main.c.

Referenced by R_BeginEdgeFrame(), and R_NewMap().

◆ r_oldviewcluster

int r_oldviewcluster

Definition at line 731 of file r_local.h.

Referenced by R_BeginRegistration(), and R_MarkLeaves().

◆ r_origin

◆ r_outofedges

int r_outofedges

Definition at line 52 of file r_main.c.

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

◆ r_outofsurfaces

int r_outofsurfaces

Definition at line 51 of file r_main.c.

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

◆ r_pcurrentvertbase

mvertex_t* r_pcurrentvertbase

◆ r_polycount

int r_polycount

Definition at line 94 of file r_main.c.

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

◆ r_ppn

vec3_t r_ppn

Definition at line 450 of file r_local.h.

◆ r_pright

vec3_t r_pright

Definition at line 22 of file r_part.c.

Referenced by R_DrawParticle(), and R_DrawParticles().

◆ r_ptverts

mvertex_t* r_ptverts

◆ r_ptvertsmax

mvertex_t * r_ptvertsmax

Definition at line 675 of file r_local.h.

◆ r_pup

vec3_t r_pup

Definition at line 450 of file r_local.h.

◆ r_refdef

◆ r_screenwidth

◆ r_speeds

cvar_t* r_speeds

Definition at line 133 of file r_main.c.

◆ r_surfsonstack

qboolean r_surfsonstack

Definition at line 60 of file r_main.c.

Referenced by R_EdgeDrawing(), and R_NewMap().

◆ r_time1

float r_time1

Definition at line 48 of file r_main.c.

Referenced by R_PrintDSpeeds(), R_PrintTimes(), and R_RenderFrame().

◆ r_viewcluster

int r_viewcluster

Definition at line 102 of file r_main.c.

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

◆ r_viewleaf

mleaf_t* r_viewleaf

Definition at line 101 of file r_main.c.

Referenced by R_SetupFrame().

◆ r_visframecount

int r_visframecount

Definition at line 92 of file r_main.c.

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

◆ r_warpbuffer

byte r_warpbuffer[WARP_WIDTH *WARP_HEIGHT]

Definition at line 41 of file r_main.c.

Referenced by D_WarpScreen(), and R_SetupFrame().

◆ r_wholepolycount

int r_wholepolycount

Definition at line 96 of file r_main.c.

Referenced by R_SetupFrame().

◆ r_worldentity

entity_t r_worldentity

Definition at line 29 of file r_main.c.

Referenced by D_SolidSurf(), and R_RenderWorld().

◆ r_worldmodel

◆ removeedges

edge_t* removeedges[MAXHEIGHT]

Definition at line 58 of file r_edge.c.

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

◆ ri

Definition at line 25 of file r_main.c.

Referenced by CalcSurfaceExtents(), ClipSkyPolygon(), D_SCAlloc(), D_SCDump(), DDRAW_Init(), DDRAW_SetPalette(), DDRAW_Shutdown(), DIB_Init(), DIB_SetPalette(), Draw_Char(), Draw_Fill(), Draw_GetPalette(), Draw_Pic(), Draw_StretchPic(), Draw_StretchPicImplementation(), Draw_TileClear(), GL_CreateSurfaceLightmap(), GL_ImageList_f(), GL_InitImages(), GL_LoadPic(), GL_LoadWal(), GL_ScreenShot_f(), GL_Strings_f(), GL_TextureAlphaMode(), GL_TextureMode(), GL_TextureSolidMode(), GL_Upload32(), GL_Upload8(), GLimp_BeginFrame(), GLimp_EnableLogging(), GLimp_EndFrame(), GLimp_Init(), GLimp_InitGL(), GLimp_SetMode(), GLimp_Shutdown(), LM_UploadBlock(), LoadPCX(), LoadTGA(), Mod_ForName(), Mod_LoadAliasModel(), Mod_LoadBrushModel(), Mod_LoadEdges(), Mod_LoadFaces(), Mod_LoadLeafs(), Mod_LoadMarksurfaces(), Mod_LoadNodes(), Mod_LoadPlanes(), Mod_LoadSpriteModel(), Mod_LoadSubmodels(), Mod_LoadSurfedges(), Mod_LoadTexinfo(), Mod_LoadVertexes(), Mod_Modellist_f(), Mod_PointInLeaf(), QGL_Init(), R_AliasDrawModel(), R_AliasSetupFrames(), R_AliasSetupSkin(), R_BeginRegistration(), R_BlendLightmaps(), R_BuildLightMap(), R_ClipAndDrawPoly(), R_CullAliasModel(), R_DrawAliasModel(), R_DrawSprite(), R_FindFreeImage(), R_ImageList_f(), R_InitCaches(), R_InitSkyBox(), R_LoadWal(), R_PrintAliasStats(), R_PrintDSpeeds(), R_PrintTimes(), R_RecursiveClipBPoly(), R_ScreenShot_f(), SubdividePolygon(), SWimp_SetMode(), SWimp_Shutdown(), Sys_MakeCodeWriteable(), VID_CreateWindow(), VID_LoadRefresh(), and WritePCXfile().

◆ rw_time1

float rw_time1

Definition at line 724 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ rw_time2

float rw_time2

Definition at line 724 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ sadjust

◆ sc_base

surfcache_t * sc_base

Definition at line 753 of file r_local.h.

Referenced by R_InitGraphics(), and R_Shutdown().

◆ sc_rover

surfcache_t * sc_rover

Definition at line 753 of file r_local.h.

Referenced by D_FlushCaches(), D_SCAlloc(), D_SCDump(), R_InitCaches(), and R_SetupFrame().

◆ scale_for_mip

float scale_for_mip

Definition at line 79 of file r_edge.c.

Referenced by D_SolidSurf(), and D_ViewChanged().

◆ screenedge

mplane_t screenedge[4]

Definition at line 86 of file r_main.c.

Referenced by R_TransformFrustum(), and R_ViewChanged().

◆ se_time1

float se_time1

Definition at line 107 of file r_main.c.

Referenced by R_EdgeDrawing(), and R_PrintDSpeeds().

◆ se_time2

float se_time2

Definition at line 725 of file r_local.h.

Referenced by R_PrintDSpeeds().

◆ sintable

int sintable[1280]

Definition at line 47 of file r_rast.c.

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

◆ sky_texinfo

mtexinfo_t* sky_texinfo[6]

◆ surf_max

surf_t * surf_max

Definition at line 525 of file r_local.h.

◆ surface_p

surf_t * surface_p

Definition at line 525 of file r_local.h.

◆ surfaces

◆ sw_aliasstats

cvar_t* sw_aliasstats

Definition at line 112 of file r_main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_clearcolor

cvar_t* sw_clearcolor

Definition at line 114 of file r_main.c.

Referenced by D_BackgroundSurf(), D_ViewChanged(), and R_Register().

◆ sw_drawflat

cvar_t* sw_drawflat

Definition at line 115 of file r_main.c.

Referenced by D_DrawSurfaces(), and R_Register().

◆ sw_draworder

cvar_t* sw_draworder

Definition at line 116 of file r_main.c.

Referenced by R_BeginEdgeFrame(), and R_Register().

◆ sw_maxedges

cvar_t* sw_maxedges

Definition at line 117 of file r_main.c.

Referenced by R_NewMap(), and R_Register().

◆ sw_maxsurfs

cvar_t* sw_maxsurfs

Definition at line 118 of file r_main.c.

Referenced by R_NewMap(), and R_Register().

◆ sw_mipcap

cvar_t* sw_mipcap

Definition at line 26 of file r_misc.c.

Referenced by R_Register(), and R_SetupFrame().

◆ sw_mipscale

cvar_t* sw_mipscale

Definition at line 27 of file r_misc.c.

Referenced by R_Register(), and R_SetupFrame().

◆ sw_mode

cvar_t* sw_mode

Definition at line 119 of file r_main.c.

Referenced by R_BeginFrame(), and R_Register().

◆ sw_reportedgeout

cvar_t* sw_reportedgeout

Definition at line 120 of file r_main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_reportsurfout

cvar_t* sw_reportsurfout

Definition at line 121 of file r_main.c.

Referenced by R_Register(), and R_RenderFrame().

◆ sw_state

◆ sw_stipplealpha

cvar_t* sw_stipplealpha

Definition at line 122 of file r_main.c.

Referenced by R_Register().

◆ sw_surfcacheoverride

cvar_t* sw_surfcacheoverride

Definition at line 123 of file r_main.c.

Referenced by R_InitCaches(), and R_Register().

◆ sw_waterwarp

cvar_t* sw_waterwarp

Definition at line 124 of file r_main.c.

Referenced by R_Register(), and R_SetupFrame().

◆ sxformaxis

vec3_t sxformaxis[4]

◆ tadjust

◆ txformaxis

vec3_t txformaxis[4]

◆ ubasestep

◆ verticalFieldOfView

float verticalFieldOfView

Definition at line 83 of file r_main.c.

Referenced by R_ViewChanged().

◆ vid

◆ vid_fullscreen

cvar_t* vid_fullscreen

Definition at line 46 of file vid_dll.c.

◆ vid_gamma

cvar_t* vid_gamma

Definition at line 42 of file vid_dll.c.

◆ view_clipplanes

◆ vpn

◆ vright

◆ vup

◆ xcenter

◆ xOrigin

float xOrigin

Definition at line 84 of file r_main.c.

Referenced by R_ViewChanged().

◆ xscale

float xscale

Definition at line 76 of file r_main.c.

Referenced by D_ViewChanged(), R_ClipAndDrawPoly(), R_EmitEdge(), and R_ViewChanged().

◆ xscaleinv

float xscaleinv

◆ xscaleshrink

float xscaleshrink

Definition at line 78 of file r_main.c.

Referenced by R_DrawParticles(), and R_ViewChanged().

◆ ycenter

◆ yOrigin

float yOrigin

Definition at line 602 of file r_local.h.

Referenced by R_ViewChanged().

◆ yscale

float yscale

Definition at line 539 of file r_local.h.

Referenced by D_ViewChanged(), R_ClipAndDrawPoly(), R_EmitEdge(), and R_ViewChanged().

◆ yscaleinv

float yscaleinv

◆ yscaleshrink

float yscaleshrink

Definition at line 541 of file r_local.h.

Referenced by R_DrawParticles(), and R_ViewChanged().

◆ zspantable

short* zspantable[MAXHEIGHT]

Definition at line 43 of file r_misc.c.

Referenced by D_ViewChanged().

d_xdenom
int d_xdenom
Definition: r_polyse.c:66
vid_fullscreen
cvar_t * vid_fullscreen
Definition: vid_dll.c:46
RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:618
edge_tail_u_shift20
int edge_tail_u_shift20
Definition: r_edge.c:66
R_PolysetDrawSpans8_33
void R_PolysetDrawSpans8_33(spanpackage_t *pspanpackage)
Definition: r_polyse.c:820
box_faces
int box_faces[6]
Definition: r_rast.c:82
R_Alias_clip_bottom
void R_Alias_clip_bottom(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: r_aclip.c:152
model_s::numvertexes
int numvertexes
Definition: r_model.h:207
drawsurf_t::image
image_t * image
Definition: r_local.h:325
box_surfedges
int box_surfedges[24]
Definition: r_rast.c:78
d_vrecty
int d_vrecty
Definition: r_misc.c:38
it_sprite
@ it_sprite
Definition: r_local.h:59
dsprframe_t::name
char name[MAX_SKINNAME]
Definition: qfiles.h:178
cachewidth
int cachewidth
Definition: r_main.c:180
surfcache_s::size
int size
Definition: r_local.h:366
refdef_t::vieworg
float vieworg[3]
Definition: ref.h:124
refimport_t::Cmd_RemoveCommand
void(* Cmd_RemoveCommand)(char *name)
Definition: ref.h:223
c_surf
int c_surf
Definition: r_main.c:58
sw_reportedgeout
cvar_t * sw_reportedgeout
Definition: r_main.c:120
rserr_t
rserr_t
Definition: r_local.h:97
RF_SHELL_RED
#define RF_SHELL_RED
Definition: q_shared.h:623
height
GLsizei height
Definition: qgl_win.c:69
espan_s
Definition: r_local.h:375
currentmodel
model_t * currentmodel
Definition: r_main.c:37
WritePCXfile
void WritePCXfile(char *filename, byte *data, int width, int height, int rowbytes, byte *palette)
Definition: r_misc.c:546
r_framecount
int r_framecount
Definition: r_main.c:91
GL_LoadPic
image_t * GL_LoadPic(char *name, byte *pic, int width, int height, imagetype_t type)
Definition: r_image.c:420
oldrefdef_t::fvrectx_adj
float fvrectx_adj
Definition: r_local.h:120
blocklights
unsigned blocklights[1024]
Definition: r_light.c:277
r_numvblocks
int r_numvblocks
Definition: r_surf.c:36
msurface_s::styles
byte styles[MAXLIGHTMAPS]
Definition: r_model.h:115
r_leftexit
mvertex_t r_leftexit
Definition: r_rast.c:51
r_cnumsurfs
int r_cnumsurfs
Definition: r_main.c:59
YAW
#define YAW
Definition: q_shared.h:66
R_RecursiveWorldNode
void R_RecursiveWorldNode(mnode_t *node, int clipflags)
Definition: r_bsp.c:455
sw_mipscale
cvar_t * sw_mipscale
Definition: r_misc.c:27
d_sdivzorigin
float d_sdivzorigin
Definition: r_main.c:175
r_time1
float r_time1
Definition: r_main.c:48
transformed_modelorg
vec3_t transformed_modelorg
Definition: r_edge.c:743
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:73
entity_s::origin
float origin[3]
Definition: ref.h:57
R_Register
void R_Register(void)
Definition: r_main.c:245
DIB_SetPalette
void DIB_SetPalette(const unsigned char *_pal)
Definition: rw_dib.c:215
WINDOW_CLASS_NAME
#define WINDOW_CLASS_NAME
Definition: rw_imp.c:43
r_clip_verts
vec5_t r_clip_verts[2][MAXWORKINGVERTS+2]
Definition: r_poly.c:50
BACKFACE_EPSILON
#define BACKFACE_EPSILON
Definition: r_local.h:220
yscaleshrink
float yscaleshrink
Definition: r_local.h:541
D_SCAlloc
surfcache_t * D_SCAlloc(int width, int size)
Definition: r_surf.c:442
MAX_BMODEL_VERTS
#define MAX_BMODEL_VERTS
Definition: r_bsp.c:40
R_InitImages
void R_InitImages(void)
Definition: r_image.c:607
r_turb_turb
int * r_turb_turb
Definition: r_scan.c:28
r_novis
cvar_t * r_novis
Definition: r_main.c:131
LittleShort
short LittleShort(short l)
Definition: q_shared.c:946
pbedges
static bedge_t * pbedges
Definition: r_bsp.c:44
intsintable
int intsintable[1280]
Definition: r_rast.c:48
oldrefdef_t::vieworg
vec3_t vieworg
Definition: r_local.h:132
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
r_rightenter
mvertex_t r_rightenter
Definition: r_rast.c:52
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:156
surfcache_s
Definition: r_local.h:360
Sys_SetFPCW
void Sys_SetFPCW(void)
Definition: rw_imp.c:437
R_ShutdownImages
void R_ShutdownImages(void)
Definition: r_image.c:617
finalvert_s::u
int u
Definition: r_local.h:282
RF_SHELL_HALF_DAM
#define RF_SHELL_HALF_DAM
Definition: q_shared.h:631
R_AliasSetupSkin
static qboolean R_AliasSetupSkin(void)
Definition: r_alias.c:834
CYCLE
#define CYCLE
Definition: asm_draw.h:16
r_maxsurfsseen
int r_maxsurfsseen
Definition: r_main.c:59
D_BackgroundSurf
void D_BackgroundSurf(surf_t *s)
Definition: r_edge.c:864
MAX_MAP_EDGES
#define MAX_MAP_EDGES
Definition: qfiles.h:245
TransformVector
void TransformVector(vec3_t in, vec3_t out)
Definition: r_misc.c:215
mod_known
model_t mod_known[MAX_MOD_KNOWN]
Definition: r_model.c:38
sw_reportsurfout
cvar_t * sw_reportsurfout
Definition: r_main.c:121
swwstate_t::initializing
qboolean initializing
Definition: rw_win.h:52
da_time1
float da_time1
Definition: r_main.c:106
r_lerpmodels
cvar_t * r_lerpmodels
Definition: r_main.c:130
Sys_MakeCodeWriteable
void Sys_MakeCodeWriteable(unsigned long startaddr, unsigned long length)
Definition: rw_imp.c:408
viddef_t::buffer
pixel_t * buffer
Definition: r_local.h:88
imagetype_t
imagetype_t
Definition: r_local.h:56
insubmodel
qboolean insubmodel
Definition: r_bsp.c:27
mvertex_t
Definition: r_model.h:45
r_emitted
int r_emitted
Definition: r_rast.c:60
R_ScreenShot_f
void R_ScreenShot_f(void)
Definition: r_misc.c:619
c_faceclip
int c_faceclip
Definition: r_rast.c:34
model_s::nummodelsurfaces
int nummodelsurfaces
Definition: r_model.h:196
R_EmitEdge
void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1)
Definition: r_rast.c:219
skinwidth
int skinwidth
Definition: r_polyse.c:114
de_time1
float de_time1
Definition: r_local.h:725
r_outofedges
int r_outofedges
Definition: r_main.c:52
R_PushDlights
void R_PushDlights(model_t *model)
Definition: r_light.c:94
bottom
GLdouble GLdouble bottom
Definition: qgl_win.c:159
screenedge
mplane_t screenedge[4]
Definition: r_main.c:86
Hunk_Free
void Hunk_Free(void *base)
Definition: q_shwin.c:99
R_GammaCorrectAndSetPalette
void R_GammaCorrectAndSetPalette(const unsigned char *pal)
Definition: r_main.c:1160
R_ClipEdge
void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
Definition: r_rast.c:398
ri
refimport_t ri
Definition: r_main.c:25
pcx_t
Definition: qfiles.h:60
R_SurfacePatch
void R_SurfacePatch(void)
Definition: r_misc.c:524
espan_t
struct espan_s espan_t
Sys_Mkdir
void Sys_Mkdir(char *path)
Definition: q_shwin.c:135
RF_SHELL_GREEN
#define RF_SHELL_GREEN
Definition: q_shared.h:624
d_aflatcolor
int d_aflatcolor
Definition: r_polyse.c:65
PRINT_DEVELOPER
#define PRINT_DEVELOPER
Definition: qcommon.h:744
r_skyfaces
msurface_t * r_skyfaces
Definition: r_rast.c:68
aliastriangleparms_t::b
finalvert_t * b
Definition: r_local.h:712
DDRAW_Shutdown
void DDRAW_Shutdown(void)
Definition: rw_ddraw.c:317
R_Alias_clip_z
void R_Alias_clip_z(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: r_aclip.c:44
oldrefdef_t::viewangles
vec3_t viewangles
Definition: r_local.h:133
makeleftedge
static qboolean makeleftedge
Definition: r_rast.c:44
v
GLdouble v
Definition: qgl_win.c:143
it_wall
@ it_wall
Definition: r_local.h:60
cvar_s::modified
qboolean modified
Definition: q_shared.h:323
R_InitGraphics
void R_InitGraphics(int width, int height)
Definition: r_main.c:1066
yscaleinv
float yscaleinv
Definition: r_local.h:540
R_CalcPalette
void R_CalcPalette(void)
Definition: r_main.c:919
d_tdivzstepv
float d_tdivzstepv
Definition: r_local.h:482
CACHE_SIZE
#define CACHE_SIZE
Definition: d_ifacea.h:22
dsprframe_t::height
int height
Definition: qfiles.h:176
d_8to24table
unsigned d_8to24table[256]
Definition: r_main.c:27
sw_drawflat
cvar_t * sw_drawflat
Definition: r_main.c:115
R_PolysetDrawSpans8_66
void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
Definition: r_polyse.c:928
r_stepback
int r_stepback
Definition: r_surf.c:34
d_vrectbottom_particle
int d_vrectbottom_particle
Definition: r_misc.c:38
vrect_s::height
int height
Definition: vid.h:24
vright
vec3_t vright
Definition: r_main.c:68
oldrefdef_t::vrectright_adj_shift20
int vrectright_adj_shift20
Definition: r_local.h:122
model_s::edges
medge_t * edges
Definition: r_model.h:211
r_skytexinfo
mtexinfo_t r_skytexinfo[6]
Definition: r_rast.c:70
surf_s::flags
int flags
Definition: r_local.h:410
Mod_PointInLeaf
mleaf_t * Mod_PointInLeaf(vec3_t p, model_t *model)
Definition: r_model.c:188
x2
GLdouble GLdouble x2
Definition: qgl_win.c:301
vid
viddef_t vid
Definition: r_main.c:24
refimport_t::FS_LoadFile
int(* FS_LoadFile)(char *name, void **buf)
Definition: ref.h:235
swwstate_t::lpddsFrontBuffer
LPDIRECTDRAWSURFACE lpddsFrontBuffer
Definition: rw_win.h:44
de_time1
float de_time1
Definition: r_main.c:107
refimport_t::Cvar_Get
cvar_t *(* Cvar_Get)(char *name, char *value, int flags)
Definition: ref.h:242
sw_draworder
cvar_t * sw_draworder
Definition: r_main.c:116
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
pcx_t::version
char version
Definition: qfiles.h:63
pcx_t::data
unsigned char data
Definition: qfiles.h:74
sw_surfcacheoverride
cvar_t * sw_surfcacheoverride
Definition: r_main.c:123
R_FindImage
image_t * R_FindImage(char *name, imagetype_t type)
Definition: r_image.c:497
x
GLint GLenum GLint x
Definition: qgl_win.c:116
viddef_t::width
int width
Definition: vid.h:29
dp_time1
float dp_time1
Definition: r_main.c:106
R_AliasClip
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: r_aclip.c:186
surfcache_s::lightadj
int lightadj[MAXLIGHTMAPS]
Definition: r_local.h:364
sw_surfcacheoverride
cvar_t * sw_surfcacheoverride
Definition: r_main.c:123
z
GLdouble GLdouble z
Definition: qgl_win.c:283
oldrefdef_t::xOrigin
float xOrigin
Definition: r_local.h:129
entity_s::skinnum
int skinnum
Definition: ref.h:70
i
int i
Definition: q_shared.c:305
d_viewbuffer
pixel_t * d_viewbuffer
Definition: r_main.c:181
msurface_s::numedges
int numedges
Definition: r_model.h:104
surf_max
surf_t * surf_max
Definition: r_edge.c:51
refdef_t::y
int y
Definition: ref.h:122
modelorg
vec3_t modelorg
Definition: r_bsp.c:29
msurface_s::dlightframe
int dlightframe
Definition: r_model.h:97
model_s::firstnode
int firstnode
Definition: r_model.h:214
r_currentkey
int r_currentkey
Definition: r_edge.c:62
r_lightptr
unsigned * r_lightptr
Definition: r_surf.c:33
de_time2
float de_time2
Definition: r_local.h:725
d_tdivzorigin
float d_tdivzorigin
Definition: r_local.h:483
PARTICLE_66
#define PARTICLE_66
Definition: r_part.c:25
espan_s::pnext
struct espan_s * pnext
Definition: r_local.h:378
sw_lockpvs
cvar_t * sw_lockpvs
Definition: r_main.c:140
polydesc_t::pixel_width
int pixel_width
Definition: r_local.h:387
polydesc_t::stipple_parity
int stipple_parity
Definition: r_local.h:394
blockdivshift
int blockdivshift
Definition: r_surf.c:28
fv
float fv
Definition: r_edge.c:75
sourcetstep
int sourcetstep
Definition: r_surf.c:26
sw_clearcolor
cvar_t * sw_clearcolor
Definition: r_main.c:114
model_s
Definition: r_model.h:171
r_drawworld
cvar_t * r_drawworld
Definition: r_main.c:126
r_u1
float r_u1
Definition: r_rast.c:62
viddef_t::height
int height
Definition: vid.h:29
d_pdrawspans
void(* d_pdrawspans)(spanpackage_t *pspanpackage)
Definition: r_polyse.c:117
PITCH
#define PITCH
Definition: q_shared.h:65
r_aliasuvscale
float r_aliasuvscale
Definition: r_main.c:50
dlight_t::origin
vec3_t origin
Definition: ref.h:91
r_oldviewcluster
int r_oldviewcluster
Definition: r_local.h:731
pbasesource
unsigned char * pbasesource
Definition: r_surf.c:31
pointcolor
vec3_t pointcolor
Definition: r_light.c:116
swwstate_t::lpddsOffScreenBuffer
LPDIRECTDRAWSURFACE lpddsOffScreenBuffer
Definition: rw_win.h:46
r_origin
vec3_t r_origin
Definition: r_main.c:69
R_EmitCachedEdge
void R_EmitCachedEdge(void)
Definition: r_rast.c:502
r_wholepolycount
int r_wholepolycount
Definition: r_main.c:96
refdef_t::rdflags
int rdflags
Definition: ref.h:128
entity_rotation
float entity_rotation[3][3]
Definition: r_bsp.c:34
R_EmitSkyBox
void R_EmitSkyBox(void)
Definition: r_rast.c:170
SWimp_Shutdown
void SWimp_Shutdown(void)
Definition: rw_imp.c:359
oldrefdef_t::fvrectright_adj
float fvrectright_adj
Definition: r_local.h:123
SPEED
#define SPEED
Definition: r_local.h:233
r_lightwidth
int r_lightwidth
Definition: r_surf.c:35
xscaleinv
float xscaleinv
Definition: r_main.c:77
width
GLint GLsizei width
Definition: qgl_win.c:115
R_PolysetDrawSpans8_Opaque
void R_PolysetDrawSpans8_Opaque(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1038
alias_colormap
unsigned char * alias_colormap
Definition: r_misc.c:76
r_surfsonstack
qboolean r_surfsonstack
Definition: r_main.c:60
edge_s::surfs
unsigned short surfs[2]
Definition: r_local.h:426
finalvert_s::t
int t
Definition: r_local.h:282
c_faceclip
int c_faceclip
Definition: r_rast.c:34
entity_s::flags
int flags
Definition: ref.h:76
pcx_t::hres
unsigned short hres
Definition: qfiles.h:67
r_alpha_surfaces
msurface_t * r_alpha_surfaces
Definition: r_poly.c:45
pdrawfunc
static void(* pdrawfunc)(void)
Definition: r_edge.c:68
vid_gamma
cvar_t * vid_gamma
Definition: r_main.c:137
M_PI
#define M_PI
Definition: q_shared.h:135
dp_time2
float dp_time2
Definition: r_main.c:106
image_s::registration_sequence
int registration_sequence
Definition: r_local.h:71
currententity
entity_t * currententity
Definition: r_bsp.c:28
r_time1
float r_time1
Definition: r_main.c:48
SURF_WARP
#define SURF_WARP
Definition: qfiles.h:372
PARTICLE_Z_CLIP
#define PARTICLE_Z_CLIP
Definition: d_ifacea.h:37
surfcache_s::image
image_t * image
Definition: r_local.h:370
r_pright
vec3_t r_pright
Definition: r_part.c:22
type
GLenum type
Definition: qgl_win.c:72
oldrefdef_t::yOrigin
float yOrigin
Definition: r_local.h:130
mplane_s::normal
vec3_t normal
Definition: r_model.h:59
msurface_s::extents
short extents[2]
Definition: r_model.h:110
se_time1
float se_time1
Definition: r_main.c:107
d_zrowbytes
unsigned int d_zrowbytes
Definition: r_main.c:183
polydesc_t::vpn
vec3_t vpn
Definition: r_local.h:389
r_numhblocks
int r_numhblocks
Definition: r_surf.c:36
cvar_s
Definition: q_shared.h:317
SHELL_DOUBLE_COLOR
#define SHELL_DOUBLE_COLOR
Definition: ref.h:42
mod_brush
@ mod_brush
Definition: r_model.h:169
R_DrawSurface
void R_DrawSurface(void)
Definition: r_surf.c:90
box_vecs
vec3_t box_vecs[6][2]
Definition: r_rast.c:84
r_turb_t
fixed16_t r_turb_t
Definition: r_scan.c:27
D_SkySurf
void D_SkySurf(surf_t *s)
Definition: r_edge.c:942
R_MarkLights
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
Definition: r_light.c:40
polydesc_t::viewer_position
float viewer_position[3]
Definition: r_local.h:392
mleaf_s
Definition: r_model.h:143
R_DrawTriangle
void R_DrawTriangle(void)
Definition: r_polyse.c:204
SURF_TRANS66
#define SURF_TRANS66
Definition: qfiles.h:374
r_lefthand
cvar_t * r_lefthand
Definition: r_main.c:111
model_s::extradata
void * extradata
Definition: r_model.h:235
numbedges
static int numbedges
Definition: r_bsp.c:45
clipplane_s::normal
vec3_t normal
Definition: r_local.h:351
sw_draworder
cvar_t * sw_draworder
Definition: r_main.c:116
ALIAS_Z_CLIP
#define ALIAS_Z_CLIP
Definition: r_local.h:207
r_drawentities
cvar_t * r_drawentities
Definition: r_main.c:127
sc_rover
surfcache_t * sc_rover
Definition: r_surf.c:58
refimport_t::FS_FreeFile
void(* FS_FreeFile)(void *buf)
Definition: ref.h:236
vup
vec3_t vup
Definition: r_main.c:66
r_viewcluster
int r_viewcluster
Definition: r_main.c:102
SWimp_SetPalette
void SWimp_SetPalette(const unsigned char *palette)
Definition: rw_imp.c:333
j
GLint j
Definition: qgl_win.c:150
rserr_unknown
@ rserr_unknown
Definition: r_local.h:104
D_WarpScreen
void D_WarpScreen(void)
Definition: r_scan.c:42
r_clip_verts
vec5_t r_clip_verts[2][MAXWORKINGVERTS+2]
Definition: r_poly.c:50
Draw_GetPalette
void Draw_GetPalette(void)
Definition: r_main.c:1326
PARTICLE_OPAQUE
#define PARTICLE_OPAQUE
Definition: r_part.c:26
msurface_s::plane
mplane_t * plane
Definition: r_model.h:100
partparms_t::color
int color
Definition: r_part.c:32
de_time2
float de_time2
Definition: r_main.c:107
surf_s::spans
struct espan_s * spans
Definition: r_local.h:403
r_dspeeds
cvar_t * r_dspeeds
Definition: r_main.c:128
mvertex_t::position
vec3_t position
Definition: r_model.h:47
rw_time2
float rw_time2
Definition: r_local.h:724
R_ViewChanged
void R_ViewChanged(vrect_t *vr)
Definition: r_misc.c:331
r_numallocatededges
int r_numallocatededges
Definition: r_main.c:49
Mod_FreeAll
void Mod_FreeAll(void)
Definition: r_model.c:1250
R_RecursiveClipBPoly
void R_RecursiveClipBPoly(bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
Definition: r_bsp.c:156
refimport_t::Vid_GetModeInfo
qboolean(* Vid_GetModeInfo)(int *width, int *height, int mode)
Definition: ref.h:246
mod_numknown
int mod_numknown
Definition: r_model.c:39
c_drawnode
int c_drawnode
Definition: r_bsp.c:448
espan_s::count
int count
Definition: r_local.h:377
sw_maxedges
cvar_t * sw_maxedges
Definition: r_main.c:117
R_FreeUnusedImages
void R_FreeUnusedImages(void)
Definition: r_image.c:578
byte
unsigned char byte
Definition: q_shared.h:55
edge_p
edge_t * edge_p
Definition: r_edge.c:49
r_refdef
oldrefdef_t r_refdef
Definition: r_main.c:74
aliasxscale
float aliasxscale
Definition: r_main.c:79
r_leftclipped
qboolean r_leftclipped
Definition: r_rast.c:43
finalvert_s::v
int v
Definition: r_local.h:282
R_EdgeDrawing
void R_EdgeDrawing(void)
Definition: r_main.c:853
dsprite_t
Definition: qfiles.h:181
fv
static finalvert_t fv[2][8]
Definition: r_aclip.c:24
polydesc_t::pixels
byte * pixels
Definition: r_local.h:386
edge_s::next
struct edge_s * next
Definition: r_local.h:425
model_s::numedges
int numedges
Definition: r_model.h:210
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
SURF_PLANEBACK
#define SURF_PLANEBACK
Definition: r_model.h:68
RF_WEAPONMODEL
#define RF_WEAPONMODEL
Definition: q_shared.h:615
r_p1
int r_p1[6]
Definition: r_polyse.c:61
R_Alias_clip_right
void R_Alias_clip_right(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: r_aclip.c:94
r_numallocatededges
int r_numallocatededges
Definition: r_main.c:49
polydesc_t::t_offset
float t_offset
Definition: r_local.h:391
model_s::registration_sequence
int registration_sequence
Definition: r_model.h:175
surfrowbytes
int surfrowbytes
Definition: r_surf.c:32
oldrefdef_t::fvrecty_adj
float fvrecty_adj
Definition: r_local.h:120
refimport_t::Con_Printf
void(* Con_Printf)(int print_level, char *str,...)
Definition: ref.h:228
PRINT_ALL
#define PRINT_ALL
Definition: qcommon.h:743
D_DrawSurfaces
void D_DrawSurfaces(void)
Definition: r_edge.c:1090
R_SetLightLevel
void R_SetLightLevel(void)
Definition: r_main.c:970
bedge_s::pnext
struct bedge_s * pnext
Definition: r_local.h:344
mtexinfo_s::image
image_t * image
Definition: r_model.h:87
polydesc_t::s_offset
float s_offset
Definition: r_local.h:391
R_Alias_clip_left
void R_Alias_clip_left(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: r_aclip.c:65
partparms_t::particle
particle_t * particle
Definition: r_part.c:30
pcx_t::ymin
unsigned short ymin
Definition: qfiles.h:66
R_RegisterModel
struct model_s * R_RegisterModel(char *name)
Definition: r_model.c:1165
SWimp_InitGraphics
static qboolean SWimp_InitGraphics(qboolean fullscreen)
Definition: rw_imp.c:136
SHELL_BLUE_COLOR
#define SHELL_BLUE_COLOR
Definition: ref.h:34
d_pix_max
int d_pix_max
Definition: r_local.h:498
swwstate_t::palettized
qboolean palettized
Definition: rw_win.h:49
RDF_NOWORLDMODEL
#define RDF_NOWORLDMODEL
Definition: q_shared.h:646
r_skyedges
medge_t * r_skyedges
Definition: r_rast.c:72
base_vup
vec3_t base_vup
Definition: r_local.h:521
SHELL_RED_COLOR
#define SHELL_RED_COLOR
Definition: ref.h:32
Draw_Fill
#define Draw_Fill
Definition: qmenu.c:53
da_time1
float da_time1
Definition: r_main.c:106
NUM_BEAM_SEGS
#define NUM_BEAM_SEGS
R_PolysetDrawSpansConstant8_33
void R_PolysetDrawSpansConstant8_33(spanpackage_t *pspanpackage)
Definition: r_polyse.c:884
CrossProduct
void CrossProduct(vec3_t v1, vec3_t v2, vec3_t cross)
Definition: q_shared.c:753
d_ziorigin
float d_ziorigin
Definition: r_local.h:483
base_vpn
vec3_t base_vpn
Definition: r_local.h:522
prowdestbase
void * prowdestbase
Definition: r_surf.c:30
sw_mipcap
cvar_t * sw_mipcap
Definition: r_misc.c:26
NUM_MIPS
#define NUM_MIPS
Definition: r_misc.c:24
model_s::numframes
int numframes
Definition: r_model.h:178
R_DrawEntitiesOnList
void R_DrawEntitiesOnList(void)
Definition: r_main.c:513
r_speeds
cvar_t * r_speeds
Definition: r_main.c:133
D_FlushCaches
void D_FlushCaches(void)
Definition: r_surf.c:418
SWimp_EndFrame
void SWimp_EndFrame(void)
Definition: rw_imp.c:176
r_edges
edge_t * r_edges
Definition: r_edge.c:49
auxedges
edge_t * auxedges
Definition: r_edge.c:48
sw_drawflat
cvar_t * sw_drawflat
Definition: r_main.c:115
miplevel
static int miplevel
Definition: r_edge.c:77
Draw_InitLocal
void Draw_InitLocal(void)
Definition: r_draw.c:58
d_pix_min
int d_pix_min
Definition: r_misc.c:40
it_pic
@ it_pic
Definition: r_local.h:61
base_vright
vec3_t base_vright
Definition: r_local.h:523
MINEDGES
#define MINEDGES
Definition: r_local.h:197
model_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:218
surf_s::entity
entity_t * entity
Definition: r_local.h:412
FRAMECOUNT_MASK
#define FRAMECOUNT_MASK
Definition: r_rast.c:30
entity_s::alpha
float alpha
Definition: ref.h:73
viddef_t::rowbytes
int rowbytes
Definition: r_local.h:91
R_LoadWal
image_t * R_LoadWal(char *name)
Definition: r_image.c:454
vid_fullscreen
cvar_t * vid_fullscreen
Definition: r_main.c:136
xscaleshrink
float xscaleshrink
Definition: r_main.c:78
Mod_ForName
model_t * Mod_ForName(char *name, qboolean crash)
Definition: r_model.c:90
r
GLdouble GLdouble r
Definition: qgl_win.c:336
mplane_s::dist
float dist
Definition: r_model.h:60
medge_t
Definition: r_model.h:77
r_polycount
int r_polycount
Definition: r_main.c:94
R_BuildPolygonFromSurface
void R_BuildPolygonFromSurface(msurface_t *fa)
Definition: r_poly.c:1010
r_maxedgesseen
int r_maxedgesseen
Definition: r_main.c:59
image_s::height
int height
Definition: r_local.h:69
d_vrectx
int d_vrectx
Definition: r_misc.c:38
Draw_StretchPicImplementation
void Draw_StretchPicImplementation(int x, int y, int w, int h, image_t *pic)
Definition: r_draw.c:163
r_lerpmodels
cvar_t * r_lerpmodels
Definition: r_main.c:130
se_time2
float se_time2
Definition: r_local.h:725
R_InitTextures
void R_InitTextures(void)
Definition: r_main.c:196
SHELL_BG_COLOR
#define SHELL_BG_COLOR
Definition: ref.h:39
ALIAS_BOTTOM_CLIP
#define ALIAS_BOTTOM_CLIP
Definition: r_local.h:206
model_s::type
modtype_t type
Definition: r_model.h:177
r_p0
int r_p0[6]
Definition: r_polyse.c:61
BlendParticle33
static byte BlendParticle33(int pcolor, int dstcolor)
Definition: r_part.c:438
clipplane_s::leftedge
byte leftedge
Definition: r_local.h:354
v2
GLdouble GLdouble GLint GLint GLdouble GLdouble v2
Definition: qgl_win.c:227
bbextentt
fixed16_t bbextentt
Definition: r_local.h:486
refdef_t::num_dlights
int num_dlights
Definition: ref.h:137
refimport_t::Cmd_AddCommand
void(* Cmd_AddCommand)(char *name, void(*cmd)(void))
Definition: ref.h:222
ROLL
#define ROLL
Definition: q_shared.h:67
edge_s::u_step
fixed16_t u_step
Definition: r_local.h:424
clipplane_s::rightedge
byte rightedge
Definition: r_local.h:355
sw_mipcap
cvar_t * sw_mipcap
Definition: r_misc.c:26
R_PrintTimes
void R_PrintTimes(void)
Definition: r_misc.c:131
r_skyverts
mvertex_t * r_skyverts
Definition: r_rast.c:71
D_TurbulentSurf
void D_TurbulentSurf(surf_t *s)
Definition: r_edge.c:881
sintable
int sintable[1280]
Definition: r_rast.c:47
R_NewMap
void R_NewMap(void)
Definition: r_main.c:380
espan_s::v
int v
Definition: r_local.h:377
R_EntityRotate
void R_EntityRotate(vec3_t vec)
Definition: r_bsp.c:59
polydesc_t::nump
int nump
Definition: r_local.h:384
particle_t::alpha
float alpha
Definition: ref.h:100
RF_DEPTHHACK
#define RF_DEPTHHACK
Definition: q_shared.h:617
r_images
image_t r_images[MAX_RIMAGES]
Definition: r_image.c:25
R_GammaCorrectAndSetPalette
void R_GammaCorrectAndSetPalette(const unsigned char *palette)
Definition: r_main.c:1160
rserr_invalid_mode
@ rserr_invalid_mode
Definition: r_local.h:102
PerpendicularVector
void PerpendicularVector(vec3_t dst, const vec3_t src)
Definition: q_shared.c:152
sw_waterwarp
cvar_t * sw_waterwarp
Definition: r_main.c:124
VectorLength
vec_t VectorLength(vec3_t v)
Definition: q_shared.c:762
numbverts
static int numbverts
Definition: r_bsp.c:45
model_s::numsurfedges
int numsurfedges
Definition: r_model.h:223
oldrefdef_t::aliasvrectbottom
int aliasvrectbottom
Definition: r_local.h:116
msurface_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:112
scale_for_mip
float scale_for_mip
Definition: r_edge.c:79
d_pix_shift
int d_pix_shift
Definition: r_local.h:498
edge_tail
edge_t edge_tail
Definition: r_edge.c:71
swwstate_t::hInstance
HINSTANCE hInstance
Definition: rw_win.h:28
drawsurf_t::surfheight
int surfheight
Definition: r_local.h:328
oldrefdef_t::fvrectbottom_adj
float fvrectbottom_adj
Definition: r_local.h:123
edge_s::owner
medge_t * owner
Definition: r_local.h:429
medge_t::cachededgeoffset
unsigned int cachededgeoffset
Definition: r_model.h:80
basemip
static float basemip[NUM_MIPS-1]
Definition: r_misc.c:34
t
GLdouble t
Definition: qgl_win.c:328
model_s::nodes
mnode_t * nodes
Definition: r_model.h:215
r_turb_s
fixed16_t r_turb_s
Definition: r_scan.c:27
R_RasterizeAliasPolySmooth
void R_RasterizeAliasPolySmooth(void)
Definition: r_polyse.c:1151
partparms_t::level
int level
Definition: r_part.c:31
d_spanpixcount
int d_spanpixcount
Definition: r_main.c:93
r_affinetridesc
affinetridesc_t r_affinetridesc
Definition: r_alias.c:36
R_RemoveEdges
void R_RemoveEdges(edge_t *pedge)
Definition: r_edge.c:196
r_rightexit
mvertex_t r_rightexit
Definition: r_rast.c:52
R_DrawParticles
void R_DrawParticles(void)
Definition: r_part.c:596
edge_aftertail
edge_t edge_aftertail
Definition: r_edge.c:72
mleaf_s::cluster
int cluster
Definition: r_model.h:154
drawsurf_t::rowbytes
int rowbytes
Definition: r_local.h:321
surf_s::nearzi
float nearzi
Definition: r_local.h:413
surfcache_s::mipscale
float mipscale
Definition: r_local.h:369
pixel_t
unsigned char pixel_t
Definition: r_local.h:78
d_pix_shift
int d_pix_shift
Definition: r_misc.c:40
refimport_t::Sys_Error
void(* Sys_Error)(int err_level, char *str,...)
Definition: ref.h:220
DDRAW_SetPalette
void DDRAW_SetPalette(const unsigned char *pal)
Definition: rw_ddraw.c:288
dmdl_t::num_skins
int num_skins
Definition: qfiles.h:146
dlight_t::color
vec3_t color
Definition: ref.h:92
polydesc_t::dist
float dist
Definition: r_local.h:390
RF_SHELL_DOUBLE
#define RF_SHELL_DOUBLE
Definition: q_shared.h:630
SURF_FLOWING
#define SURF_FLOWING
Definition: qfiles.h:375
d_pix_max
int d_pix_max
Definition: r_misc.c:40
r_clipflags
int r_clipflags
Definition: r_main.c:61
R_PrintAliasStats
void R_PrintAliasStats(void)
Definition: r_misc.c:175
sadjust
fixed16_t sadjust
Definition: r_local.h:672
surf_s::msurf
msurface_t * msurf
Definition: r_local.h:411
d_tdivzstepu
float d_tdivzstepu
Definition: r_local.h:481
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:36
edge_max
edge_t * edge_max
Definition: r_edge.c:49
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:155
CVAR_ARCHIVE
#define CVAR_ARCHIVE
Definition: q_shared.h:309
D_Patch
void D_Patch(void)
Definition: r_misc.c:50
SURF_TRANS33
#define SURF_TRANS33
Definition: qfiles.h:373
drawsurf_t::surfmip
int surfmip
Definition: r_local.h:326
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:39
AMP
#define AMP
Definition: r_local.h:231
edge_s::nearzi
float nearzi
Definition: r_local.h:428
r_ceilv1
int r_ceilv1
Definition: r_rast.c:63
r_turb_pbase
unsigned char * r_turb_pbase
Definition: r_scan.c:26
clipplane_s::next
struct clipplane_s * next
Definition: r_local.h:353
MINSURFACES
#define MINSURFACES
Definition: r_local.h:199
da_time2
float da_time2
Definition: r_local.h:723
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:39
pcx_t::ymax
unsigned short ymax
Definition: qfiles.h:66
makerightedge
static qboolean makerightedge
Definition: r_rast.c:44
surfcache_s::owner
struct surfcache_s ** owner
Definition: r_local.h:363
edge_head
edge_t edge_head
Definition: r_edge.c:70
cvar_s::value
float value
Definition: q_shared.h:324
r_pup
vec3_t r_pup
Definition: r_part.c:22
skinstart
byte * skinstart
Definition: r_polyse.c:115
D_DrawflatSurfaces
void D_DrawflatSurfaces(void)
Definition: r_edge.c:1062
r_currentbkey
int r_currentbkey
Definition: r_bsp.c:36
entity_s::backlerp
float backlerp
Definition: ref.h:69
xscale
float xscale
Definition: r_main.c:76
swwstate_t::modex
qboolean modex
Definition: rw_win.h:50
r_skysurfedges
int * r_skysurfedges
Definition: r_rast.c:73
MAX_OSPATH
#define MAX_OSPATH
Definition: q_shared.h:74
R_UnRegister
void R_UnRegister(void)
Definition: r_main.c:288
NUMSTACKEDGES
#define NUMSTACKEDGES
Definition: r_local.h:196
XCENTERING
#define XCENTERING
Definition: r_local.h:215
model_s::lightdata
byte * lightdata
Definition: r_model.h:231
R_ClipAndDrawPoly
void R_ClipAndDrawPoly(float alpha, int isturbulent, qboolean textured)
Definition: r_poly.c:898
r_nearzionly
qboolean r_nearzionly
Definition: r_rast.c:45
sc_base
surfcache_t * sc_base
Definition: r_surf.c:58
r_outofsurfaces
int r_outofsurfaces
Definition: r_main.c:51
image_s::type
imagetype_t type
Definition: r_local.h:68
Mod_Init
void Mod_Init(void)
Definition: r_model.c:78
clipplane_s
Definition: r_local.h:349
r_polydesc
polydesc_t r_polydesc
Definition: r_poly.c:43
espan_s::u
int u
Definition: r_local.h:377
refimport_t::FS_Gamedir
char *(* FS_Gamedir)(void)
Definition: ref.h:240
SURF_DRAWTURB
#define SURF_DRAWTURB
Definition: r_model.h:70
drawsurf_t::surfdat
byte * surfdat
Definition: r_local.h:320
edge_s::u
fixed16_t u
Definition: r_local.h:423
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: q_shared.c:681
F
#define F(X, Y, Z)
Definition: md4.c:13
blocksize
int blocksize
Definition: r_surf.c:26
pcx_t::encoding
char encoding
Definition: qfiles.h:64
NULL
#define NULL
Definition: q_shared.h:60
r_drawnpolycount
int r_drawnpolycount
Definition: r_main.c:95
WARP_WIDTH
#define WARP_WIDTH
Definition: r_local.h:174
bbextents
fixed16_t bbextents
Definition: r_local.h:673
MAX_MAP_FACES
#define MAX_MAP_FACES
Definition: qfiles.h:241
DIB_Shutdown
void DIB_Shutdown(void)
Definition: rw_dib.c:320
refdef_t::time
float time
Definition: ref.h:127
pbverts
static mvertex_t * pbverts
Definition: r_bsp.c:43
d_scantable
int d_scantable[MAXHEIGHT]
Definition: r_misc.c:42
r_viewcluster
int r_viewcluster
Definition: r_main.c:102
edge_s::nextremove
struct edge_s * nextremove
Definition: r_local.h:427
vrect_s::x
int x
Definition: vid.h:24
SHELL_HALF_DAM_COLOR
#define SHELL_HALF_DAM_COLOR
Definition: ref.h:43
d_zistepv
float d_zistepv
Definition: r_local.h:482
SWimp_SetMode
rserr_t SWimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen)
Definition: rw_imp.c:266
zspantable
short * zspantable[MAXHEIGHT]
Definition: r_misc.c:43
surfmiptable
static void(* surfmiptable[4])(void)
Definition: r_surf.c:44
model_s::surfedges
int * surfedges
Definition: r_model.h:224
r_alpha_surfaces
msurface_t * r_alpha_surfaces
Definition: r_poly.c:45
R_TextureAnimation
image_t * R_TextureAnimation(mtexinfo_t *tex)
Definition: r_surf.c:67
R_GenerateSpansBackward
void R_GenerateSpansBackward(void)
Definition: r_edge.c:601
finalvert_s::zi
int zi
Definition: r_local.h:284
surface_p
surf_t * surface_p
Definition: r_edge.c:51
image_s::pixels
byte * pixels[4]
Definition: r_local.h:72
se_time2
float se_time2
Definition: r_main.c:107
image_s::width
int width
Definition: r_local.h:69
r_turb_tstep
fixed16_t r_turb_tstep
Definition: r_scan.c:27
FULLY_CLIPPED_CACHED
#define FULLY_CLIPPED_CACHED
Definition: r_rast.c:29
VectorInverse
void VectorInverse(vec3_t v)
Definition: q_shared.c:775
dp_time1
float dp_time1
Definition: r_main.c:106
bedge_s
Definition: r_local.h:341
particle_t
Definition: ref.h:96
numr_images
int numr_images
Definition: r_image.c:26
r_viewleaf
mleaf_t * r_viewleaf
Definition: r_main.c:101
pcx_t::palette_type
unsigned short palette_type
Definition: qfiles.h:72
alpha
GLfloat GLfloat GLfloat alpha
Definition: qgl_win.c:74
refdef_t::num_particles
int num_particles
Definition: ref.h:140
refdef_t::height
int height
Definition: ref.h:122
R_InsertNewEdges
void R_InsertNewEdges(edge_t *edgestoadd, edge_t *edgelist)
Definition: r_edge.c:155
r_screenwidth
int r_screenwidth
Definition: r_main.c:81
d_zistepu
float d_zistepu
Definition: r_local.h:481
edge_sentinel
edge_t edge_sentinel
Definition: r_edge.c:73
image_s::name
char name[MAX_QPATH]
Definition: r_local.h:67
image_s::transparent
qboolean transparent
Definition: r_local.h:70
r_sourcemax
unsigned char * r_sourcemax
Definition: r_surf.c:37
ycenter
float ycenter
Definition: r_local.h:538
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:736
SURF_DRAWSKYBOX
#define SURF_DRAWSKYBOX
Definition: r_model.h:72
dsprite_t::frames
dsprframe_t frames[1]
Definition: qfiles.h:185
RecursiveLightPoint
int RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
Definition: r_light.c:120
d_vrectright_particle
int d_vrectright_particle
Definition: r_misc.c:38
it_skin
@ it_skin
Definition: r_local.h:58
AMP2
#define AMP2
Definition: r_local.h:232
r_dowarp
qboolean r_dowarp
Definition: r_main.c:54
surf_s::key
int key
Definition: r_local.h:404
blanktable
int blanktable[1280]
Definition: r_rast.c:49
d_pzbuffer
short * d_pzbuffer
Definition: r_main.c:182
pcx_t::bits_per_pixel
char bits_per_pixel
Definition: qfiles.h:65
r_dowarp
qboolean r_dowarp
Definition: r_main.c:54
dsprframe_t::width
int width
Definition: qfiles.h:176
particle_t::origin
vec3_t origin
Definition: ref.h:98
name
cvar_t * name
Definition: cl_main.c:94
REF_VERSION
#define REF_VERSION
Definition: r_local.h:31
cacheoffset
unsigned int cacheoffset
Definition: r_rast.c:32
r_v1
float r_v1
Definition: r_rast.c:62
WARP_HEIGHT
#define WARP_HEIGHT
Definition: r_local.h:175
SHELL_GREEN_COLOR
#define SHELL_GREEN_COLOR
Definition: ref.h:33
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:735
R_PolysetDrawSpansConstant8_66
void R_PolysetDrawSpansConstant8_66(spanpackage_t *pspanpackage)
Definition: r_polyse.c:993
msurface_s::flags
int flags
Definition: r_model.h:101
mod_sprite
@ mod_sprite
Definition: r_model.h:169
R_GenerateSpans
void R_GenerateSpans(void)
Definition: r_edge.c:564
affinetridesc_t::skinwidth
int skinwidth
Definition: r_local.h:307
MAX_LBM_HEIGHT
#define MAX_LBM_HEIGHT
Definition: r_local.h:177
spanpackage_t
Definition: r_polyse.c:39
pcx_t::xmin
unsigned short xmin
Definition: qfiles.h:66
swstate_s::prev_mode
int prev_mode
Definition: r_local.h:820
surf_s::d_zistepv
float d_zistepv
Definition: r_local.h:415
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:157
surf_s::d_zistepu
float d_zistepu
Definition: r_local.h:415
SHELL_RG_COLOR
#define SHELL_RG_COLOR
Definition: ref.h:36
r_amodels_drawn
int r_amodels_drawn
Definition: r_alias.c:34
swstate_s::gammatable
byte gammatable[256]
Definition: r_local.h:822
rw_time1
float rw_time1
Definition: r_local.h:724
y
GLint y
Definition: qgl_win.c:115
surfscale
float surfscale
Definition: r_surf.c:54
a_spans
spanpackage_t * a_spans
Definition: r_polyse.c:91
sw_mode
cvar_t * sw_mode
Definition: r_main.c:119
D_DrawTurbulent8Span
void D_DrawTurbulent8Span(void)
Definition: r_scan.c:102
r_pedge
medge_t * r_pedge
Definition: r_rast.c:41
d_pix_min
int d_pix_min
Definition: r_misc.c:40
R_IMFlatShadedQuad
void R_IMFlatShadedQuad(vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, float alpha)
Definition: r_poly.c:1230
span_p
espan_t * span_p
Definition: r_edge.c:60
RDF_UNDERWATER
#define RDF_UNDERWATER
Definition: q_shared.h:645
r_polydesc
polydesc_t r_polydesc
Definition: r_poly.c:43
aliastriangleparms_t::a
finalvert_t * a
Definition: r_local.h:712
entity_s::frame
int frame
Definition: ref.h:58
R_AliasSetUpTransform
void R_AliasSetUpTransform(void)
Definition: r_alias.c:352
r_rightclipped
qboolean r_rightclipped
Definition: r_rast.c:43
d_initial_rover
surfcache_t * d_initial_rover
Definition: r_misc.c:29
Draw_BuildGammaTable
void Draw_BuildGammaTable(void)
Definition: r_main.c:1217
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
oldrefdef_t::aliasvrectright
int aliasvrectright
Definition: r_local.h:116
R_EdgeCodeStart
void R_EdgeCodeStart(void)
vec_t
float vec_t
Definition: q_shared.h:126
msurface_s::cachespots
struct surfcache_s * cachespots[MIPLEVELS]
Definition: r_model.h:107
model_s::skins
image_t * skins[MAX_MD2SKINS]
Definition: r_model.h:234
surf_s::d_ziorigin
float d_ziorigin
Definition: r_local.h:415
WINDOW_STYLE
#define WINDOW_STYLE
Definition: winquake.h:28
R_AliasSetupFrames
void R_AliasSetupFrames(dmdl_t *pmdl)
Definition: r_alias.c:964
refdef_t::lightstyles
lightstyle_t * lightstyles
Definition: ref.h:132
d_roverwrapped
qboolean d_roverwrapped
Definition: r_misc.c:30
R_Alias_clip_top
void R_Alias_clip_top(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
Definition: r_aclip.c:123
SHELL_RB_COLOR
#define SHELL_RB_COLOR
Definition: ref.h:38
sw_stipplealpha
cvar_t * sw_stipplealpha
Definition: r_main.c:122
oldrefdef_t::vrect
vrect_t vrect
Definition: r_local.h:112
R_InitTurb
void R_InitTurb(void)
Definition: r_main.c:231
R_StepActiveU
void R_StepActiveU(edge_t *pedge)
Definition: r_edge.c:216
refdef_t::particles
particle_t * particles
Definition: ref.h:141
removeedges
edge_t * removeedges[MAXHEIGHT]
Definition: r_edge.c:58
sc_base
surfcache_t * sc_base
Definition: r_local.h:753
r_warpbuffer
byte r_warpbuffer[WARP_WIDTH *WARP_HEIGHT]
Definition: r_main.c:41
fixed16_t
int fixed16_t
Definition: q_shared.h:132
drawsurf_t::surf
msurface_t * surf
Definition: r_local.h:322
MAX_MAP_VERTS
#define MAX_MAP_VERTS
Definition: qfiles.h:240
r_lzi1
float r_lzi1
Definition: r_rast.c:62
d_8to24table
unsigned d_8to24table[256]
Definition: r_main.c:27
ALIAS_LEFT_CLIP
#define ALIAS_LEFT_CLIP
Definition: r_local.h:203
d_vrectbottom_particle
int d_vrectbottom_particle
Definition: r_local.h:496
R_AliasCheckBBox
qboolean R_AliasCheckBBox(void)
Definition: r_alias.c:178
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
sw_allow_modex
cvar_t * sw_allow_modex
Definition: r_main.c:113
vrect_s::width
int width
Definition: vid.h:24
model_s::name
char name[MAX_QPATH]
Definition: r_model.h:173
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:36
MAXSPANS
#define MAXSPANS
Definition: r_local.h:200
model_s::numtexinfo
int numtexinfo
Definition: r_model.h:217
current_iv
int current_iv
Definition: r_edge.c:64
R_AliasSetUpLerpData
void R_AliasSetUpLerpData(dmdl_t *pmdl, float backlerp)
Definition: r_alias.c:994
SHELL_WHITE_COLOR
#define SHELL_WHITE_COLOR
Definition: ref.h:47
world
#define world
Definition: g_local.h:550
up
static vec3_t up
Definition: p_view.c:29
dsprite_t::numframes
int numframes
Definition: qfiles.h:184
edge_s::prev
struct edge_s * prev
Definition: r_local.h:425
finalvert_s::s
int s
Definition: r_local.h:282
R_SetUpFrustumIndexes
void R_SetUpFrustumIndexes(void)
Definition: r_misc.c:295
D_SolidSurf
void D_SolidSurf(surf_t *s)
Definition: r_edge.c:975
ALIAS_TOP_CLIP
#define ALIAS_TOP_CLIP
Definition: r_local.h:204
rserr_ok
@ rserr_ok
Definition: r_local.h:99
R_RenderFace
void R_RenderFace(msurface_t *fa, int clipflags)
Definition: r_rast.c:525
R_BuildLightMap
void R_BuildLightMap(void)
Definition: r_light.c:384
r_lightlevel
cvar_t * r_lightlevel
Definition: r_main.c:134
u2
GLdouble GLdouble u2
Definition: qgl_win.c:225
level
GLint level
Definition: qgl_win.c:116
dlight_t
Definition: ref.h:84
d_scalemip
float d_scalemip[NUM_MIPS-1]
Definition: r_misc.c:32
dsprframe_t::origin_y
int origin_y
Definition: qfiles.h:177
SWimp_Init
int SWimp_Init(void *hInstance, void *wndProc)
Definition: rw_imp.c:118
bedge_s::v
mvertex_t * v[2]
Definition: r_local.h:343
d_vrectx
int d_vrectx
Definition: r_misc.c:38
surf_s::insubmodel
qboolean insubmodel
Definition: r_local.h:414
polydesc_t::vup
vec3_t vup
Definition: r_local.h:389
view_clipplanes
clipplane_t view_clipplanes[4]
Definition: r_rast.c:38
swstate_s::fullscreen
qboolean fullscreen
Definition: r_local.h:819
drawsurf_t::lightadj
fixed8_t lightadj[MAXLIGHTMAPS]
Definition: r_local.h:323
surfcache_s::data
byte data[4]
Definition: r_local.h:371
MAX_BMODEL_EDGES
#define MAX_BMODEL_EDGES
Definition: r_bsp.c:41
R_ConcatRotations
void R_ConcatRotations(float in1[3][3], float in2[3][3], float out[3][3])
Definition: q_shared.c:191
NUMSTACKSURFACES
#define NUMSTACKSURFACES
Definition: r_local.h:198
R_RenderBmodelFace
void R_RenderBmodelFace(bedge_t *pedges, msurface_t *psurf)
Definition: r_rast.c:738
model_s::firstmodelsurface
int firstmodelsurface
Definition: r_model.h:196
R_AliasPreparePoints
void R_AliasPreparePoints(void)
Definition: r_alias.c:238
finalvert_s::flags
int flags
Definition: r_local.h:285
newedges
edge_t * newedges[MAXHEIGHT]
Definition: r_edge.c:57
model_s::surfaces
msurface_t * surfaces
Definition: r_model.h:221
swwstate_t::wndproc
void * wndproc
Definition: rw_win.h:29
Com_PageInMemory
void Com_PageInMemory(byte *buffer, int size)
Definition: q_shared.c:1161
medge_t::v
unsigned short v[2]
Definition: r_model.h:79
CVAR_USERINFO
#define CVAR_USERINFO
Definition: q_shared.h:310
r_lefthand
cvar_t * r_lefthand
Definition: r_main.c:111
db_time1
float db_time1
Definition: r_local.h:724
world_transformed_modelorg
vec3_t world_transformed_modelorg
Definition: r_edge.c:744
vec5_t
vec_t vec5_t[5]
Definition: q_shared.h:128
r_drawworld
cvar_t * r_drawworld
Definition: r_main.c:126
r_nearzi
float r_nearzi
Definition: r_rast.c:61
VectorMA
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
Definition: q_shared.c:719
mod_alias
@ mod_alias
Definition: r_model.h:169
d_zwidth
unsigned int d_zwidth
Definition: r_local.h:502
SURF_DRAWBACKGROUND
#define SURF_DRAWBACKGROUND
Definition: r_model.h:71
d_vrectright_particle
int d_vrectright_particle
Definition: r_local.h:496
sw_waterwarp
cvar_t * sw_waterwarp
Definition: r_main.c:124
pcx_t::manufacturer
char manufacturer
Definition: qfiles.h:62
NEAR_CLIP
#define NEAR_CLIP
Definition: asm_draw.h:13
MAX_SKINNAME
#define MAX_SKINNAME
Definition: qfiles.h:93
r_dlightframecount
int r_dlightframecount
Definition: r_light.c:24
r_lastvertvalid
qboolean r_lastvertvalid
Definition: r_rast.c:65
r_leftenter
mvertex_t r_leftenter
Definition: r_rast.c:51
particle_t::color
int color
Definition: ref.h:99
partparms
static partparms_t partparms
Definition: r_part.c:35
aliastriangleparms_t::c
finalvert_t * c
Definition: r_local.h:712
R_ImageList_f
void R_ImageList_f(void)
Definition: r_image.c:34
msurface_s
Definition: r_model.h:93
oldrefdef_t::vrectright
int vrectright
Definition: r_local.h:115
d_vrecty
int d_vrecty
Definition: r_local.h:496
aliastriangleparms
aliastriangleparms_t aliastriangleparms
Definition: r_polyse.c:59
max_span_p
espan_t * max_span_p
Definition: r_edge.c:60
sw_aliasstats
cvar_t * sw_aliasstats
Definition: r_main.c:112
swwstate_t::hdcDIBSection
HDC hdcDIBSection
Definition: rw_win.h:33
dmdl_t::ofs_skins
int ofs_skins
Definition: qfiles.h:153
d_sdivzstepu
float d_sdivzstepu
Definition: r_main.c:173
R_TransformFrustum
void R_TransformFrustum(void)
Definition: r_misc.c:187
blockdivmask
unsigned blockdivmask
Definition: r_surf.c:29
mplane_s
Definition: r_model.h:57
pcx_t::vres
unsigned short vres
Definition: qfiles.h:67
sw_mipscale
cvar_t * sw_mipscale
Definition: r_misc.c:27
dsprframe_t
Definition: qfiles.h:174
mtexinfo_s::flags
int flags
Definition: r_model.h:88
R_TransformFrustum
void R_TransformFrustum(void)
Definition: r_misc.c:187
db_time2
float db_time2
Definition: r_local.h:724
R_EdgeCodeEnd
void R_EdgeCodeEnd(void)
oldrefdef_t::vrect_x_adj_shift20
int vrect_x_adj_shift20
Definition: r_local.h:121
sw_maxsurfs
cvar_t * sw_maxsurfs
Definition: r_main.c:118
refdef_t::dlights
dlight_t * dlights
Definition: ref.h:138
d_minmip
int d_minmip
Definition: r_misc.c:31
surfcache_s::dlight
int dlight
Definition: r_local.h:365
r_turb_sstep
fixed16_t r_turb_sstep
Definition: r_scan.c:27
refdef_t::width
int width
Definition: ref.h:122
R_AliasSetupLighting
void R_AliasSetupLighting(void)
Definition: r_alias.c:874
DWORD
DWORD
Definition: qgl_win.c:49
DPS_MAXSPANS
#define DPS_MAXSPANS
Definition: r_polyse.c:35
msurface_s::texturemins
short texturemins[2]
Definition: r_model.h:109
ri
refimport_t ri
Definition: r_main.c:25
BlendParticle100
static byte BlendParticle100(int pcolor, int dstcolor)
Definition: r_part.c:448
R_DrawParticle
void R_DrawParticle(void)
Definition: r_part.c:467
r_turb_pdest
unsigned char * r_turb_pdest
Definition: r_scan.c:26
R_PrintDSpeeds
void R_PrintDSpeeds(void)
Definition: r_misc.c:151
R_PolysetSetEdgeTable
void R_PolysetSetEdgeTable(void)
Definition: r_polyse.c:1483
clipplane_s::dist
float dist
Definition: r_local.h:352
R_DrawAlphaSurfaces
void R_DrawAlphaSurfaces(void)
Definition: r_poly.c:1192
Draw_FindPic
image_t * Draw_FindPic(char *name)
Definition: r_draw.c:35
RF_SHELL_BLUE
#define RF_SHELL_BLUE
Definition: q_shared.h:625
lightstyle_t::white
float white
Definition: ref.h:117
skintable
byte * skintable[MAX_LBM_HEIGHT]
Definition: r_polyse.c:113
R_ClipAndDrawPoly
void R_ClipAndDrawPoly(float alpha, qboolean isturbulent, qboolean textured)
s_ziscale
static float s_ziscale
Definition: r_alias.c:54
dsprframe_t::origin_x
int origin_x
Definition: qfiles.h:177
w
GLdouble GLdouble GLdouble w
Definition: qgl_win.c:291
r_skyplanes
mplane_t r_skyplanes[6]
Definition: r_rast.c:69
right
GLdouble right
Definition: qgl_win.c:159
registration_sequence
int registration_sequence
Definition: r_model.c:44
edge_head_u_shift20
int edge_head_u_shift20
Definition: r_edge.c:66
refimport_t::Cvar_SetValue
void(* Cvar_SetValue)(char *name, float value)
Definition: ref.h:244
image_s
Definition: r_local.h:65
r_aliasblendcolor
int r_aliasblendcolor
Definition: r_alias.c:43
sw_state
swstate_t sw_state
Definition: r_main.c:43
refdef_t::viewangles
float viewangles[3]
Definition: ref.h:125
d_sdivzstepv
float d_sdivzstepv
Definition: r_main.c:174
Sys_Milliseconds
int Sys_Milliseconds(void)
Definition: q_shwin.c:120
refdef_t::x
int x
Definition: ref.h:122
vrect_s
Definition: vid.h:22
r_entorigin
vec3_t r_entorigin
Definition: r_bsp.c:31
mode
GLenum mode
Definition: qgl_win.c:113
BlendParticle66
static byte BlendParticle66(int pcolor, int dstcolor)
Definition: r_part.c:443
sww_state
swwstate_t sww_state
Definition: rw_imp.c:38
sw_clearcolor
cvar_t * sw_clearcolor
Definition: r_main.c:114
Mod_Free
void Mod_Free(model_t *mod)
Definition: r_model.c:1239
R_MarkLeaves
void R_MarkLeaves(void)
Definition: r_main.c:432
YCENTERING
#define YCENTERING
Definition: r_local.h:216
swwstate_t::hWnd
HWND hWnd
Definition: rw_win.h:31
cacheblock
pixel_t * cacheblock
Definition: r_main.c:179
viddef_t::colormap
pixel_t * colormap
Definition: r_local.h:89
pcx_t::xmax
unsigned short xmax
Definition: qfiles.h:66
swwstate_t::hDC
HDC hDC
Definition: rw_win.h:30
mask
GLint GLuint mask
Definition: qgl_win.c:317
d_pzbuffer
short * d_pzbuffer
Definition: r_main.c:182
r_polyblendcolor
static int r_polyblendcolor
Definition: r_poly.c:39
SURFCACHE_SIZE_AT_320X240
#define SURFCACHE_SIZE_AT_320X240
Definition: r_local.h:210
r_worldentity
entity_t r_worldentity
Definition: r_main.c:29
sc_rover
surfcache_t * sc_rover
Definition: r_local.h:753
r_fullbright
cvar_t * r_fullbright
Definition: r_main.c:129
model_s::vertexes
mvertex_t * vertexes
Definition: r_model.h:208
tadjust
fixed16_t tadjust
Definition: r_local.h:485
r_ppn
vec3_t r_ppn
Definition: r_part.c:22
surfcache_s::next
struct surfcache_s * next
Definition: r_local.h:362
STRINGER
#define STRINGER(x)
Definition: r_main.c:143
polydesc_t::pixel_height
int pixel_height
Definition: r_local.h:388
swstate_s::currentpalette
byte currentpalette[1024]
Definition: r_local.h:823
r_outofsurfaces
int r_outofsurfaces
Definition: r_main.c:51
msurface_s::nextalphasurface
struct msurface_s * nextalphasurface
Definition: r_model.h:118
xcenter
float xcenter
Definition: r_main.c:75
Mod_Modellist_f
void Mod_Modellist_f(void)
Definition: r_model.c:55
viddef_t::alphamap
pixel_t * alphamap
Definition: r_local.h:90
r_drawsurf
drawsurf_t r_drawsurf
Definition: r_surf.c:24
R_BeginFrame
void R_BeginFrame(float camera_separation)
Definition: r_main.c:1099
sw_state
swstate_t sw_state
Definition: r_main.c:43
vpn
vec3_t vpn
Definition: r_main.c:67
r_source
unsigned char * r_source
Definition: r_surf.c:37
rserr_invalid_fullscreen
@ rserr_invalid_fullscreen
Definition: r_local.h:101
loadmodel
model_t * loadmodel
Definition: r_model.c:27
r_p2
int r_p2[6]
Definition: r_polyse.c:61
aliastriangleparms
aliastriangleparms_t aliastriangleparms
Definition: r_polyse.c:59
entity_s::oldorigin
float oldorigin[3]
Definition: ref.h:63
dlight_t::intensity
float intensity
Definition: ref.h:93
TRANSPARENT_COLOR
#define TRANSPARENT_COLOR
Definition: asm_i386.h:78
oldrefdef_t::aliasvrect
vrect_t aliasvrect
Definition: r_local.h:114
BBOX_TRIVIAL_REJECT
#define BBOX_TRIVIAL_REJECT
Definition: r_alias.c:83
R_SetupFrame
void R_SetupFrame(void)
Definition: r_misc.c:426
drawsurf_t::surfwidth
int surfwidth
Definition: r_local.h:327
d_scantable
int d_scantable[MAXHEIGHT]
Definition: r_misc.c:42
box_edges
int box_edges[24]
Definition: r_rast.c:80
r_turb_spancount
int r_turb_spancount
Definition: r_scan.c:29
TransformVector
void TransformVector(vec3_t in, vec3_t out)
Definition: r_misc.c:215
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
draw_chars
image_t * draw_chars
Definition: r_draw.c:26
HRESULT
HRESULT(WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1236
surf_s
Definition: r_local.h:399
r_pcurrentvertbase
mvertex_t * r_pcurrentvertbase
Definition: r_main.c:56
surfaces
surf_t * surfaces
Definition: r_edge.c:51
r_outofedges
int r_outofedges
Definition: r_main.c:52
finalvert_s::l
int l
Definition: r_local.h:283
yscale
float yscale
Definition: r_local.h:539
dmdl_t
Definition: qfiles.h:137
entity_s::angles
float angles[3]
Definition: ref.h:52
PARTICLE_33
#define PARTICLE_33
Definition: r_part.c:24
LoadPCX
void LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height)
Definition: r_image.c:87
swwstate_t::lpddsBackBuffer
LPDIRECTDRAWSURFACE lpddsBackBuffer
Definition: rw_win.h:45
r_fullbright
cvar_t * r_fullbright
Definition: r_main.c:129
r_refdef
oldrefdef_t r_refdef
Definition: r_main.c:74
void
void(APIENTRY *qglAccum)(GLenum op
oldrefdef_t::vrectbottom
int vrectbottom
Definition: r_local.h:115
RotatePointAroundVector
void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees)
Definition: q_shared.c:32
count
GLint GLsizei count
Definition: qgl_win.c:128
dmdl_t::num_frames
int num_frames
Definition: qfiles.h:151
polydesc_t::vright
vec3_t vright
Definition: r_local.h:389
view_clipplanes
clipplane_t view_clipplanes[4]
Definition: r_rast.c:38
msurface_s::firstedge
int firstedge
Definition: r_model.h:103
dp_time2
float dp_time2
Definition: r_local.h:724
SURF_SKY
#define SURF_SKY
Definition: qfiles.h:371
sc_size
int sc_size
Definition: r_surf.c:57
da_time2
float da_time2
Definition: r_main.c:106
edge_s
Definition: r_local.h:421
surf_s::spanstate
int spanstate
Definition: r_local.h:406
pcx_t::bytes_per_line
unsigned short bytes_per_line
Definition: qfiles.h:71
model_s::extradatasize
int extradatasize
Definition: r_model.h:236
s_pmdl
dmdl_t * s_pmdl
Definition: r_alias.c:48
affinetridesc_t::pskin
void * pskin
Definition: r_local.h:305
model_s::numsurfaces
int numsurfaces
Definition: r_model.h:220
vrect_s::y
int y
Definition: vid.h:24
skybox_planes
int skybox_planes[12]
Definition: r_rast.c:76
ALIAS_RIGHT_CLIP
#define ALIAS_RIGHT_CLIP
Definition: r_local.h:205
it_sky
@ it_sky
Definition: r_local.h:62
vid
viddef_t vid
Definition: r_main.c:24