29cvar_t r_lockpvs = {
CF_CLIENT,
"r_lockpvs",
"0",
"disables pvs switching, allows you to walk around and inspect what is visible from a given location in the map (anything not visible from your current location will not be drawn)"};
30cvar_t r_lockvisibility = {
CF_CLIENT,
"r_lockvisibility",
"0",
"disables visibility updates, allows you to walk around and inspect what is visible from a given viewpoint in the map (anything offscreen at the moment this is enabled will not be drawn)"};
31cvar_t r_useportalculling = {
CF_CLIENT,
"r_useportalculling",
"1",
"improve framerate with r_novis 1 by using portal culling - still not as good as compiled visibility data in the map, but it helps (a value of 2 forces use of this even with vis data, which improves framerates in maps without too much complexity, but hurts in extremely complex maps, which is why 2 is not the default mode)"};
41cvar_t r_q3bsp_renderskydepth = {
CF_CLIENT,
"r_q3bsp_renderskydepth",
"0",
"draws sky depth masking in q3 maps (as in q1 maps), this means for example that sky polygons can hide other things"};
52 int smax, tmax,
i,
size, size3, maps, l;
54 unsigned char *lightmap, *out, *stain;
57 unsigned char *templight;
81 model->brushq1.lightmapupdateflags[surface -
model->data_surfaces] =
false;
87 if (!
model->brushq1.lightdata)
89 for (
i = 0;
i < size3;
i++)
95 memset(bl, 0, size3*
sizeof(*bl));
113 for (
i = 0;
i <
size;
i++, bl += 3, stain += 3, out += 4)
115 l = (bl[0] * stain[0]) >> 16;out[2] =
min(l, 255);
116 l = (bl[1] * stain[1]) >> 16;out[1] =
min(l, 255);
117 l = (bl[2] * stain[2]) >> 16;out[0] =
min(l, 255);
123 for (
i = 0;
i <
size;
i++, bl += 3, out += 4)
125 l = bl[0] >> 8;out[2] =
min(l, 255);
126 l = bl[1] >> 8;out[1] =
min(l, 255);
127 l = bl[2] >> 8;out[0] =
min(l, 255);
144 memset(bl, 0, size3*
sizeof(*bl));
146 if (lightmap && normalmap)
154 bl[
i*3+0] += ((
int)normalmap[
i*3+0] - 128) * l;
155 bl[
i*3+1] += ((
int)normalmap[
i*3+1] - 128) * l;
156 bl[
i*3+2] += ((
int)normalmap[
i*3+2] - 128) * l;
163 for (
i = 0;
i <
size;
i++, bl += 3, out += 4)
167 l = (
int)(
n[0] * 128 + 128);out[2] =
bound(0, l, 255);
168 l = (
int)(
n[1] * 128 + 128);out[1] =
bound(0, l, 255);
169 l = (
int)(
n[2] * 128 + 128);out[0] =
bound(0, l, 255);
178 float ndist,
a, ratio, maxdist, maxdist2, maxdist3, invradius, sdtable[256], td, dist2;
180 int i, s, t, smax, tmax, smax3, impacts, impactt, stained;
184 maxdist = radius * radius;
185 invradius = 1.0f / radius;
202 dist2 = ndist * ndist;
203 maxdist3 = maxdist - dist2;
227 s =
bound(0, impacts, smax * 16) - impacts;
228 t =
bound(0, impactt, tmax * 16) - impactt;
229 i = (
int)(s * s + t * t + dist2);
230 if ((
i > maxdist) || (smax > (
int)(
sizeof(sdtable)/
sizeof(sdtable[0]))))
234 for (s = 0,
i = impacts; s < smax; s++,
i -= 16)
235 sdtable[s] =
i *
i + dist2;
242 for (t = 0;t < tmax;t++,
i -= 16)
248 maxdist2 = maxdist - td;
249 for (s = 0;s < smax;s++)
251 if (sdtable[s] < maxdist2)
254 a = (fcolor[3] + ratio * fcolor[7]) * (1.0f -
sqrt(sdtable[s] + td) * invradius);
255 if (
a >= (1.0f / 64.0f))
259 bl[0] = (
unsigned char) ((
float) bl[0] +
a * ((fcolor[0] + ratio * fcolor[4]) - (
float) bl[0]));
260 bl[1] = (
unsigned char) ((
float) bl[1] +
a * ((fcolor[1] + ratio * fcolor[5]) - (
float) bl[1]));
261 bl[2] = (
unsigned char) ((
float) bl[2] +
a * ((fcolor[2] + ratio * fcolor[6]) - (
float) bl[2]));
273 model->brushq1.lightmapupdateflags[surface -
model->data_surfaces] =
true;
298void R_Stain (
const vec3_t origin,
float radius,
int cr1,
int cg1,
int cb1,
int ca1,
int cr2,
int cg2,
int cb2,
int ca2)
310 fcolor[3] = ca1 * (1.0f / 64.0f);
311 fcolor[4] = cr2 - cr1;
312 fcolor[5] = cg2 - cg1;
313 fcolor[6] = cb2 - cb1;
314 fcolor[7] = (ca2 - ca1) * (1.0f / 64.0f);
325 if (
model->brush.data_nodes)
368 i = surfacelist[0] >> 1;
372 isvis ? 0.125f : 0.03125f);
373 for (
i = 0,
v = vertex3f;
i < numpoints;
i++,
v += 3)
389 for (leafnum = 0;leafnum <
model->brush.num_leafs;leafnum++)
394 for (portal =
model->brush.data_leafs[leafnum].portals;portal;portal = portal->
next)
414 unsigned char *surfacevisible;
423 surfaces =
model->data_surfaces;
425 for (surfaceindex =
model->submodelsurfaces_start; surfaceindex < model->submodelsurfaces_end; surfaceindex++)
427 if (surfacevisible[surfaceindex])
431 surfacevisible[surfaceindex] = 0;
459 for (j = 0, leaf =
model->brush.data_leafs;j < model->brush.num_leafs;j++, leaf++)
488 for (j = 0, leaf =
model->brush.data_leafs;j < model->brush.num_leafs;j++, leaf++)
511 for (j = 0, leaf =
model->brush.data_leafs;j < model->brush.num_leafs;j++, leaf++)
533 vec3_t cullmins, cullmaxs;
542 leafstack[0] = viewleaf;
546 leaf = leafstack[--leafstackpos];
569 cullmins[0] = p->
mins[0] - cullbias;
570 cullmins[1] = p->
mins[1] - cullbias;
571 cullmins[2] = p->
mins[2] - cullbias;
572 cullmaxs[0] = p->
maxs[0] + cullbias;
573 cullmaxs[1] = p->
maxs[1] + cullbias;
574 cullmaxs[2] = p->
maxs[2] + cullbias;
584 if (leafstackpos >= (
int)(
sizeof(leafstack) /
sizeof(leafstack[0])))
586 leafstack[leafstackpos++] = p->
past;
613 surfaces =
model->data_surfaces;
621 if (surfaces[
i].
texture->basematerialflags & flagsmask)
631 if (surfaces[
i].
texture->basematerialflags & flagsmask)
675typedef struct r_q1bsp_getlightinfo_s
704#define GETLIGHTINFO_MAXNODESTACK 4096
710 int nodestackpos = 0;
720 int leafsurfaceindex;
722 int triangleindex, t;
723 int currentmaterialflags;
733 const int *leafsurfaceindices;
737 static float points[128][3];
744 node = nodestack[--nodestackpos];
763 nodestack[nodestackpos++] = node->
children[0];
765 nodestack[nodestackpos++] = node->
children[1];
772 nodestack[nodestackpos++] = node->
children[0];
773 nodestack[nodestackpos++] = node->
children[1];
778 nodestack[nodestackpos++] = node->
children[1];
779 nodestack[nodestackpos++] = node->
children[0];
792 nodestack[nodestackpos++] = node->
children[0];
795 nodestack[nodestackpos++] = node->
children[1];
802 nodestack[nodestackpos++] = node->
children[0];
803 nodestack[nodestackpos++] = node->
children[1];
808 nodestack[nodestackpos++] = node->
children[1];
809 nodestack[nodestackpos++] = node->
children[0];
837 for (portal = leaf->
portals;portal;portal = portal->
next)
874 if (svbspinsertoccluder)
876 for (leafsurfaceindex = 0;leafsurfaceindex < numleafsurfaces;leafsurfaceindex++)
878 surfaceindex = leafsurfaceindices[leafsurfaceindex];
882 surface = surfaces + surfaceindex;
905 for (leafsurfaceindex = 0;leafsurfaceindex < numleafsurfaces;leafsurfaceindex++)
907 surfaceindex = leafsurfaceindices[leafsurfaceindex];
908 surface = surfaces + surfaceindex;
945 else if (frontsidecasting)
979 int currentmaterialflags;
988 int nodestackpos = 0;
992 nodestack[nodestackpos++] = bih->
rootnode;
997 nodenum = nodestack[--nodestackpos];
999 node = bih->
nodes + nodenum;
1048 else if (frontsidecasting)
1085 nodestack[nodestackpos++] = node->
front;
1086 nodestack[nodestackpos++] = node->
back;
1091 nodestack[nodestackpos++] = node->
front;
1202void R_Mod_GetLightInfo(
entity_render_t *ent,
vec3_t relativelightorigin,
float lightradius,
vec3_t outmins,
vec3_t outmaxs,
int *outleaflist,
unsigned char *outleafpvs,
int *outnumleafspointer,
int *outsurfacelist,
unsigned char *outsurfacepvs,
int *outnumsurfacespointer,
unsigned char *outshadowtrispvs,
unsigned char *outlighttrispvs,
unsigned char *visitingleafpvs,
int numfrustumplanes,
const mplane_t *frustumplanes,
qbool noocclusion)
1219 *outnumleafspointer = 0;
1220 *outnumsurfacespointer = 0;
1251 Portal_Visibility(info.
model, info.
relativelightorigin, info.
outleaflist, info.
outleafpvs, &info.
outnumleafs, info.
outsurfacelist, info.
outsurfacepvs, &info.
outnumsurfaces,
NULL, 0,
true, info.
lightmins, info.
lightmaxs, info.
outmins, info.
outmaxs, info.
outshadowtrispvs, info.
outlighttrispvs, info.
visitingleafpvs);
1256 Portal_Visibility(info.
model, info.
relativelightorigin, info.
outleaflist, info.
outleafpvs, &info.
outnumleafs, info.
outsurfacelist, info.
outsurfacepvs, &info.
outnumsurfaces,
NULL, 0,
r_shadow_realtime_dlight_portalculling.
integer >= 2, info.
lightmins, info.
lightmaxs, info.
outmins, info.
outmaxs, info.
outshadowtrispvs, info.
outlighttrispvs, info.
visitingleafpvs);
1290 int surfacelistindex;
1291 int sidetotals[6] = { 0, 0, 0, 0, 0, 0 }, sidemasks = 0;
1303 for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
1305 surface =
model->data_surfaces + surfacelist[surfacelistindex];
1306 sidemasks |=
R_Shadow_ChooseSidesFromBox(surface->
num_firsttriangle, surface->
num_triangles,
model->surfmesh.data_vertex3f,
model->surfmesh.data_element3i, &
r_shadow_compilingrtlight->
matrix_worldtolight, relativelightorigin, relativelightdirection,
r_shadow_compilingrtlight->
cullmins,
r_shadow_compilingrtlight->
cullmaxs, surface->
mins, surface->
maxs, surface->
texture->
basematerialflags &
MATERIALFLAG_NOSHADOW ?
NULL : sidetotals);
1316#define RSURF_MAX_BATCHSURFACES 8192
1324 int modelsurfacelistindex, batchnumsurfaces;
1330 for (modelsurfacelistindex = 0;modelsurfacelistindex < modelnumsurfaces;modelsurfacelistindex++)
1332 surface =
model->data_surfaces + modelsurfacelist[modelsurfacelistindex];
1333 if (surfacesides && !(surfacesides[modelsurfacelistindex] & (1 << side)))
1343 batchnumsurfaces = 1;
1346 surface =
model->data_surfaces + modelsurfacelist[modelsurfacelistindex];
1347 if (surfacesides && !(surfacesides[modelsurfacelistindex] & (1 << side)))
1357 --modelsurfacelistindex;
1366#define BATCHSIZE 1024
1370 int i, j, endsurface;
1379 for (
i = 0;
i < numsurfaces;
i = j)
1386 for (j =
i;j < endsurface;j++)
1403 int i, k, kend, l, endsurface, batchnumsurfaces, texturenumsurfaces;
1412 for (
i = 0;
i < numsurfaces;)
1414 batchnumsurfaces = 0;
1418 for (;
i < endsurface;
i++)
1424 for (;
i < endsurface;
i++)
1427 if (!batchnumsurfaces)
1429 for (k = 0;k < batchnumsurfaces;k = kend)
1445 vec3_t tempcenter, center;
1446 for (l = k;l < kend;l++)
1457 tempcenter[0] = (surface->
mins[0] + surface->
maxs[0]) * 0.5f;
1458 tempcenter[1] = (surface->
mins[1] + surface->
maxs[1]) * 0.5f;
1459 tempcenter[2] = (surface->
mins[2] + surface->
maxs[2]) * 0.5f;
1474 texturenumsurfaces = kend - k;
1488 const char *
r, *newt;
1499 Con_Print(
"r_replacemaptexture <texname> <newtexname> - replaces texture\n");
1500 Con_Print(
"r_replacemaptexture <texname> - switch back to default texture\n");
1505 Con_Print(
"This command works only in singleplayer\n");
1546 if (t->
name[0] && strcasecmp(t->
name,
"NO TEXTURE FOUND"))
1551static void gl_surf_start(
void)
1555static void gl_surf_shutdown(
void)
1559static void gl_surf_newmap(
void)
#define BIH_MAXUNORDEREDCHILDREN
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
#define CF_CLIENT
cvar/command that only the client can change/execute
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
int matchpattern(const char *in, const char *pattern, int caseinsensitive)
static int(ZEXPORT *qz_inflate)(z_stream *strm
void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
void GL_CullFace(int state)
void GL_ColorMask(int r, int g, int b, int a)
unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void GL_DepthMask(int state)
int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtriangles, const int *element3i, const r_meshbuffer_t *element3i_indexbuffer, int element3i_bufferoffset, const unsigned short *element3s, const r_meshbuffer_t *element3s_indexbuffer, int element3s_bufferoffset)
void GL_DepthTest(int state)
void GL_DepthRange(float nearfrac, float farfrac)
void GL_PolygonOffset(float planeoffset, float depthoffset)
void GL_Color(float cr, float cg, float cb, float ca)
void GL_BlendFunc(int blendfunc1, int blendfunc2)
void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3f, const float *color4f, const float *texcoord2f)
void R_EntityMatrix(const matrix4x4_t *matrix)
#define POLYGONELEMENTS_MAXPOINTS
void R_FrameData_SetMark(void)
set a marker that allows you to discard the following temporary memory allocations
void R_SetupShader_Generic_NoTexture(qbool usegamma, qbool notrippy)
qbool R_CanSeeBox(int numsamples, vec_t eyejitter, vec_t entboxenlarge, vec_t entboxexpand, vec_t pad, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs)
void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const msurface_t **texturesurfacelist)
void R_FrameData_ReturnToMark(void)
discard recent memory allocations (rewind to marker)
void RSurf_DrawBatch(void)
skinframe_t * R_SkinFrame_LoadExternal(const char *name, int textureflags, qbool complain, qbool fallbacknotexture)
r_framebufferstate_t r_fb
void * R_FrameData_Alloc(size_t size)
allocate some temporary memory for your purposes
void R_Water_AddWaterPlane(msurface_t *surface, int entno)
mempool_t * r_main_mempool
rtexture_t * r_texture_blanknormalmap
cvar_t r_transparent_sortsurfacesbynearest
texture_t * R_GetCurrentTexture(texture_t *t)
svbsp_t r_svbsp
shadow volume bsp struct with automatically growing nodes buffer
qbool R_CullBox(const vec3_t mins, const vec3_t maxs, int numplanes, const mplane_t *planes)
void R_DrawModelSurfaces(entity_render_t *ent, qbool skysurfaces, qbool writedepth, qbool depthonly, qbool debug, qbool prepass, qbool ui)
void RSurf_ActiveModelEntity(const entity_render_t *ent, qbool wantnormals, qbool wanttangents, qbool prepass)
qbool R_CullFrustum(const vec3_t mins, const vec3_t maxs)
cvar_t r_q1bsp_lightmap_updates_combine
cvar_t r_vis_trace_eyejitter
static msurface_t * r_q1bsp_getlightinfo_surfaces
#define RSURF_MAX_BATCHSURFACES
void R_Mod_DrawSky(entity_render_t *ent)
void R_Mod_CompileShadowMap(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist)
cvar_t r_usesurfaceculling
static int R_Q1BSP_GetLightInfo_comparefunc(const void *ap, const void *bp)
cvar_t r_shadow_sortsurfaces
qbool r_shadow_usingdeferredprepass
cvar_t r_vis_trace_surfaces
void R_Mod_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs, unsigned char *visitingleafpvs, int numfrustumplanes, const mplane_t *frustumplanes, qbool noocclusion)
cvar_t r_useportalculling
void R_Mod_DrawDebug(entity_render_t *ent)
static void R_Q1BSP_DrawLight_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
static void R_DrawPortal_Callback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
void R_Mod_DrawLight(entity_render_t *ent, int numsurfaces, const int *surfacelist, const unsigned char *lighttrispvs)
void R_Mod_Draw(entity_render_t *ent)
void R_BuildLightMap(const entity_render_t *ent, msurface_t *surface, int combine)
static const msurface_t * batchsurfacelist[RSURF_MAX_BATCHSURFACES]
void R_View_WorldVisibility(qbool forcenovis)
cvar_t r_vis_trace_enlarge
cvar_t r_vis_trace_samples
void R_Mod_DrawShadowMap(int side, entity_render_t *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const unsigned char *surfacesides, const vec3_t lightmins, const vec3_t lightmaxs)
void R_Mod_DrawAddWaterPlanes(entity_render_t *ent)
void R_Mod_DrawDepth(entity_render_t *ent)
cvar_t r_vis_trace_expand
static void R_StainNode(mnode_t *node, model_t *model, const vec3_t origin, float radius, const float fcolor[8])
static void R_Q1BSP_RecursiveGetLightInfo_BSP(r_q1bsp_getlightinfo_t *info, qbool skipsurfaces)
#define GETLIGHTINFO_MAXNODESTACK
cvar_t r_q3bsp_renderskydepth
void R_Mod_DrawPrepass(entity_render_t *ent)
void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2)
static void R_ListWorldTextures_f(cmd_state_t *cmd)
static void R_ReplaceWorldTexture_f(cmd_state_t *cmd)
static void R_Q1BSP_CallRecursiveGetLightInfo(r_q1bsp_getlightinfo_t *info, qbool use_svbsp)
static void R_Q1BSP_RecursiveGetLightInfo_BIH(r_q1bsp_getlightinfo_t *info, const bih_t *bih)
static void R_View_WorldVisibility_CullSurfaces(void)
void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int z, int width, int height, int depth, int combine)
GLenum GLenum GLuint texture
GLfloat GLfloat GLfloat v2
#define GL_ONE_MINUS_SRC_ALPHA
void Image_MakesRGBColorsFromLinear_Lightmap(unsigned char *pout, const unsigned char *pin, int numpixels)
int BoxOnPlaneSide(const vec3_t emins, const vec3_t emaxs, const mplane_t *p)
#define PlaneDist(point, plane)
#define BoxesOverlap(a, b, c, d)
#define VectorNormalize(v)
#define BoxInsideBox(a, b, c, d)
#define bound(min, num, max)
#define lhrandom(MIN, MAX)
LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 whe...
#define PointInfrontOfTriangle(p, a, b, c)
#define PlaneDiff(point, plane)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
#define VectorAdd(a, b, out)
#define TriangleBBoxOverlapsBox(a, b, c, d, e)
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
const matrix4x4_t identitymatrix
void R_MeshQueue_AddTransparent(dptransparentsortcategory_t category, const vec3_t center, void(*callback)(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist), const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
#define MATERIALFLAG_REFRACTION
#define MATERIALFLAGMASK_DEPTHSORTED
#define CHECKPVSBIT(pvs, b)
#define MATERIALFLAG_WATERSHADER
#define MATERIALFLAG_CAMERA
#define MATERIALFLAG_NODEPTHTEST
#define MATERIALFLAG_WALL
#define MATERIALFLAG_NOSHADOW
#define MATERIALFLAG_REFLECTION
#define SETPVSBIT(pvs, b)
#define MATERIALFLAG_NOCULLFACE
#define MATERIALFLAG_NORTLIGHT
shadowmesh_t * Mod_ShadowMesh_Finish(shadowmesh_t *mesh, qbool createvbo)
shadowmesh_t * Mod_ShadowMesh_Begin(mempool_t *mempool, int maxverts, int maxtriangles)
void Portal_Visibility(model_t *model, const vec3_t eye, int *leaflist, unsigned char *leafpvs, int *numleafspointer, int *surfacelist, unsigned char *surfacepvs, int *numsurfacespointer, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs, unsigned char *shadowtrispvs, unsigned char *lighttrispvs, unsigned char *visitingleafpvs)
#define RENDER_WORLDOBJECT
#define RENDER_NOSELFSHADOW
#define MAX_EDICTS
max number of objects in game world at once (32768 protocol limit)
@ TRANSPARENTSORT_DISTANCE
void R_Shadow_RenderMode_Begin(void)
void R_Shadow_RenderMode_Lighting(qbool transparent, qbool shadowmapping, qbool noselfshadowpass)
cvar_t r_shadow_realtime_world_compileportalculling
void R_Shadow_SetupEntityLight(const entity_render_t *ent)
void R_Shadow_PrepareShadowSides(int numtris)
int R_Shadow_ChooseSidesFromBox(int firsttriangle, int numtris, const float *invertex3f, const int *elements, const matrix4x4_t *worldtolight, const vec3_t projectorigin, const vec3_t projectdirection, const vec3_t lightmins, const vec3_t lightmaxs, const vec3_t surfacemins, const vec3_t surfacemaxs, int *totals)
cvar_t r_shadow_usebihculling
cvar_t r_shadow_realtime_dlight_svbspculling
void R_Shadow_RenderLighting(int texturenumsurfaces, const msurface_t **texturesurfacelist)
cvar_t r_shadow_realtime_world_compilesvbsp
rtlight_t * r_shadow_compilingrtlight
unsigned char * shadowsides
cvar_t r_shadow_frontsidecasting
cvar_t r_shadow_realtime_dlight_portalculling
void R_Shadow_RenderMode_ActiveLight(const rtlight_t *rtlight)
void R_Shadow_RenderMode_End(void)
void R_Shadow_ShadowMapFromList(int numverts, int numtris, const float *vertex3f, const int *elements, int numsidetris, const int *sidetotals, const unsigned char *sides, const int *sidetris)
@ r_stat_lights_dynamicshadowtriangles
@ r_stat_lightmapupdatepixels
@ r_stat_lights_shadowtriangles
#define BATCHNEED_ALLOWMULTIDRAW
#define BATCHNEED_ARRAY_VERTEX
int children[BIH_MAXUNORDEREDCHILDREN]
int num_brushmodel_entities
size_t buildlightmapmemorysize
unsigned char * buildlightmapmemory
int * brushmodel_entities
struct model_s * worldmodel
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
matrix4x4_t inversematrix
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
struct mportal_s * portals
struct mnode_s * children[2]
unsigned int firstsurface
unsigned char *(* GetPVS)(struct model_s *model, const vec3_t p)
hull_t hulls[MAX_MAP_HULLS]
unsigned char * lightdata
msurface_t * data_surfaces
texture_t * data_textures
unsigned char * stainsamples
unsigned char styles[MAXLIGHTMAPS]
unsigned char * nmapsamples
describes the textures to use on a range of triangles in the model, and mins/maxs (AABB) for culling.
msurface_lightmapinfo_t * lightmapinfo
lightmaptexture rebuild information not used in q3bsp
int num_triangles
range of triangles and vertices in model->surfmesh
texture_t * texture
the texture to use on the surface
vec3_t mins
bounding box for onscreen checks
struct rtexture_s * deluxemaptexture
the lighting direction texture fragment to use on the rendering mesh
struct rtexture_s * lightmaptexture
the lightmap texture fragment to use on the rendering mesh
unsigned char * outlighttrispvs
vec3_t relativelightorigin
const mplane_t * frustumplanes
unsigned char * outleafpvs
const unsigned char * pvs
unsigned char * outshadowtrispvs
unsigned char * outsurfacepvs
unsigned char * tempsurfacepvs
qbool svbsp_insertoccluder
unsigned char * visitingleafpvs
model_t * worldmodel
same as worldentity->model
unsigned short lightstylevalue[MAX_LIGHTSTYLES]
8.8 fraction of base light value
entity_render_t * worldentity
the world
r_refdef_viewcache_t viewcache
qbool usecustompvs
uses r_refdef.viewcache.pvsbits as-is rather than computing it
float colorscale
global RGB color multiplier for rendering
int colormask[4]
which color components to allow (for anaglyph glasses)
int usevieworiginculling
allows visibility culling based on the view origin (e.g.
unsigned char * world_leafvisible
unsigned char * world_pvsbits
qbool world_novis
if true, the view is currently in a leaf without pvs data
unsigned char * world_surfacevisible
int batchvertex3f_bufferoffset
const msurface_t * modelsurfaces
const rtlight_t * rtlight
const r_meshbuffer_t * batchvertex3f_vertexbuffer
int shadowmapatlassidesize
size of one side of this light in the shadowmap atlas (for omnidirectional shadowmaps this is the min...
int static_shadowmap_receivers
masks of all shadowmap sides that have any potential static receivers or casters
int static_shadowmap_casters
shadowmesh_t * static_meshchain_shadow_shadowmap
optimized and culled mesh to render for world entity shadows
matrix4x4_t matrix_worldtolight
matrix for transforming world coordinates to light filter coordinates
int stat_occluders_fragments_accepted
int stat_occluders_accepted
int stat_occluders_rejected
int stat_occluders_fragments_rejected
int stat_queries_fragments_rejected
int stat_queries_rejected
int stat_queries_fragments_accepted
int stat_queries_accepted
dptransparentsortcategory_t transparentsort
struct skinframe_s * currentskinframe
qbool sRGB3D
whether 3D rendering is sRGB corrected (based on sRGBcapable3D)
void SVBSP_Init(svbsp_t *b, const float *origin, int maxnodes, svbsp_node_t *nodes)
int SVBSP_AddPolygon(svbsp_t *b, int numpoints, const float *points, int insertoccluder, void(*fragmentcallback)(void *fragmentcallback_pointer1, int fragmentcallback_number1, svbsp_t *b, int numpoints, const float *points), void *fragmentcallback_pointer1, int fragmentcallback_number1)
viddef_t vid
global video state
#define Mem_Alloc(pool, size)