36__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
60cvar_t r_damageblur = {
CF_CLIENT |
CF_ARCHIVE,
"r_damageblur",
"0",
"screen motionblur based on damage - value represents intensity, somewhere around 0.5 recommended - NOTE: bad performance on multi-gpu!"};
72cvar_t r_depthfirst = {
CF_CLIENT |
CF_ARCHIVE,
"r_depthfirst",
"0",
"renders a depth-only version of the scene before normal rendering begins to eliminate overdraw, values: 0 = off, 1 = world depth, 2 = world and model depth"};
83cvar_t r_showbboxes = {
CF_CLIENT,
"r_showbboxes",
"0",
"shows bounding boxes of server entities, value controls opacity scaling (1 = 10%, 10 = 100%)"};
85cvar_t r_showsurfaces = {
CF_CLIENT,
"r_showsurfaces",
"0",
"1 shows surfaces as different colors, or a value of 3 shows an approximation to vertex or object color (for a very approximate view of the game)"};
88cvar_t r_showlighting = {
CF_CLIENT,
"r_showlighting",
"0",
"shows areas lit by lights, useful for finding out why some areas of a map render slowly (bright orange = lots of passes = slow), a value of 2 disables depth testing which can be interesting but not very useful"};
93cvar_t r_showspriteedges = {
CF_CLIENT,
"r_showspriteedges",
"0",
"renders a debug outline to show the polygon shape of each sprite frame rendered (may be 2 or more in case of interpolated animations), for debugging rendering bugs with specific view types"};
94cvar_t r_showparticleedges = {
CF_CLIENT,
"r_showparticleedges",
"0",
"renders a debug outline to show the polygon shape of each particle, for debugging rendering bugs with specific view types"};
104cvar_t r_cullentities_trace_tempentitysamples = {
CF_CLIENT,
"r_cullentities_trace_tempentitysamples",
"-1",
"number of samples to test for entity culling of temp entities (including all CSQC entities), -1 disables trace culling on these entities to prevent flicker (pvs still applies)"};
114cvar_t r_fullbright_directed = {
CF_CLIENT,
"r_fullbright_directed",
"0",
"render fullbright things (unlit worldmodel and EF_FULLBRIGHT entities, but not fullbright shaders) using a constant light direction instead to add more depth while keeping uniform brightness"};
123cvar_t r_shadows = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadows",
"0",
"casts fake stencil shadows from models onto the world (rtlights are unaffected by this); when set to 2, always cast the shadows in the direction set by r_shadows_throwdirection, otherwise use the model lighting."};
127cvar_t r_shadows_drawafterrtlighting = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadows_drawafterrtlighting",
"0",
"draw fake shadows AFTER realtime lightning is drawn. May be useful for simulating fast sunlight on large outdoor maps with only one noshadow rtlight. The price is less realistic appearance of dynamic light shadows."};
160cvar_t r_viewfbo = {
CF_CLIENT |
CF_ARCHIVE,
"r_viewfbo",
"0",
"enables use of an 8bit (1) or 16bit (2) or 32bit (3) per component float framebuffer render, which may be at a different resolution than the video mode; the default setting of 0 uses a framebuffer render when required, and renders directly to the screen otherwise"};
161cvar_t r_rendertarget_debug = {
CF_CLIENT,
"r_rendertarget_debug",
"-1",
"replaces the view with the contents of the specified render target (by number - note that these can fluctuate depending on scene)"};
162cvar_t r_viewscale = {
CF_CLIENT |
CF_ARCHIVE,
"r_viewscale",
"1",
"scaling factor for resolution of the fbo rendering method, must be > 0, can be above 1 for a costly antialiasing behavior, typical values are 0.5 for 1/4th as many pixels rendered, or 1 for normal rendering"};
200cvar_t r_water_hideplayer = {
CF_CLIENT |
CF_ARCHIVE,
"r_water_hideplayer",
"0",
"if set to 1 then player will be hidden in refraction views, if set to 2 then player will also be hidden in reflection views, player is always visible in camera views"};
204cvar_t r_nolerp_list = {
CF_CLIENT |
CF_ARCHIVE,
"r_nolerp_list",
"progs/v_nail.mdl,progs/v_nail2.mdl,progs/flame.mdl,progs/flame2.mdl,progs/braztall.mdl,progs/brazshrt.mdl,progs/longtrch.mdl,progs/flame_pyre.mdl,progs/v_saw.mdl,progs/v_xfist.mdl,progs/h2stuff/newfire.mdl",
"comma separated list of models that will not have their animations smoothed"};
229cvar_t r_smoothnormals_areaweighting = {
CF_CLIENT,
"r_smoothnormals_areaweighting",
"1",
"uses significantly faster (and supposedly higher quality) area-weighted vertex normals and tangent vectors rather than summing normalized triangle normals and tangents"};
233cvar_t gl_lightmaps = {
CF_CLIENT,
"gl_lightmaps",
"0",
"draws only lightmaps, no texture (for level designers), a value of 2 keeps normalmap shading"};
235cvar_t r_test = {
CF_CLIENT,
"r_test",
"0",
"internal development use only, leave it alone (usually does nothing anyway)"};
237cvar_t r_batch_multidraw = {
CF_CLIENT |
CF_ARCHIVE,
"r_batch_multidraw",
"1",
"issue multiple glDrawElements calls when rendering a batch of surfaces with the same texture (otherwise the index data is copied to make it one draw)"};
252 {
CF_CLIENT |
CF_ARCHIVE,
"r_buffermegs_index16",
"1",
"index buffer size for one frame (16bit indices)"},
253 {
CF_CLIENT |
CF_ARCHIVE,
"r_buffermegs_index32",
"1",
"index buffer size for one frame (32bit indices)"},
254 {
CF_CLIENT |
CF_ARCHIVE,
"r_buffermegs_uniform",
"0.25",
"uniform buffer size for one frame"},
258cvar_t r_q1bsp_lightmap_updates_combine = {
CF_CLIENT |
CF_ARCHIVE,
"r_q1bsp_lightmap_updates_combine",
"2",
"combine lightmap texture updates to make fewer glTexSubImage2D calls, modes: 0 = immediately upload lightmaps (may be thousands of small 3x3 updates), 1 = combine to one call, 2 = combine to one full texture update (glTexImage2D) which tells the driver it does not need to lock the resource (faster on most drivers)"};
287typedef struct cubemapinfo_s
301typedef struct r_qwskincache_s
324 for (
i = 0;
i < verts;
i++)
338 for (
i = 0;
i < verts;
i++)
373 unsigned char data[4];
403 unsigned char data[6*1*1*4];
416 for (side = 0;side < 6;side++)
422 s = (
x + 0.5f) * (2.0f /
NORMSIZE) - 1.0f;
423 t = (
y + 0.5f) * (2.0f /
NORMSIZE) - 1.0f;
462 data[((side*64+
y)*64+
x)*4+3] = 255;
528 unsigned char *inpixels;
570 for (j =
x;j <=
y;j++)
578 for (j =
x;j >=
y;j--)
604typedef struct shaderpermutationinfo_s
611typedef struct shadermodeinfo_s
627 {
"#define USEDIFFUSE\n",
" diffuse"},
628 {
"#define USEVERTEXTEXTUREBLEND\n",
" vertextextureblend"},
629 {
"#define USEVIEWTINT\n",
" viewtint"},
630 {
"#define USECOLORMAPPING\n",
" colormapping"},
631 {
"#define USESATURATION\n",
" saturation"},
632 {
"#define USEFOGINSIDE\n",
" foginside"},
633 {
"#define USEFOGOUTSIDE\n",
" fogoutside"},
634 {
"#define USEFOGHEIGHTTEXTURE\n",
" fogheighttexture"},
635 {
"#define USEFOGALPHAHACK\n",
" fogalphahack"},
636 {
"#define USEGAMMARAMPS\n",
" gammaramps"},
637 {
"#define USECUBEFILTER\n",
" cubefilter"},
638 {
"#define USEGLOW\n",
" glow"},
639 {
"#define USEBLOOM\n",
" bloom"},
640 {
"#define USESPECULAR\n",
" specular"},
641 {
"#define USEPOSTPROCESSING\n",
" postprocessing"},
642 {
"#define USEREFLECTION\n",
" reflection"},
643 {
"#define USEOFFSETMAPPING\n",
" offsetmapping"},
644 {
"#define USEOFFSETMAPPING_RELIEFMAPPING\n",
" reliefmapping"},
645 {
"#define USESHADOWMAP2D\n",
" shadowmap2d"},
646 {
"#define USESHADOWMAPVSDCT\n",
" shadowmapvsdct"},
647 {
"#define USESHADOWMAPORTHO\n",
" shadowmaportho"},
648 {
"#define USEDEFERREDLIGHTMAP\n",
" deferredlightmap"},
649 {
"#define USEALPHAKILL\n",
" alphakill"},
650 {
"#define USEREFLECTCUBE\n",
" reflectcube"},
651 {
"#define USENORMALMAPSCROLLBLEND\n",
" normalmapscrollblend"},
652 {
"#define USEBOUNCEGRID\n",
" bouncegrid"},
653 {
"#define USEBOUNCEGRIDDIRECTIONAL\n",
" bouncegriddirectional"},
654 {
"#define USETRIPPY\n",
" trippy"},
655 {
"#define USEDEPTHRGB\n",
" depthrgb"},
656 {
"#define USEALPHAGENVERTEX\n",
" alphagenvertex"},
657 {
"#define USESKELETAL\n",
" skeletal"},
658 {
"#define USEOCCLUDE\n",
" occlude"}
672 {
"combined",
"glsl",
builtinshaderstrings,
"#define MODE_LIGHTDIRECTIONMAP_MODELSPACE\n",
" lightdirectionmap_modelspace"},
673 {
"combined",
"glsl",
builtinshaderstrings,
"#define MODE_LIGHTDIRECTIONMAP_TANGENTSPACE\n",
" lightdirectionmap_tangentspace"},
674 {
"combined",
"glsl",
builtinshaderstrings,
"#define MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP\n",
" lightdirectionmap_forced_lightmap"},
675 {
"combined",
"glsl",
builtinshaderstrings,
"#define MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR\n",
" lightdirectionmap_forced_vertexcolor"},
681 {
"combined",
"glsl",
builtinshaderstrings,
"#define MODE_DEFERREDGEOMETRY\n",
" deferredgeometry"},
682 {
"combined",
"glsl",
builtinshaderstrings,
"#define MODE_DEFERREDLIGHTSOURCE\n",
" deferredlightsource"},
686struct r_glsl_permutation_s;
687typedef struct r_glsl_permutation_s
828#define SHADERPERMUTATION_HASHSIZE 256
851#define SHADERSTATICPARMS_COUNT 15
857#define R_COMPILESHADER_STATICPARM_ENABLE(p) r_compileshader_staticparms[(p) >> 5] |= (1 << ((p) & 0x1F))
906#define R_COMPILESHADER_STATICPARM_EMIT(p, n) \
907 if(r_compileshader_staticparms[(p) >> 5] & (1 << ((p) & 0x1F))) \
908 shaderstaticparmstrings_list[shaderstaticparms_count++] = "#define " n "\n"; \
910 shaderstaticparmstrings_list[shaderstaticparms_count++] = "\n"
968 const char **p = strings;
971 for (p = strings;(t = *p);p++)
976 for (p = strings;(t = *p);p++)
1010 if (builtinonly || !modeinfo->
filename)
1016 if (printfromdisknotice)
1018 return shaderstring;
1031 char permutationname[256];
1032 int vertstrings_count = 0;
1033 int geomstrings_count = 0;
1034 int fragstrings_count = 0;
1044 permutationname[0] = 0;
1052 vertstrings_list[vertstrings_count++] =
"#version 140\n";
1053 geomstrings_list[geomstrings_count++] =
"#version 140\n";
1054 fragstrings_list[fragstrings_count++] =
"#version 140\n";
1055 vertstrings_list[vertstrings_count++] =
"#define GLSL140\n";
1056 geomstrings_list[geomstrings_count++] =
"#define GLSL140\n";
1057 fragstrings_list[fragstrings_count++] =
"#define GLSL140\n";
1062 vertstrings_list[vertstrings_count++] =
"#version 130\n";
1063 geomstrings_list[geomstrings_count++] =
"#version 130\n";
1064 fragstrings_list[fragstrings_count++] =
"#version 130\n";
1065 vertstrings_list[vertstrings_count++] =
"#define GLSL130\n";
1066 geomstrings_list[geomstrings_count++] =
"#define GLSL130\n";
1067 fragstrings_list[fragstrings_count++] =
"#define GLSL130\n";
1072 vertstrings_list[vertstrings_count++] =
"#version 120\n";
1073 geomstrings_list[geomstrings_count++] =
"#version 120\n";
1074 fragstrings_list[fragstrings_count++] =
"#version 120\n";
1075 vertstrings_list[vertstrings_count++] =
"#define GLSL120\n";
1076 geomstrings_list[geomstrings_count++] =
"#define GLSL120\n";
1077 fragstrings_list[fragstrings_count++] =
"#define GLSL120\n";
1083 vertstrings_list[vertstrings_count++] =
"#define GLES\n";
1084 geomstrings_list[geomstrings_count++] =
"#define GLES\n";
1085 fragstrings_list[fragstrings_count++] =
"#define GLES\n";
1093 vertstrings_list[vertstrings_count++] =
"#define VERTEX_SHADER\n";
1094 geomstrings_list[geomstrings_count++] =
"#define GEOMETRY_SHADER\n";
1095 fragstrings_list[fragstrings_count++] =
"#define FRAGMENT_SHADER\n";
1098 vertstrings_list[vertstrings_count++] = modeinfo->
pretext;
1099 geomstrings_list[geomstrings_count++] = modeinfo->
pretext;
1100 fragstrings_list[fragstrings_count++] = modeinfo->
pretext;
1101 dp_strlcat(permutationname, modeinfo->
name,
sizeof(permutationname));
1106 if (permutation & (1ll<<
i))
1116 vertstrings_list[vertstrings_count++] =
"\n";
1117 geomstrings_list[geomstrings_count++] =
"\n";
1118 fragstrings_list[fragstrings_count++] =
"\n";
1132 vertstrings_list[vertstrings_count++] = sourcestring;
1133 geomstrings_list[geomstrings_count++] = sourcestring;
1134 fragstrings_list[fragstrings_count++] = sourcestring;
1137 geomstrings_count = 0;
1140 if (vertstrings_count + geomstrings_count + fragstrings_count)
1152 GLint activeuniformindex = 0;
1153 GLint numactiveuniforms = 0;
1154 char uniformname[128];
1155 GLsizei uniformnamelength = 0;
1156 GLint uniformsize = 0;
1158 memset(uniformname, 0,
sizeof(uniformname));
1160 Con_Printf(
"Shader has %i uniforms\n", numactiveuniforms);
1161 for (activeuniformindex = 0;activeuniformindex < numactiveuniforms;activeuniformindex++)
1163 qglGetActiveUniform(p->
program, activeuniformindex,
sizeof(uniformname) - 1, &uniformnamelength, &uniformsize, &uniformtype, uniformname);
1164 Con_Printf(
"Uniform %i name \"%s\" size %i type %i\n", (
int)activeuniformindex, uniformname, (
int)uniformsize, (
int)uniformtype);
1336 Con_DPrintf(
"^5GLSL shader %s compiled (%i textures).\n", permutationname, sampler);
1339 Con_Printf(
"^1GLSL shader %s failed! some features may not work properly.\n", permutationname);
1356 Con_DPrintf(
"Compiling shader mode %u permutation %" PRIx64
"\n",
mode, permutation);
1367 if (!(permutation & j))
1396 unsigned int i, limit;
1405 for (
i = 0;
i < limit;
i++)
1422 int language,
mode, dupe;
1433 for (dupe =
mode - 1;dupe >= 0;dupe--)
1434 if (!strcmp(modeinfo[
mode].filename, modeinfo[dupe].filename))
1444 FS_Print(file,
"/* The engine may define the following macros:\n");
1445 FS_Print(file,
"#define VERTEX_SHADER\n#define GEOMETRY_SHADER\n#define FRAGMENT_SHADER\n");
1463 uint64_t permutation = 0;
1471 if (suppresstexalpha)
1495 uint64_t permutation = 0;
1517#define BLENDFUNC_ALLOWS_COLORMOD 1
1518#define BLENDFUNC_ALLOWS_FOG 2
1519#define BLENDFUNC_ALLOWS_FOG_HACK0 4
1520#define BLENDFUNC_ALLOWS_FOG_HACKALPHA 8
1521#define BLENDFUNC_ALLOWS_ANYFOG (BLENDFUNC_ALLOWS_FOG | BLENDFUNC_ALLOWS_FOG_HACK0 | BLENDFUNC_ALLOWS_FOG_HACKALPHA)
1569 uint64_t permutation = 0;
1570 unsigned int mode = 0;
1743 permutation &= ~SHADERPERMUTATION_ALPHAKILL;
1805 permutation &= ~SHADERPERMUTATION_ALPHAKILL;
1894 permutation &= ~SHADERPERMUTATION_ALPHAKILL;
2036 m9f[0] = m16f[0];m9f[1] = m16f[1];m9f[2] = m16f[2];
2037 m9f[3] = m16f[4];m9f[4] = m16f[5];m9f[5] = m16f[6];
2038 m9f[6] = m16f[8];m9f[7] = m16f[9];m9f[8] = m16f[10];
2097 uint64_t permutation = 0;
2098 unsigned int mode = 0;
2108 float viewtolight16f[16];
2113 if (diffusescale > 0)
2157#define SKINFRAME_HASH 1024
2223 if( last ==
NULL ) {
2232 for( ; item ; item = item->
next ) {
2233 if( !strcmp( item->
basename, basename ) ) {
2251 if (!strcmp(item->
basename, basename) &&
2263 memset(item, 0,
sizeof(*item));
2279#define R_SKINFRAME_LOAD_AVERAGE_COLORS(cnt, getpixel) \
2281 unsigned long long avgcolor[5], wsum; \
2289 for(pix = 0; pix < cnt; ++pix) \
2292 for(comp = 0; comp < 3; ++comp) \
2299 for(comp = 0; comp < 3; ++comp) \
2300 avgcolor[comp] += getpixel * w; \
2304 avgcolor[4] += getpixel; \
2306 if(avgcolor[3] == 0) \
2308 skinframe->avgcolor[0] = avgcolor[2] / (255.0 * avgcolor[3]); \
2309 skinframe->avgcolor[1] = avgcolor[1] / (255.0 * avgcolor[3]); \
2310 skinframe->avgcolor[2] = avgcolor[0] / (255.0 * avgcolor[3]); \
2311 skinframe->avgcolor[3] = avgcolor[4] / (255.0 * cnt); \
2323 if (skinframe && skinframe->
base)
2335 unsigned char *bumppixels;
2336 unsigned char *basepixels =
NULL;
2337 int basepixels_width = 0;
2338 int basepixels_height = 0;
2340 qbool ddshasalpha =
false;
2341 float ddsavgcolor[4];
2344 int savemiplevel = miplevel;
2354 if (!
r_loaddds || !(ddsbase =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s.dds", basename),
vid.
sRGB3D, textureflags, &ddshasalpha, ddsavgcolor, miplevel,
false)))
2357 if (basepixels ==
NULL && fallbacknotexture)
2359 if (basepixels ==
NULL)
2371 textureflags &= ~TEXF_FORCE_RELOAD;
2387 skinframe->
base = ddsbase;
2391 skinframe->
fog =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_mask.dds", skinframe->
basename),
false, textureflags |
TEXF_ALPHA,
NULL,
NULL, miplevel,
true);
2401 for (j = 3;j < basepixels_width * basepixels_height * 4;j += 4)
2403 if (basepixels[j] < 255)
2418 pixels[j+3] = basepixels[j+3];
2420 skinframe->
fog =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_mask", skinframe->
basename),
image_width,
image_height,
pixels,
TEXTYPE_BGRA, textureflags & (
gl_texturecompression_color.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), miplevel,
NULL);
2436 mymiplevel = savemiplevel;
2438 skinframe->
nmap =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_norm.dds", skinframe->
basename),
false, (
TEXF_ALPHA | textureflags) & (
r_mipnormalmaps.
integer ? ~0 : ~
TEXF_MIPMAP),
NULL,
NULL, mymiplevel,
true);
2439 skinframe->
glow =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_glow.dds", skinframe->
basename),
vid.
sRGB3D, textureflags,
NULL,
NULL, mymiplevel,
true);
2441 skinframe->
gloss =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_gloss.dds", skinframe->
basename),
vid.
sRGB3D, textureflags,
NULL,
NULL, mymiplevel,
true);
2442 skinframe->
pants =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_pants.dds", skinframe->
basename),
vid.
sRGB3D, textureflags,
NULL,
NULL, mymiplevel,
true);
2443 skinframe->
shirt =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_shirt.dds", skinframe->
basename),
vid.
sRGB3D, textureflags,
NULL,
NULL, mymiplevel,
true);
2444 skinframe->
reflect =
R_LoadTextureDDSFile(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"dds/%s_reflect.dds", skinframe->
basename),
vid.
sRGB3D, textureflags,
NULL,
NULL, mymiplevel,
true);
2450 mymiplevel = savemiplevel;
2453 skinframe->
nmap =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_nmap", skinframe->
basename),
image_width,
image_height,
pixels,
TEXTYPE_BGRA, (
TEXF_ALPHA | textureflags) & (
r_mipnormalmaps.
integer ? ~0 : ~
TEXF_MIPMAP) & (
gl_texturecompression_normal.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2461 skinframe->
nmap =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_nmap", skinframe->
basename),
image_width,
image_height,
pixels,
TEXTYPE_BGRA, (
TEXF_ALPHA | textureflags) & (
r_mipnormalmaps.
integer ? ~0 : ~
TEXF_MIPMAP) & (
gl_texturecompression_normal.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2469 skinframe->
nmap =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_nmap", skinframe->
basename), basepixels_width, basepixels_height,
pixels,
TEXTYPE_BGRA, (
TEXF_ALPHA | textureflags) & (
r_mipnormalmaps.
integer ? ~0 : ~
TEXF_MIPMAP) & (
gl_texturecompression_normal.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2481 mymiplevel = savemiplevel;
2482 if (skinframe->
glow ==
NULL && ((
pixels =
loadimagepixelsbgra(
va(vabuf,
sizeof(vabuf),
"%s_glow", skinframe->
basename),
false,
false,
false, &mymiplevel)) || (
pixels =
loadimagepixelsbgra(
va(vabuf,
sizeof(vabuf),
"%s.blend", skinframe->
basename),
false,
false,
false, &mymiplevel)) || (
pixels =
loadimagepixelsbgra(
va(vabuf,
sizeof(vabuf),
"%s_blend", skinframe->
basename),
false,
false,
false, &mymiplevel)) || (
pixels =
loadimagepixelsbgra(
va(vabuf,
sizeof(vabuf),
"%s_luma", skinframe->
basename),
false,
false,
false, &mymiplevel))))
2484 skinframe->
glow =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_glow", skinframe->
basename),
image_width,
image_height,
pixels,
vid.
sRGB3D ?
TEXTYPE_SRGB_BGRA :
TEXTYPE_BGRA, textureflags & (
gl_texturecompression_glow.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2492 mymiplevel = savemiplevel;
2495 skinframe->
gloss =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_gloss", skinframe->
basename),
image_width,
image_height,
pixels,
vid.
sRGB3D ?
TEXTYPE_SRGB_BGRA :
TEXTYPE_BGRA, (
TEXF_ALPHA | textureflags) & (
gl_texturecompression_gloss.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2504 mymiplevel = savemiplevel;
2507 skinframe->
pants =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_pants", skinframe->
basename),
image_width,
image_height,
pixels,
vid.
sRGB3D ?
TEXTYPE_SRGB_BGRA :
TEXTYPE_BGRA, textureflags & (
gl_texturecompression_color.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2516 mymiplevel = savemiplevel;
2519 skinframe->
shirt =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_shirt", skinframe->
basename),
image_width,
image_height,
pixels,
vid.
sRGB3D ?
TEXTYPE_SRGB_BGRA :
TEXTYPE_BGRA, textureflags & (
gl_texturecompression_color.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2528 mymiplevel = savemiplevel;
2531 skinframe->
reflect =
R_LoadTexture2D (
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_reflect", skinframe->
basename),
image_width,
image_height,
pixels,
vid.
sRGB3D ?
TEXTYPE_SRGB_BGRA :
TEXTYPE_BGRA, textureflags & (
gl_texturecompression_reflectmask.
integer &&
gl_texturecompression.
integer ? ~0 : ~
TEXF_COMPRESS), mymiplevel,
NULL);
2556 skinframe =
R_SkinFrame_Find(
name, textureflags, comparewidth, compareheight, comparecrc,
true);
2557 if (skinframe->
base)
2559 textureflags &= ~TEXF_FORCE_RELOAD;
2585 skinframe->
nmap =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_nmap", skinframe->
basename),
width,
height,
b,
TEXTYPE_BGRA, (textureflags |
TEXF_ALPHA) & (
r_mipnormalmaps.
integer ? ~0 : ~
TEXF_MIPMAP), -1,
NULL);
2593 if (skindata[
i] < 255)
2604 fogpixels[
i] = fogpixels[
i+1] = fogpixels[
i+2] = 255;
2605 skinframe->
fog =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_fog", skinframe->
basename),
width,
height, fogpixels,
TEXTYPE_BGRA, textureflags, -1,
NULL);
2627 if (skinframe->
base)
2680 unsigned char *skindata;
2687 colormapped =
false;
2702 skindata = skinframe->
qpixels;
2706 unsigned char *
a, *
b;
2713 skinframe->
nmap =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_nmap", skinframe->
basename),
width,
height,
b,
TEXTYPE_BGRA, (skinframe->
textureflags |
TEXF_ALPHA) & (
r_mipnormalmaps.
integer ? ~0 : ~
TEXF_MIPMAP), -1,
NULL);
2721 skinframe->
glow =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_glow", skinframe->
basename),
width,
height, skindata,
vid.
sRGB3D ?
TEXTYPE_SRGB_PALETTE :
TEXTYPE_PALETTE, skinframe->
textureflags |
TEXF_ALPHA, -1,
palette_bgra_onlyfullbrights_transparent);
2723 skinframe->
glow =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_glow", skinframe->
basename),
width,
height, skindata,
vid.
sRGB3D ?
TEXTYPE_SRGB_PALETTE :
TEXTYPE_PALETTE, skinframe->
textureflags, -1,
palette_bgra_onlyfullbrights);
2729 skinframe->
base =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_nospecial", skinframe->
basename),
width,
height, skindata,
vid.
sRGB3D ?
TEXTYPE_SRGB_PALETTE :
TEXTYPE_PALETTE, skinframe->
textureflags, -1, skinframe->
glow ?
palette_bgra_nocolormapnofullbrights :
palette_bgra_nocolormap);
2730 skinframe->
pants =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_pants", skinframe->
basename),
width,
height, skindata,
vid.
sRGB3D ?
TEXTYPE_SRGB_PALETTE :
TEXTYPE_PALETTE, skinframe->
textureflags, -1,
palette_bgra_pantsaswhite);
2731 skinframe->
shirt =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_shirt", skinframe->
basename),
width,
height, skindata,
vid.
sRGB3D ?
TEXTYPE_SRGB_PALETTE :
TEXTYPE_PALETTE, skinframe->
textureflags, -1,
palette_bgra_shirtaswhite);
2760 if (skinframe->
base)
2762 textureflags &= ~TEXF_FORCE_RELOAD;
2784 if ((textureflags &
TEXF_ALPHA) && alphapalette)
2788 if (((
unsigned char *)palette)[skindata[
i]*4+3] < 255)
2795 skinframe->
fog =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"%s_fog", skinframe->
basename),
width,
height, skindata,
TEXTYPE_PALETTE, textureflags, -1, alphapalette);
2824 skinframe->
avgcolor[0] = rand() / RAND_MAX;
2825 skinframe->
avgcolor[1] = rand() / RAND_MAX;
2826 skinframe->
avgcolor[2] = rand() / RAND_MAX;
2847 if (skinframe->
base)
2849 textureflags &= ~TEXF_FORCE_RELOAD;
2872typedef struct suffixinfo_s
2881 {
"px",
false,
false,
false},
2882 {
"nx",
false,
false,
false},
2883 {
"py",
false,
false,
false},
2884 {
"ny",
false,
false,
false},
2885 {
"pz",
false,
false,
false},
2886 {
"nz",
false,
false,
false}
2889 {
"posx",
false,
false,
false},
2890 {
"negx",
false,
false,
false},
2891 {
"posy",
false,
false,
false},
2892 {
"negy",
false,
false,
false},
2893 {
"posz",
false,
false,
false},
2894 {
"negz",
false,
false,
false}
2897 {
"rt",
true,
false,
true},
2898 {
"lf",
false,
true,
true},
2899 {
"ft",
true,
true,
false},
2900 {
"bk",
false,
false,
false},
2901 {
"up",
true,
false,
true},
2902 {
"dn",
true,
false,
true}
2910 int i, j, cubemapsize, forcefilter;
2911 unsigned char *cubemappixels, *image_buffer;
2917 if (basename && basename[0] ==
'!')
2924 cubemappixels =
NULL;
2925 cubemaptexture =
NULL;
2927 for (j = 0;j < 3 && !cubemappixels;j++)
2930 for (
i = 0;
i < 6;
i++)
2962 Con_Printf(
"loading cubemap \"%s\"\n", basename);
2969 Con_DPrintf(
"failed to load cubemap \"%s\"\n", basename);
2973 for (j = 0;j < 3;j++)
2974 for (
i = 0;
i < 6;
i++)
2976 Con_Print(
" and was unable to find any of them).\n");
2979 return cubemaptexture;
3066#ifdef GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT
3118 Con_DPrintf(
"Compiling most used shaders for SS:BR android... START\n");
3132 Con_DPrintf(
"Compiling most used shaders for SS:BR android... END\n");
3152#if defined(GL_SAMPLES_PASSED) && !defined(USE_GLES2)
3410#ifdef DP_MOBILETOUCH
3440 out[0] = ((signbits & 1) ?
mins :
maxs)[0];
3441 out[1] = ((signbits & 2) ?
mins :
maxs)[1];
3442 out[2] = ((signbits & 4) ?
mins :
maxs)[2];
3452 for (
i = 0;
i < numplanes;
i++)
3480typedef struct r_framedata_mem_s
3507 wantedsize =
bound(65536, wantedsize, 1000*1024*1024);
3512 newmem->
data = (
unsigned char *)(((
size_t)(newmem+1) + 15) & ~15);
3513 newmem->
size = (
unsigned char *)newmem + wantedsize - newmem->
data;
3554 if (
sizeof(
size_t) >= 8)
3555 newvalue =
bound(0.25f, newvalue, (
float)(1ll << 42));
3557 newvalue =
bound(0.25f, newvalue, (
float)(1 << 10));
3570 return (
void *)
data;
3598#define R_BUFFERDATA_CYCLE 3
3600typedef struct r_bufferdata_buffer_s
3643 if (mustgrow && mem)
3645 newvalue =
bound(0.25f, newvalue, 256.0f);
3646 while (newvalue * 1024*1024 < minsize)
3650 newvalue =
bound(0.25f, newvalue, 256.0f);
3655 size = (size_t)(newvalue * 1024*1024);
3660 if (!mem || mem->
size !=
size || mustgrow)
3713 *returnbufferoffset = 0;
3720 padsize = (datasize + 15) & ~15;
3728 Sys_Error(
"R_BufferData_Store: failed to create a new buffer of sufficient size\n");
3744 *returnbufferoffset =
offset;
3808 wantnormals =
false;
3810 wanttangents =
false;
3811 if (!wantnormals && !wanttangents)
3832 if (wantnormals || wanttangents)
3834 numvertices =
model->surfmesh.num_vertices;
3851 numvertices =
model->surfmesh.num_vertices;
3861 if (wantnormals || wanttangents)
3890 long unsigned int i;
3898 static vec3_t positions[] = {
3899 { 0.5f, 0.5f, 0.5f },
3900 { 0.0f, 0.0f, 0.0f },
3901 { 0.0f, 0.0f, 1.0f },
3902 { 0.0f, 1.0f, 0.0f },
3903 { 0.0f, 1.0f, 1.0f },
3904 { 1.0f, 0.0f, 0.0f },
3905 { 1.0f, 0.0f, 1.0f },
3906 { 1.0f, 1.0f, 0.0f },
3907 { 1.0f, 1.0f, 1.0f },
3922 eyemins[0] = eye[0] - eyejitter;
3923 eyemaxs[0] = eye[0] + eyejitter;
3924 eyemins[1] = eye[1] - eyejitter;
3925 eyemaxs[1] = eye[1] + eyejitter;
3926 eyemins[2] = eye[2] - eyejitter;
3927 eyemaxs[2] = eye[2] + eyejitter;
3929 boxmins[0] = (entboxenlarge + 1) * entboxmins[0] - entboxenlarge * entboxmaxs[0] - entboxexpand;
3930 boxmaxs[0] = (entboxenlarge + 1) * entboxmaxs[0] - entboxenlarge * entboxmins[0] + entboxexpand;
3931 boxmins[1] = (entboxenlarge + 1) * entboxmins[1] - entboxenlarge * entboxmaxs[1] - entboxexpand;
3932 boxmaxs[1] = (entboxenlarge + 1) * entboxmaxs[1] - entboxenlarge * entboxmins[1] + entboxexpand;
3933 boxmins[2] = (entboxenlarge + 1) * entboxmins[2] - entboxenlarge * entboxmaxs[2] - entboxexpand;
3934 boxmaxs[2] = (entboxenlarge + 1) * entboxmaxs[2] - entboxenlarge * entboxmins[2] + entboxexpand;
3936 padmins[0] = boxmins[0] - pad;
3937 padmaxs[0] = boxmaxs[0] + pad;
3938 padmins[1] = boxmins[1] - pad;
3939 padmaxs[1] = boxmaxs[1] + pad;
3940 padmins[2] = boxmins[2] - pad;
3941 padmaxs[2] = boxmaxs[2] + pad;
3951 for (
i = 0;
i <
sizeof(positions) /
sizeof(positions[0]);
i++)
3954 end[0] = boxmins[0] + (boxmaxs[0] - boxmins[0]) * positions[
i][0];
3955 end[1] = boxmins[1] + (boxmaxs[1] - boxmins[1]) * positions[
i][1];
3956 end[2] = boxmins[2] + (boxmaxs[2] - boxmins[2]) * positions[
i][2];
3967 VectorMAM(0.5f, boxmins, 0.5f, boxmaxs, end);
3968 if (
model->brush.TraceLineOfSight(
model, start, end, padmins, padmaxs))
3973 for (j = 0; j < numsamples; j++)
3979 trace_t trace =
CL_TraceLine(start, end,
MOVE_NORMAL,
NULL,
SUPERCONTENTS_SOLID,
SUPERCONTENTS_SKY,
MATERIALFLAGMASK_TRANSLUCENT, 0.0f,
true,
false,
NULL,
true,
true);
3984 else if (
model->brush.TraceLineOfSight(
model, start, end, padmins, padmaxs))
4021 if (!(ent->
flags & renderimask))
4033 if (!(ent->
flags & renderimask))
4142static float irisvecs[7][3] = {{0, 0, 0}, {-1, 0, 0}, {1, 0, 0}, {0, -1, 0}, {0, 1, 0}, {0, 0, -1}, {0, 0, 1}};
4153 vec_t brightness = 0.0f;
4170 brightness *= 1.0f / c;
4171 brightness += 0.00001f;
4177 else if (current > goal)
4192 double fpx = +1, fnx = -1, fpy = +1, fny = -1;
4226 nudge = 1.0 - 1.0 / (1<<23);
4386 const float *customclipplane =
NULL;
4400 customclipplane = plane;
4405 viewy_adjusted = viewfbo ? viewy :
vid.
mode.
height - viewheight - viewy;
4408 R_Viewport_InitOrtho3D(&
r_refdef.
view.
viewport, &
r_refdef.
view.
matrix, viewx, viewy_adjusted, viewwidth, viewheight,
r_refdef.
view.
ortho_x,
r_refdef.
view.
ortho_y, -
r_refdef.
farclip,
r_refdef.
farclip, customclipplane);
4412 R_Viewport_InitPerspective(&
r_refdef.
view.
viewport, &
r_refdef.
view.
matrix, viewx, viewy_adjusted, viewwidth, viewheight,
r_refdef.
view.
frustum_x,
r_refdef.
view.
frustum_y,
r_refdef.
nearclip,
r_refdef.
farclip, customclipplane);
4448 viewy_adjusted = viewfbo ? viewy :
vid.
mode.
height - viewheight - viewy;
4450 R_Viewport_InitOrtho(&viewport, &
identitymatrix, viewx, viewy_adjusted, viewwidth, viewheight, 0, 0,
x2,
y2, -10, 100,
NULL);
4484 R_SetupView(
true, viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
4525 unsigned int i, j, end;
4527 for (
i = 0;
i < end;
i++)
4537 for (j = 0; j <
sizeof(
r->colortexture) /
sizeof(
r->colortexture[0]); j++)
4538 if (
r->colortexture[j])
4540 if (
r->depthtexture)
4549 float iw = 1.0f / tw, ih = 1.0f / th,
x1, y1,
x2,
y2;
4553 y2 = (th -
y - h) * ih;
4566 unsigned int i, j, end;
4571 for (
i = 0;
i < end;
i++)
4574 if (
r &&
r->lastusetime !=
host.
realtime &&
r->texturewidth == texturewidth &&
r->textureheight == textureheight &&
r->depthtextype == depthtextype &&
r->colortextype[0] == colortextype0 &&
r->colortextype[1] == colortextype1 &&
r->colortextype[2] == colortextype2 &&
r->colortextype[3] == colortextype3)
4581 r->texturewidth = texturewidth;
4582 r->textureheight = textureheight;
4583 r->colortextype[0] = colortextype0;
4584 r->colortextype[1] = colortextype1;
4585 r->colortextype[2] = colortextype2;
4586 r->colortextype[3] = colortextype3;
4587 r->depthtextype = depthtextype;
4588 r->depthisrenderbuffer = depthisrenderbuffer;
4589 for (j = 0; j < 4; j++)
4590 if (
r->colortextype[j])
4591 r->colortexture[j] =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"rendertarget%i_%i_type%i",
i, j, (
int)
r->colortextype[j]),
r->texturewidth,
r->textureheight,
NULL,
r->colortextype[j],
TEXF_RENDERTARGET |
TEXF_FORCELINEAR |
TEXF_CLAMP, -1,
NULL);
4592 if (
r->depthtextype)
4594 if (
r->depthisrenderbuffer)
4597 r->depthtexture =
R_LoadTexture2D(
r_main_texturepool,
va(vabuf,
sizeof(vabuf),
"rendertarget%i_depth_type%i",
i, (
int)
r->depthtextype),
r->texturewidth,
r->textureheight,
NULL,
r->depthtextype,
TEXF_RENDERTARGET |
TEXF_FORCELINEAR |
TEXF_CLAMP, -1,
NULL);
4610 int waterwidth, waterheight;
4621 waterwidth = waterheight = 0;
4642 int planeindex, bestplaneindex, vertexindex;
4644 vec_t planescore, bestplanescore;
4691 bestplaneindex = -1;
4692 bestplanescore = 1048576.0f;
4698 if (bestplaneindex < 0 || bestplanescore > planescore)
4700 bestplaneindex = planeindex;
4701 bestplanescore = planescore;
4705 planeindex = bestplaneindex;
4708 if (planeindex < 0 || bestplanescore > 0.001f)
4762 int planeindex, qualityreduction = 0, old_r_dynamic = 0, old_r_shadows = 0, old_r_worldrtlight = 0, old_r_dlight = 0, old_r_particles = 0, old_r_decals = 0;
4771 if (qualityreduction > 0)
4773 if (qualityreduction >= 1)
4782 if (qualityreduction >= 2)
4857 GL_Scissor(myscissor[0], myscissor[1], myscissor[2], myscissor[3]);
4922 GL_Scissor(myscissor[0], myscissor[1], myscissor[2], myscissor[3]);
4999 Con_Printf(
"R_Water_ProcessPlanes: Error: texture creation failed! Turned off r_water.\n");
5002 if (qualityreduction > 0)
5004 if (qualityreduction >= 1)
5010 if (qualityreduction >= 2)
5021 int screentexturewidth, screentextureheight;
5043 double actualframetime;
5044 double targetframetime;
5124 R_Viewport_InitOrtho(&bloomviewport, &
identitymatrix, 0, 0,
r_fb.
bloomwidth,
r_fb.
bloomheight, 0, 0, 1, 1, -10, 100,
NULL);
5135 GL_Color(colorscale, colorscale, colorscale, 1);
5165 brighten =
sqrt(brighten);
5167 brighten *= (3 * range) / (2 * range - 1);
5182 for (
x = -range;
x <= range;
x++)
5202 r = brighten / (range * 2 + 1);
5204 r *= (1 -
x*
x/(
float)((range+1)*(range+1)));
5258 float blur_factor, blur_mouseaccel, blur_velocity;
5259 static float blur_average;
5260 static vec3_t blur_oldangles;
5295 R_ResetViewRendering2D(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5319 uint64_t permutation;
5320 float uservecs[4][4];
5333#define sscanf sscanf_s
5335 memset(uservecs, 0,
sizeof(uservecs));
5350 viewtexture = viewcolortexture;
5359 bloomtexture =
NULL;
5533#define RAMPWIDTH 256
5543 rampbgr[
i][0] = (
unsigned char) (ramp[
i + 2 *
RAMPWIDTH] * 255.0 / 65535.0 + 0.5);
5544 rampbgr[
i][1] = (
unsigned char) (ramp[
i +
RAMPWIDTH] * 255.0 / 65535.0 + 0.5);
5545 rampbgr[
i][2] = (
unsigned char) (ramp[
i] * 255.0 / 65535.0 + 0.5);
5604 if(
a->model <
b->model)
5606 if(
a->model >
b->model)
5612 if(
a->skinnum <
b->skinnum)
5614 if(
a->skinnum >
b->skinnum)
5724 viewdepthtexture = depthtexture;
5725 viewcolortexture = colortexture;
5749 R_ResetViewRendering3D(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5776 R_RenderWaterPlanes(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5783 R_RenderScene(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5789 R_MotionBlurView(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5818 R_Water_ProcessPlanes(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5832 qbool shadowmapping =
false;
5865 R_SetupView(
false, viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
5867 R_SetupView(
true, viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
6016 { 0, 0, 0, 1, 1, 1 },
6018 { 0, 0, 0, 0, 1, 0 },
6019 { 0, 0, 0, 1, 0, 0 },
6020 { 0, 1, 0, 1, 1, 0 },
6021 { 1, 0, 0, 1, 1, 0 },
6023 { 0, 0, 1, 0, 1, 1 },
6024 { 0, 0, 1, 1, 0, 1 },
6025 { 0, 1, 1, 1, 1, 1 },
6026 { 1, 0, 1, 1, 1, 1 },
6028 { 0, 0, 0, 0, 0, 1 },
6029 { 1, 0, 0, 1, 0, 1 },
6030 { 0, 1, 0, 0, 1, 1 },
6031 { 1, 1, 0, 1, 1, 1 },
6039 unsigned short elements[
BBOXEDGES * 36];
6041 float *
v, *c, f1, f2, edgemins[3], edgemaxs[3];
6050 for (edge = 0; edge <
BBOXEDGES; edge++)
6052 for (
i = 0;
i < 3;
i++)
6057 vertex3f[edge * 24 + 0] = edgemins[0]; vertex3f[edge * 24 + 1] = edgemins[1]; vertex3f[edge * 24 + 2] = edgemins[2];
6058 vertex3f[edge * 24 + 3] = edgemaxs[0]; vertex3f[edge * 24 + 4] = edgemins[1]; vertex3f[edge * 24 + 5] = edgemins[2];
6059 vertex3f[edge * 24 + 6] = edgemins[0]; vertex3f[edge * 24 + 7] = edgemaxs[1]; vertex3f[edge * 24 + 8] = edgemins[2];
6060 vertex3f[edge * 24 + 9] = edgemaxs[0]; vertex3f[edge * 24 + 10] = edgemaxs[1]; vertex3f[edge * 24 + 11] = edgemins[2];
6061 vertex3f[edge * 24 + 12] = edgemins[0]; vertex3f[edge * 24 + 13] = edgemins[1]; vertex3f[edge * 24 + 14] = edgemaxs[2];
6062 vertex3f[edge * 24 + 15] = edgemaxs[0]; vertex3f[edge * 24 + 16] = edgemins[1]; vertex3f[edge * 24 + 17] = edgemaxs[2];
6063 vertex3f[edge * 24 + 18] = edgemins[0]; vertex3f[edge * 24 + 19] = edgemaxs[1]; vertex3f[edge * 24 + 20] = edgemaxs[2];
6064 vertex3f[edge * 24 + 21] = edgemaxs[0]; vertex3f[edge * 24 + 22] = edgemaxs[1]; vertex3f[edge * 24 + 23] = edgemaxs[2];
6065 for (
i = 0;
i < 36;
i++)
6071 for (
i = 0,
v = vertex3f, c = color4f;
i < numvertices;
i++,
v += 3, c += 4)
6097 for (
i = 0;
i < numsurfaces;
i++)
6180 0.0f, 0.0f, 0.5f, 1.0f,
6181 0.0f, 0.0f, 0.5f, 1.0f,
6182 0.0f, 0.5f, 0.0f, 1.0f,
6183 0.0f, 0.5f, 0.0f, 1.0f,
6184 0.5f, 0.0f, 0.0f, 1.0f,
6185 0.5f, 0.0f, 0.0f, 1.0f
6194 RSurf_ActiveCustomEntity(&ent->
matrix, &ent->
inversematrix, ent->
flags, ent->
shadertime, ent->
colormod[0], ent->
colormod[1], ent->
colormod[2], ent->
alpha, 6,
nomodelvertex3f,
NULL,
NULL,
NULL,
NULL,
nomodelcolor4f, 8,
nomodelelement3i,
nomodelelement3s,
false,
false);
6204 else if (ent->
alpha < 1)
6219 for (
i = 0, c = color4f;
i < 6;
i++, c += 4)
6228 for (
i = 0, c = color4f;
i < 6;
i++, c += 4)
6269 vert[ 0] = org1[0] +
width * right1[0];
6270 vert[ 1] = org1[1] +
width * right1[1];
6271 vert[ 2] = org1[2] +
width * right1[2];
6272 vert[ 3] = org1[0] -
width * right1[0];
6273 vert[ 4] = org1[1] -
width * right1[1];
6274 vert[ 5] = org1[2] -
width * right1[2];
6275 vert[ 6] = org2[0] -
width * right2[0];
6276 vert[ 7] = org2[1] -
width * right2[1];
6277 vert[ 8] = org2[2] -
width * right2[2];
6278 vert[ 9] = org2[0] +
width * right2[0];
6279 vert[10] = org2[1] +
width * right2[1];
6280 vert[11] = org2[2] +
width * right2[2];
6285 vertex3f[ 0] =
origin[0] + left[0] * scalex2 +
up[0] * scaley1;
6286 vertex3f[ 1] =
origin[1] + left[1] * scalex2 +
up[1] * scaley1;
6287 vertex3f[ 2] =
origin[2] + left[2] * scalex2 +
up[2] * scaley1;
6288 vertex3f[ 3] =
origin[0] + left[0] * scalex2 +
up[0] * scaley2;
6289 vertex3f[ 4] =
origin[1] + left[1] * scalex2 +
up[1] * scaley2;
6290 vertex3f[ 5] =
origin[2] + left[2] * scalex2 +
up[2] * scaley2;
6291 vertex3f[ 6] =
origin[0] + left[0] * scalex1 +
up[0] * scaley2;
6292 vertex3f[ 7] =
origin[1] + left[1] * scalex1 +
up[1] * scaley2;
6293 vertex3f[ 8] =
origin[2] + left[2] * scalex1 +
up[2] * scaley2;
6294 vertex3f[ 9] =
origin[0] + left[0] * scalex1 +
up[0] * scaley1;
6295 vertex3f[10] =
origin[1] + left[1] * scalex1 +
up[1] * scaley1;
6296 vertex3f[11] =
origin[2] + left[2] * scalex1 +
up[2] * scaley1;
6325 element[0] =
R_Mesh_AddVertex(mesh, vertex3f[0], vertex3f[1], vertex3f[2]);vertex3f += 3;
6326 element[1] =
R_Mesh_AddVertex(mesh, vertex3f[0], vertex3f[1], vertex3f[2]);vertex3f += 3;
6328 for (
i = 0;
i < numvertices - 2;
i++, vertex3f += 3)
6330 element[2] =
R_Mesh_AddVertex(mesh, vertex3f[0], vertex3f[1], vertex3f[2]);
6338 element[1] = element[2];
6346 element[0] =
R_Mesh_AddVertex(mesh, vertex3d[0], vertex3d[1], vertex3d[2]);vertex3d += 3;
6347 element[1] =
R_Mesh_AddVertex(mesh, vertex3d[0], vertex3d[1], vertex3d[2]);vertex3d += 3;
6349 for (
i = 0;
i < numvertices - 2;
i++, vertex3d += 3)
6351 element[2] =
R_Mesh_AddVertex(mesh, vertex3d[0], vertex3d[1], vertex3d[2]);
6359 element[1] = element[2];
6363#define R_MESH_PLANE_DIST_EPSILON (1.0 / 32.0)
6366 int planenum, planenum2;
6371 double temppoints[2][256*3];
6374 for (
w = 0;
w < numplanes;
w++)
6375 maxdist =
max(maxdist,
fabs(planes[
w].dist));
6377 maxdist =
floor(maxdist * (4.0 / 1024.0) + 1) * 1024.0;
6378 for (planenum = 0, plane = planes;planenum < numplanes;planenum++, plane++)
6383 for (planenum2 = 0, plane2 = planes;planenum2 < numplanes && tempnumpoints >= 3;planenum2++, plane2++)
6385 if (planenum2 == planenum)
6387 PolygonD_Divide(tempnumpoints, temppoints[
w], plane2->
normal[0], plane2->
normal[1], plane2->
normal[2], plane2->
dist,
R_MESH_PLANE_DIST_EPSILON, 0,
NULL,
NULL, 256, temppoints[!
w], &tempnumpoints,
NULL);
6390 if (tempnumpoints < 3)
6399 if(parms[0] == 0 && parms[1] == 0)
6439 f = parms[0] + parms[1] *
f;
6462 if (shadertime >= 32768.0f)
6464 switch(tcmod->
tcmod)
6527 unsigned char pixels[296*194];
6533 if (!skinframe || !skinframe->
base)
6555 float specularscale = 0.0f;
6571 if ((
unsigned int)s >= (
unsigned int)
model->numskins)
6573 if (
model->skinscenes)
6575 if (
model->skinscenes[s].framecount > 1)
6578 s =
model->skinscenes[s].firstframe;
6581 t = t + s *
model->num_surfaces;
6638 for (q = 0; q < 3; q++)
6657 for (q = 0; q < 3; q++)
6675 for (q = 0; q < 3; q++)
6694 for (q = 0; q < 3; q++)
6712 for (q = 0; q < 3; q++)
6737 for (q = 0; q < 3; q++)
6753 for (q = 0; q < 3; q++)
6888 if (specularscale != 1.0f)
6890 for (q = 0; q < 3; q++)
6982 else if (wanttangents)
7004 else if (wantnormals)
7146void RSurf_ActiveCustomEntity(
const matrix4x4_t *matrix,
const matrix4x4_t *inversematrix,
int entflags,
double shadertime,
float r,
float g,
float b,
float a,
int numvertices,
const float *vertex3f,
const float *texcoord2f,
const float *normal3f,
const float *svector3f,
const float *tvector3f,
const float *color4f,
int numtriangles,
const int *element3i,
const unsigned short *element3s,
qbool wantnormals,
qbool wanttangents)
7149 if (
r != 1.0f ||
g != 1.0f ||
b != 1.0f ||
a != 1.0f) {
7155 for (q = 0; q < 3; ++q) {
7164 custom_entity.
alpha *=
a;
7206 else if (wantnormals)
7294 if ((wantnormals || wanttangents) && !normal3f)
7299 if (wanttangents && !svector3f)
7315 unsigned int fogmasktableindex;
7331 unsigned int fogmasktableindex;
7383 for (
i = 0;
i < numelements;
i++)
7384 outelement3i[
i] = inelement3i[
i] + adjust;
7387static const int quadedges[6][2] = {{0, 1}, {0, 2}, {0, 3}, {1, 2}, {1, 3}, {2, 3}};
7396 int surfacefirsttriangle;
7397 int surfacenumtriangles;
7398 int surfacefirstvertex;
7399 int surfaceendvertex;
7400 int surfacenumvertices;
7401 int batchnumsurfaces = texturenumsurfaces;
7402 int batchnumvertices;
7403 int batchnumtriangles;
7406 qbool dynamicvertex;
7409 float center[3],
forward[3],
right[3],
up[3],
v[3], newforward[3], newright[3], newup[3];
7414 if (!texturenumsurfaces)
7418 firstsurface = texturesurfacelist[0];
7420 batchnumvertices = 0;
7421 batchnumtriangles = 0;
7423 for (
i = 0;
i < texturenumsurfaces;
i++)
7425 surface = texturesurfacelist[
i];
7426 if (surface != firstsurface +
i)
7429 surfaceendvertex = surfacefirstvertex + surface->
num_vertices;
7432 if (firstvertex > surfacefirstvertex)
7433 firstvertex = surfacefirstvertex;
7434 if (endvertex < surfaceendvertex)
7435 endvertex = surfaceendvertex;
7436 batchnumvertices += surfacenumvertices;
7437 batchnumtriangles += surfacenumtriangles;
7454 dynamicvertex =
false;
7462 dynamicvertex =
true;
7474 dynamicvertex =
true;
7487 dynamicvertex =
true;
7514 dynamicvertex =
true;
7525 dynamicvertex =
true;
7536 dynamicvertex =
true;
7549 dynamicvertex =
true;
7560 dynamicvertex =
true;
7573 dynamicvertex =
true;
7593 dynamicvertex =
true;
7604 dynamicvertex =
true;
7615 dynamicvertex =
true;
7628 dynamicvertex =
true;
7645 dynamicvertex =
true;
7732 for (
i = 0;
i < texturenumsurfaces;
i++)
7737 numtriangles += surfacenumtriangles;
7744 if (endvertex <= 65536)
7748 for (
i = 0;
i < numtriangles*3;
i++)
7837 for (
i = 0;
i < texturenumsurfaces;
i++)
7906 for (j = 0;j < surfacenumvertices;j++)
7912 numvertices += surfacenumvertices;
7913 numtriangles += surfacenumtriangles;
7918 if (numvertices <= 65536)
7921 for (
i = 0;
i < numtriangles*3;
i++)
7935 const unsigned char *si;
7936 const unsigned char *
sw;
7939 float *vp, *vs, *vt, *vn;
7941 float m[3][4],
n[3][4];
7942 float tp[3], ts[3], tt[3], tn[3];
7953 memset(m[0], 0,
sizeof(m));
7954 memset(
n[0], 0,
sizeof(
n));
7955 for (
i = 0;
i < batchnumvertices;
i++)
7957 t[0] =
b + si[0]*12;
7974 else if (
sw[2] +
sw[3])
7977 t[1] =
b + si[1]*12;
7978 t[2] =
b + si[2]*12;
7979 t[3] =
b + si[3]*12;
7980 w[0] =
sw[0] * (1.0f / 255.0f);
7981 w[1] =
sw[1] * (1.0f / 255.0f);
7982 w[2] =
sw[2] * (1.0f / 255.0f);
7983 w[3] =
sw[3] * (1.0f / 255.0f);
7985 m[0][0] = t[0][ 0] *
w[0] + t[1][ 0] *
w[1] + t[2][ 0] *
w[2] + t[3][ 0] *
w[3];
7986 m[0][1] = t[0][ 1] *
w[0] + t[1][ 1] *
w[1] + t[2][ 1] *
w[2] + t[3][ 1] *
w[3];
7987 m[0][2] = t[0][ 2] *
w[0] + t[1][ 2] *
w[1] + t[2][ 2] *
w[2] + t[3][ 2] *
w[3];
7988 m[0][3] = t[0][ 3] *
w[0] + t[1][ 3] *
w[1] + t[2][ 3] *
w[2] + t[3][ 3] *
w[3];
7989 m[1][0] = t[0][ 4] *
w[0] + t[1][ 4] *
w[1] + t[2][ 4] *
w[2] + t[3][ 4] *
w[3];
7990 m[1][1] = t[0][ 5] *
w[0] + t[1][ 5] *
w[1] + t[2][ 5] *
w[2] + t[3][ 5] *
w[3];
7991 m[1][2] = t[0][ 6] *
w[0] + t[1][ 6] *
w[1] + t[2][ 6] *
w[2] + t[3][ 6] *
w[3];
7992 m[1][3] = t[0][ 7] *
w[0] + t[1][ 7] *
w[1] + t[2][ 7] *
w[2] + t[3][ 7] *
w[3];
7993 m[2][0] = t[0][ 8] *
w[0] + t[1][ 8] *
w[1] + t[2][ 8] *
w[2] + t[3][ 8] *
w[3];
7994 m[2][1] = t[0][ 9] *
w[0] + t[1][ 9] *
w[1] + t[2][ 9] *
w[2] + t[3][ 9] *
w[3];
7995 m[2][2] = t[0][10] *
w[0] + t[1][10] *
w[1] + t[2][10] *
w[2] + t[3][10] *
w[3];
7996 m[2][3] = t[0][11] *
w[0] + t[1][11] *
w[1] + t[2][11] *
w[2] + t[3][11] *
w[3];
8001 t[1] =
b + si[1]*12;
8002 w[0] =
sw[0] * (1.0f / 255.0f);
8003 w[1] =
sw[1] * (1.0f / 255.0f);
8005 m[0][0] = t[0][ 0] *
w[0] + t[1][ 0] *
w[1];
8006 m[0][1] = t[0][ 1] *
w[0] + t[1][ 1] *
w[1];
8007 m[0][2] = t[0][ 2] *
w[0] + t[1][ 2] *
w[1];
8008 m[0][3] = t[0][ 3] *
w[0] + t[1][ 3] *
w[1];
8009 m[1][0] = t[0][ 4] *
w[0] + t[1][ 4] *
w[1];
8010 m[1][1] = t[0][ 5] *
w[0] + t[1][ 5] *
w[1];
8011 m[1][2] = t[0][ 6] *
w[0] + t[1][ 6] *
w[1];
8012 m[1][3] = t[0][ 7] *
w[0] + t[1][ 7] *
w[1];
8013 m[2][0] = t[0][ 8] *
w[0] + t[1][ 8] *
w[1];
8014 m[2][1] = t[0][ 9] *
w[0] + t[1][ 9] *
w[1];
8015 m[2][2] = t[0][10] *
w[0] + t[1][10] *
w[1];
8016 m[2][3] = t[0][11] *
w[0] + t[1][11] *
w[1];
8022 vp[0] = tp[0] * m[0][0] + tp[1] * m[0][1] + tp[2] * m[0][2] + m[0][3];
8023 vp[1] = tp[0] * m[1][0] + tp[1] * m[1][1] + tp[2] * m[1][2] + m[1][3];
8024 vp[2] = tp[0] * m[2][0] + tp[1] * m[2][1] + tp[2] * m[2][2] + m[2][3];
8033 vn[0] = tn[0] *
n[0][0] + tn[1] *
n[0][1] + tn[2] *
n[0][2];
8034 vn[1] = tn[0] *
n[1][0] + tn[1] *
n[1][1] + tn[2] *
n[1][2];
8035 vn[2] = tn[0] *
n[2][0] + tn[1] *
n[2][1] + tn[2] *
n[2][2];
8041 vs[0] = ts[0] *
n[0][0] + ts[1] *
n[0][1] + ts[2] *
n[0][2];
8042 vs[1] = ts[0] *
n[1][0] + ts[1] *
n[1][1] + ts[2] *
n[1][2];
8043 vs[2] = ts[0] *
n[2][0] + ts[1] *
n[2][1] + ts[2] *
n[2][2];
8047 vt[0] = tt[0] *
n[0][0] + tt[1] *
n[0][1] + tt[2] *
n[0][2];
8048 vt[1] = tt[0] *
n[1][0] + tt[1] *
n[1][1] + tt[2] *
n[1][2];
8049 vt[2] = tt[0] *
n[2][0] + tt[1] *
n[2][1] + tt[2] *
n[2][2];
8068 const unsigned char *lm;
8073 for (
i = 0;
i < texturenumsurfaces;
i++)
8075 surface = texturesurfacelist[
i];
8080 for (j = 0;j < surfacenumvertices;j++)
8113 for (j = 0;j < surfacenumvertices;j++)
8167 for (j = 0;j < batchnumvertices - 3;j += 4)
8170 for (
i = 0;
i < 4;
i++)
8176 for (
i = 0;
i < 4;
i++)
8179 VectorMAMAMAM(1, center,
DotProduct(
forward,
v), newforward,
DotProduct(
right,
v), newright,
DotProduct(
up,
v), newup,
rsurface.
batchvertex3f + 3*(j+
i));
8197 const float *
v1, *
v2;
8207 memset(shortest, 0,
sizeof(shortest));
8209 for (j = 0;j < batchnumvertices - 3;j += 4)
8212 for (
i = 0;
i < 4;
i++)
8217 for (
i = 0;
i < 6;
i++)
8224 l += (1.0f / 1024.0f);
8225 if (shortest[0].length2 > l ||
i == 0)
8227 shortest[1] = shortest[0];
8228 shortest[0].length2 = l;
8229 shortest[0].v1 =
v1;
8230 shortest[0].v2 =
v2;
8232 else if (shortest[1].length2 > l ||
i == 1)
8234 shortest[1].length2 = l;
8235 shortest[1].v1 =
v1;
8236 shortest[1].v2 =
v2;
8266 for (
i = 0;
i < 4;
i++)
8297 for (j = 0;j < batchnumvertices;j++)
8327 animpos = deform->
parms[0] ? 1.0f / deform->
parms[0] : 100.0f;
8335 for (j = 0;j < batchnumvertices;j++)
8366 for (j = 0;j < batchnumvertices;j++)
8393 for (j = 0;j < batchnumvertices;j++)
8418 for (j = 0;j < batchnumvertices;j++)
8429 for (j = 0;j < batchnumvertices;j++)
8434 float viewer[3], d, reflected[3], worldreflected[3];
8468 for (j = 0;j < batchnumvertices;j++)
8514 int i, j, k, firstvertex, endvertex, firsttriangle, endtriangle;
8515 for (
i = 0;
i < numsurfaces;)
8518 for (k =
i, j =
i + 1;j < numsurfaces;k = j, j++)
8519 if (surfacelist[j] != surfacelist[k] + 1)
8539 int planeindex, vertexindex, bestplaneindex = -1;
8544 qbool prepared =
false;
8563 if (bestd > d || bestplaneindex < 0)
8566 bestplaneindex = planeindex;
8569 return bestplaneindex;
8610 if (
mins[0] > p[0])
mins[0] = p[0];
8611 if (
mins[1] > p[1])
mins[1] = p[1];
8612 if (
mins[2] > p[2])
mins[2] = p[2];
8613 if (
maxs[0] < p[0])
maxs[0] = p[0];
8614 if (
maxs[1] < p[1])
maxs[1] = p[1];
8615 if (
maxs[2] < p[2])
maxs[2] = p[2];
8704 int start, end, startplaneindex;
8705 for (start = 0;start < texturenumsurfaces;start = end)
8708 if(startplaneindex < 0)
8750 int texturesurfaceindex;
8753 float surfacecolor4f[4];
8769 for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
8771 surface = texturesurfacelist[texturesurfaceindex];
8773 Vector4Set(surfacecolor4f, (k & 0xF) * (1.0f / 16.0f), (k & 0xF0) * (1.0f / 256.0f), (k & 0xF00) * (1.0f / 4096.0f), 1);
8774 for (j = 0;j < surface->num_vertices;j++)
8802 for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
8804 surface = texturesurfacelist[texturesurfaceindex];
8815 for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
8817 surface = texturesurfacelist[texturesurfaceindex];
8854 int texturenumsurfaces, endsurface;
8863 qbool setup =
false;
8864 for (
i = 0;
i < numsurfaces;
i = j)
8874 endsurface =
min(
i + 1024, numsurfaces);
8875 texturenumsurfaces = 0;
8876 texturesurfacelist[texturenumsurfaces++] = surface;
8877 for (;j < endsurface;j++)
8882 texturesurfacelist[texturenumsurfaces++] = surface;
8907 for (
i = 0;
i < numsurfaces;
i = j)
8915 texturenumsurfaces = 0;
8916 texturesurfacelist[texturenumsurfaces++] = surface;
8920 for (;j < endsurface;j++)
8925 texturesurfacelist[texturenumsurfaces++] = surface;
8936 int surfacelistindex;
8938 vec3_t tempcenter, center;
8939 for (surfacelistindex = 0;surfacelistindex < texturenumsurfaces;surfacelistindex++)
8941 surface = texturesurfacelist[surfacelistindex];
8950 tempcenter[0] = (surface->
mins[0] + surface->
maxs[0]) * 0.5f;
8951 tempcenter[1] = (surface->
mins[1] + surface->
maxs[1]) * 0.5f;
8952 tempcenter[2] = (surface->
mins[2] + surface->
maxs[2]) * 0.5f;
9018 for (
i = 0;
i < numsurfaces;
i = j)
9034 if(depthonly || prepass)
9060 1,0,1, 1,0,0, 1,1,0, 1,1,1,
9061 0,1,1, 0,1,0, 0,0,0, 0,0,1,
9062 1,1,1, 1,1,0, 0,1,0, 0,1,1,
9063 0,0,1, 0,0,0, 1,0,0, 1,0,1,
9064 0,0,1, 1,0,1, 1,1,1, 0,1,1,
9065 1,0,0, 0,0,0, 0,1,0, 1,1,0
9083 float vertex3f[6*4*3];
9099 surfacelist[0] < 0 ? 0.5f : 0.125f);
9112 for (
i = 0;
i < 6*4*3;)
9113 for (j = 0;j < 3;j++,
i++)
9138 memset(decalsystem, 0,
sizeof(*decalsystem));
9141static void R_DecalSystem_SpawnTriangle(
decalsystem_t *decalsystem,
const float *
v0,
const float *
v1,
const float *
v2,
const float *t0,
const float *t1,
const float *t2,
const float *c0,
const float *c1,
const float *c2,
int triangleindex,
int surfaceindex,
unsigned int decalsequence)
9150 qbool useshortelements;
9152 useshortelements = decalsystem->
maxdecals * 3 <= 65536;
9165 if (useshortelements)
9214static void R_DecalSystem_SplatTriangle(
decalsystem_t *decalsystem,
float r,
float g,
float b,
float a,
float s1,
float t1,
float s2,
float t2,
unsigned int decalsequence,
qbool dynamic,
float (*planes)[4],
matrix4x4_t *projection,
int triangleindex,
int surfaceindex)
9219 const float *vertex3f;
9220 const float *normal3f;
9222 float points[2][9][3];
9236 for (cornerindex = 0;cornerindex < 3;cornerindex++)
9238 index = 3*e[cornerindex];
9244 for (cornerindex = 0;cornerindex < 3;cornerindex++)
9246 index = 3*e[cornerindex];
9257 numpoints =
PolygonF_Clip(3 ,
v[0] , planes[0][0], planes[0][1], planes[0][2], planes[0][3], 1.0f/64.0f,
sizeof(points[0])/
sizeof(points[0][0]), points[1][0]);
9260 numpoints =
PolygonF_Clip(numpoints, points[1][0], planes[1][0], planes[1][1], planes[1][2], planes[1][3], 1.0f/64.0f,
sizeof(points[0])/
sizeof(points[0][0]), points[0][0]);
9263 numpoints =
PolygonF_Clip(numpoints, points[0][0], planes[2][0], planes[2][1], planes[2][2], planes[2][3], 1.0f/64.0f,
sizeof(points[0])/
sizeof(points[0][0]), points[1][0]);
9266 numpoints =
PolygonF_Clip(numpoints, points[1][0], planes[3][0], planes[3][1], planes[3][2], planes[3][3], 1.0f/64.0f,
sizeof(points[0])/
sizeof(points[0][0]), points[0][0]);
9269 numpoints =
PolygonF_Clip(numpoints, points[0][0], planes[4][0], planes[4][1], planes[4][2], planes[4][3], 1.0f/64.0f,
sizeof(points[0])/
sizeof(points[0][0]), points[1][0]);
9272 numpoints =
PolygonF_Clip(numpoints, points[1][0], planes[5][0], planes[5][1], planes[5][2], planes[5][3], 1.0f/64.0f,
sizeof(points[0])/
sizeof(points[0][0]),
v[0]);
9280 for (cornerindex = 0;cornerindex < 3;cornerindex++)
9282 index = 3*e[cornerindex];
9286 for (cornerindex = 0;cornerindex < numpoints;cornerindex++)
9290 tc[cornerindex][0] = (temp[1]+1.0f)*0.5f * (s2-s1) + s1;
9291 tc[cornerindex][1] = (temp[2]+1.0f)*0.5f * (t2-t1) + t1;
9295 c[cornerindex][0] =
r *
f;
9296 c[cornerindex][1] =
g *
f;
9297 c[cornerindex][2] =
b *
f;
9298 c[cornerindex][3] = 1.0f;
9302 R_DecalSystem_SpawnTriangle(decalsystem,
v[0],
v[1],
v[2],
tc[0],
tc[1],
tc[2], c[0], c[1], c[2], triangleindex, surfaceindex, decalsequence);
9304 for (cornerindex = 0;cornerindex < numpoints-2;cornerindex++)
9305 R_DecalSystem_SpawnTriangle(decalsystem,
v[0],
v[cornerindex+1],
v[cornerindex+2],
tc[0],
tc[cornerindex+1],
tc[cornerindex+2], c[0], c[cornerindex+1], c[cornerindex+2], -1, surfaceindex, decalsequence);
9307static void R_DecalSystem_SplatEntity(
entity_render_t *ent,
const vec3_t worldorigin,
const vec3_t worldnormal,
float r,
float g,
float b,
float a,
float s1,
float t1,
float s2,
float t2,
float worldsize,
unsigned int decalsequence)
9319 float localorigin[3];
9320 float localnormal[3];
9328 int bih_triangles_count;
9329 int bih_triangles[256];
9330 int bih_surfaces[256];
9342 if (decalsystem->
model)
9357 localmins[0] = localorigin[0] - localsize;
9358 localmins[1] = localorigin[1] - localsize;
9359 localmins[2] = localorigin[2] - localsize;
9360 localmaxs[0] = localorigin[0] + localsize;
9361 localmaxs[1] = localorigin[1] + localsize;
9362 localmaxs[2] = localorigin[2] + localsize;
9371 planes[0][3] =
DotProduct(planes[0], localorigin) - localsize;
9372 planes[1][3] =
DotProduct(planes[1], localorigin) - localsize;
9373 planes[2][3] =
DotProduct(planes[2], localorigin) - localsize;
9374 planes[3][3] =
DotProduct(planes[3], localorigin) - localsize;
9375 planes[4][3] =
DotProduct(planes[4], localorigin) - localsize;
9376 planes[5][3] =
DotProduct(planes[5], localorigin) - localsize;
9388 float projectionvector[4][3];
9389 VectorScale(planes[0], ilocalsize, projectionvector[0]);
9390 VectorScale(planes[2], ilocalsize, projectionvector[1]);
9391 VectorScale(planes[4], ilocalsize, projectionvector[2]);
9392 projectionvector[0][0] = planes[0][0] * ilocalsize;
9393 projectionvector[0][1] = planes[1][0] * ilocalsize;
9394 projectionvector[0][2] = planes[2][0] * ilocalsize;
9395 projectionvector[1][0] = planes[0][1] * ilocalsize;
9396 projectionvector[1][1] = planes[1][1] * ilocalsize;
9397 projectionvector[1][2] = planes[2][1] * ilocalsize;
9398 projectionvector[2][0] = planes[0][2] * ilocalsize;
9399 projectionvector[2][1] = planes[1][2] * ilocalsize;
9400 projectionvector[2][2] = planes[2][2] * ilocalsize;
9401 projectionvector[3][0] = -(localorigin[0]*projectionvector[0][0]+localorigin[1]*projectionvector[1][0]+localorigin[2]*projectionvector[2][0]);
9402 projectionvector[3][1] = -(localorigin[0]*projectionvector[0][1]+localorigin[1]*projectionvector[1][1]+localorigin[2]*projectionvector[2][1]);
9403 projectionvector[3][2] = -(localorigin[0]*projectionvector[0][2]+localorigin[1]*projectionvector[1][2]+localorigin[2]*projectionvector[2][2]);
9404 Matrix4x4_FromVectors(&projection, projectionvector[0], projectionvector[1], projectionvector[2], projectionvector[3]);
9408 dynamic =
model->surfmesh.isanimated;
9409 surfaces =
model->data_surfaces;
9412 bih_triangles_count = -1;
9415 if(
model->render_bih.numleafs)
9416 bih = &
model->render_bih;
9417 else if(
model->collision_bih.numleafs)
9418 bih = &
model->collision_bih;
9421 bih_triangles_count =
BIH_GetTriangleListForBox(bih,
sizeof(bih_triangles) /
sizeof(*bih_triangles), bih_triangles, bih_surfaces, localmins, localmaxs);
9422 if(bih_triangles_count == 0)
9424 if(bih_triangles_count > (
int) (
sizeof(bih_triangles) /
sizeof(*bih_triangles)))
9426 if(bih_triangles_count > 0)
9428 for (triangleindex = 0; triangleindex < bih_triangles_count; ++triangleindex)
9430 surfaceindex = bih_surfaces[triangleindex];
9431 surface = surfaces + surfaceindex;
9439 R_DecalSystem_SplatTriangle(decalsystem,
r,
g,
b,
a, s1, t1, s2, t2, decalsequence, dynamic, planes, &projection, bih_triangles[triangleindex], surfaceindex);
9444 for (surfaceindex =
model->submodelsurfaces_start;surfaceindex < model->submodelsurfaces_end;surfaceindex++)
9446 surface = surfaces + surfaceindex;
9459 for (triangleindex = 0; triangleindex < numtriangles; triangleindex++)
9460 R_DecalSystem_SplatTriangle(decalsystem,
r,
g,
b,
a, s1, t1, s2, t2, decalsequence, dynamic, planes, &projection, triangleindex + surface->
num_firsttriangle, surfaceindex);
9466static void R_DecalSystem_ApplySplatEntities(
const vec3_t worldorigin,
const vec3_t worldnormal,
float r,
float g,
float b,
float a,
float s1,
float t1,
float s2,
float t2,
float worldsize,
unsigned int decalsequence)
9468 int renderentityindex;
9473 worldmins[0] = worldorigin[0] - worldsize;
9474 worldmins[1] = worldorigin[1] - worldsize;
9475 worldmins[2] = worldorigin[2] - worldsize;
9476 worldmaxs[0] = worldorigin[0] + worldsize;
9477 worldmaxs[1] = worldorigin[1] + worldsize;
9478 worldmaxs[2] = worldorigin[2] + worldsize;
9480 R_DecalSystem_SplatEntity(
r_refdef.
scene.
worldentity, worldorigin, worldnormal,
r,
g,
b,
a, s1, t1, s2, t2, worldsize, decalsequence);
9488 R_DecalSystem_SplatEntity(ent, worldorigin, worldnormal,
r,
g,
b,
a, s1, t1, s2, t2, worldsize, decalsequence);
9492typedef struct r_decalsystem_splatqueue_s
9506void R_DecalSystem_SplatEntities(
const vec3_t worldorigin,
const vec3_t worldnormal,
float r,
float g,
float b,
float a,
float s1,
float t1,
float s2,
float t2,
float worldsize)
9528 R_DecalSystem_ApplySplatEntities(queue->
worldorigin, queue->
worldnormal, queue->
color[0], queue->
color[1], queue->
color[2], queue->
color[3], queue->
tcrange[0], queue->
tcrange[1], queue->
tcrange[2], queue->
tcrange[3], queue->
worldsize, queue->
decalsequence);
9537 unsigned int killsequence;
9622 for (
i = 0, decal = decalsystem->
decals;
i < numdecals;
i++, decal++)
9627 if (surfacevisible && !surfacevisible[decal->
surfaceindex])
9697 RSurf_ActiveCustomEntity(&
rsurface.
matrix, &
rsurface.
inversematrix,
rsurface.
ent_flags, ent->
shadertime, 1, 1, 1, 1, numdecals*3, decalsystem->
vertex3f, decalsystem->
texcoord2f,
NULL,
NULL,
NULL, decalsystem->
color4f, numtris, decalsystem->
element3i, decalsystem->
element3s,
false,
false);
9766 for (j =
model->submodelsurfaces_start;j < model->submodelsurfaces_end;j++)
9770 surface =
model->data_surfaces + j;
9802 qbool cullbox =
false;
9806 float vertex3f[3][3];
9808 for (bihleafindex = 0, bihleaf = bih->
leafs;bihleafindex < bih->numleafs;bihleafindex++, bihleaf++)
9812 switch (bihleaf->
type)
9825 VectorCopy(
model->brush.data_collisionvertex3f + 3*
model->brush.data_collisionelement3i[triangleindex*3+0], vertex3f[0]);
9826 VectorCopy(
model->brush.data_collisionvertex3f + 3*
model->brush.data_collisionelement3i[triangleindex*3+1], vertex3f[1]);
9827 VectorCopy(
model->brush.data_collisionvertex3f + 3*
model->brush.data_collisionelement3i[triangleindex*3+2], vertex3f[2]);
9834 VectorCopy(
model->surfmesh.data_vertex3f + 3*
model->surfmesh.data_element3i[triangleindex*3+0], vertex3f[0]);
9835 VectorCopy(
model->surfmesh.data_vertex3f + 3*
model->surfmesh.data_element3i[triangleindex*3+1], vertex3f[1]);
9836 VectorCopy(
model->surfmesh.data_vertex3f + 3*
model->surfmesh.data_element3i[triangleindex*3+2], vertex3f[2]);
9861 for (j =
model->submodelsurfaces_start; j < model->submodelsurfaces_end; j++)
9865 surface =
model->data_surfaces + j;
9900 for (j =
model->submodelsurfaces_start; j < model->submodelsurfaces_end; j++)
9904 surface =
model->data_surfaces + j;
9916 qglVertex3f(
v[0],
v[1],
v[2]);
9919 qglVertex3f(
v[0],
v[1],
v[2]);
9928 qglVertex3f(
v[0],
v[1],
v[2]);
9931 qglVertex3f(
v[0],
v[1],
v[2]);
9940 qglVertex3f(
v[0],
v[1],
v[2]);
9943 qglVertex3f(
v[0],
v[1],
v[2]);
9952 qglVertex3f(
v[0],
v[1],
v[2]);
9955 qglVertex3f(
v[0],
v[1],
v[2]);
9972 int i, j, flagsmask;
9975 unsigned char *update;
9976 int numsurfacelist = 0;
9997 surfaces =
model->data_surfaces;
9998 update =
model->brushq1.lightmapupdateflags;
10010 if (
model->submodelsurfaces_start >=
model->submodelsurfaces_end)
10018 numsurfacelist = 0;
10026 j =
model->modelsurfaces_sorted[
i];
10032 if (!numsurfacelist)
10066 int* list =
style->surfacelist;
10069 for (j = 0; j <
style->numsurfaces; j++)
10070 update[list[j]] =
true;
10082 for (
i = 0;
i <
model->num_surfaces;
i++)
10088 for (
i = 0;
i < numsurfacelist;
i++)
10100 for (j = 0;j < numsurfacelist;j++)
10111 int e0, e1, e2, e3;
10112 float offsetx, offsety,
x1, y1,
x2,
y2,
width = 1.0f;
10113 float r1 = 1.0f, g1 = 0.0f, b1 = 0.0f, alpha1 = 0.25f;
10114 float r2 = 1.0f, g2 = 1.0f, b2 = 0.0f, alpha2 = 0.25f;
10118 Vector4Set(
w[0], start[0], start[1], start[2], 1);
10142 e0 =
Mod_Mesh_IndexForVertex(
mod, surf,
x1 - offsetx, y1 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r1, g1, b1, alpha1);
10143 e1 =
Mod_Mesh_IndexForVertex(
mod, surf,
x2 - offsetx,
y2 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r2, g2, b2, alpha2);
10144 e2 =
Mod_Mesh_IndexForVertex(
mod, surf,
x2 + offsetx,
y2 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r2, g2, b2, alpha2);
10145 e3 =
Mod_Mesh_IndexForVertex(
mod, surf,
x1 + offsetx, y1 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r1, g1, b1, alpha1);
10158 texture.update_lastrenderframe = -1;
10161 texture.currentskinframe = skinframe;
10162 texture.currenttexmatrix = *texmatrix;
10165 texture.specularscalemod = 1;
10166 texture.specularpowermod = 1;
int BIH_GetTriangleListForBox(const bih_t *bih, int maxtriangles, int *trianglelist_idx, int *trianglelist_surf, const float *mins, const float *maxs)
#define SUPERCONTENTS_SKY
#define SUPERCONTENTS_SOLID
trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitnetworkbrushmodels, qbool hitnetworkplayers, int *hitnetworkentity, qbool hitcsqcentities, qbool hitsurfaces)
trace_t CL_Cache_TraceLineSurfaces(const vec3_t start, const vec3_t end, int type, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
cl_locnode_t * CL_Locs_FindNearest(const vec3_t point)
void CL_MeshEntities_Init(void)
entity_t cl_meshentities[NUM_MESHENTITIES]
void CL_ParseEntityLump(char *entdata)
void R_DrawParticles(void)
cvar_t cl_decals_fadetime
void R_Particles_Init(void)
qbool R_Stereo_ColorMasking(void)
void R_ClearScreen(qbool fogcolor)
qbool R_Stereo_Active(void)
cvar_t r_stereo_separation
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...
cmd_state_t * cmd_local
command interpreter for local commands injected by SVQC, CSQC, MQC, server or client engine code uses...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
void Collision_Cache_Reset(qbool resetlimits)
unsigned short CRC_Block(const unsigned char *data, size_t size)
@ GAME_TENEBRAE
full of evil hackery
char * va(char *buf, size_t buflen, const char *format,...)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
#define dp_strlcat(dst, src, dsize)
#define dp_strlcpy(dst, src, dsize)
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.
qbool CL_VM_TransformView(int entnum, matrix4x4_t *viewmatrix, mplane_t *clipplane, vec3_t visorigin)
float mod(float dividend, float divisor)
void Cvar_SetValueQuick(cvar_t *var, float value)
void Cvar_SetQuick(cvar_t *var, const char *value)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
entity viewmodelforclient
float noise4f(float x, float y, float z, float w)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
qfile_t * FS_OpenRealFile(const char *filepath, const char *mode, qbool quiet)
static int(ZEXPORT *qz_inflate)(z_stream *strm
int FS_Close(qfile_t *file)
int FS_Print(qfile_t *file, const char *msg)
void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
float gl_modelviewprojection16f[16]
matrix4x4_t gl_modelmatrix
void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilvalue)
void R_Mesh_VertexPointer(int components, int gltype, size_t stride, const void *pointer, const r_meshbuffer_t *vertexbuffer, size_t bufferoffset)
void R_Mesh_CopyToTexture(rtexture_t *tex, int tx, int ty, int sx, int sy, int width, int height)
void GL_CullFace(int state)
void GL_ColorMask(int r, int g, int b, int a)
unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void R_Mesh_TexCoordPointer(unsigned int unitnum, int components, int gltype, size_t stride, const void *pointer, const r_meshbuffer_t *vertexbuffer, size_t bufferoffset)
void GL_DepthMask(int state)
void GL_Backend_FreeProgram(unsigned int prog)
matrix4x4_t gl_modelviewprojectionmatrix
int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void R_Mesh_TexBind(unsigned int unitnum, rtexture_t *tex)
void R_Mesh_ColorPointer(int components, int gltype, size_t stride, const void *pointer, const r_meshbuffer_t *vertexbuffer, size_t bufferoffset)
void GL_DepthFunc(int state)
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 R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out)
void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, float farclip, const float *nearplane)
void GL_DepthTest(int state)
void GL_DepthRange(float nearfrac, float farfrac)
void R_Viewport_InitOrtho3D(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, float farclip, const float *nearplane)
void R_Mesh_SetRenderTargets(int fbo)
void GL_PolygonOffset(float planeoffset, float depthoffset)
r_meshbuffer_t * R_Mesh_CreateMeshBuffer(const void *data, size_t size, const char *name, qbool isindexbuffer, qbool isuniformbuffer, qbool isdynamic, qbool isindex16)
int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colortexture, rtexture_t *colortexture2, rtexture_t *colortexture3, rtexture_t *colortexture4)
void R_SetViewport(const r_viewport_t *v)
void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float x1, float y1, float x2, float y2, float nearclip, float farclip, const float *nearplane)
matrix4x4_t gl_modelviewmatrix
void R_Mesh_DestroyMeshBuffer(r_meshbuffer_t *buffer)
void R_Mesh_ResetTextureState(void)
matrix4x4_t gl_projectionmatrix
void GL_Color(float cr, float cg, float cb, float ca)
void R_Mesh_PrepareVertices_Mesh_Arrays(int numvertices, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *color4f, const float *texcoordtexture2f, const float *texcoordlightmap2f)
void GL_BlendFunc(int blendfunc1, int blendfunc2)
qbool R_ScissorForBBox(const float *mins, const float *maxs, int *scissor)
void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, const float *nearplane)
void GL_AlphaToCoverage(qbool state)
void GL_Scissor(int x, int y, int width, int height)
float gl_modelview16f[16]
void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3f, const float *color4f, const float *texcoord2f)
qbool gl_modelmatrixchanged
void R_Mesh_UpdateMeshBuffer(r_meshbuffer_t *buffer, const void *data, size_t size, qbool subdata, size_t offset)
matrix4x4_t gl_viewmatrix
void R_Mesh_DestroyFramebufferObject(int fbo)
void GL_ScissorTest(int state)
void gl_backend_init(void)
unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list)
static const int nomodelelement3i[24]
rtexture_t * r_texture_whitecube
static void R_DecalSystem_ApplySplatEntitiesQueue(void)
void R_FrameData_SetMark(void)
set a marker that allows you to discard the following temporary memory allocations
static int R_DrawBrushModelsSky(void)
only used if skyrendermasked, and normally returns false
void R_Mesh_AddPolygon3f(rmesh_t *mesh, int numvertices, float *vertex3f)
cvar_t r_shadows_castfrombmodels
cvar_t r_buffermegs[R_BUFFERDATA_COUNT]
cvar_t r_shadows_shadowmapbias
void R_GLSL_Restart_f(cmd_state_t *cmd)
unsigned short locboxelements[6 *2 *3]
void R_SetupShader_Generic_NoTexture(qbool usegamma, qbool notrippy)
rtexturepool_t * r_main_texturepool
static void R_LoadQWSkin(r_qwskincache_t *cache, const char *skinname)
static const float nomodelvertex3f[6 *3]
cvar_t r_motionblur_velocityfactor
void R_RenderView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, int x, int y, int width, int height)
static void R_Main_FreeViewCache(void)
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)
skinframe_t * R_SkinFrame_LoadInternalQuake(const char *name, int textureflags, int loadpantsandshirt, int loadglowtexture, const unsigned char *skindata, int width, int height)
void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const msurface_t **texturesurfacelist)
int r_decalsystem_numqueued
void R_ResetViewRendering2D(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight)
static void R_BuildWhiteCube(void)
static void R_DrawModelDecals_Entity(entity_render_t *ent)
r_rendertarget_t * R_RenderTarget_Get(int texturewidth, int textureheight, textype_t depthtextype, qbool depthisrenderbuffer, textype_t colortextype0, textype_t colortextype1, textype_t colortextype2, textype_t colortextype3)
#define BLENDFUNC_ALLOWS_FOG_HACK0
cvar_t r_motionblur_minblur
cvar_t r_shadows_drawafterrtlighting
static void R_DrawEntityBBoxes_Callback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
void R_RenderView_UpdateViewVectors(void)
static void R_BlendView(rtexture_t *viewcolortexture, int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, int x, int y, int width, int height)
void R_EntityMatrix(const matrix4x4_t *matrix)
void R_FrameData_ReturnToMark(void)
discard recent memory allocations (rewind to marker)
cvar_t r_water_hideplayer
void R_FrameData_Reset(void)
free all R_FrameData memory
skinframe_t * R_SkinFrame_LoadInternalUsingTexture(const char *name, int textureflags, rtexture_t *tex, int width, int height, qbool sRGB)
int r_shadow_shadowmappcf
cvar_t r_hdr_irisadaptation_fade_up
cvar_t r_glsl_offsetmapping_reliefmapping_steps
cvar_t r_q1bsp_lightmap_updates_enabled
static void R_DrawLoc_Callback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
#define R_MESH_PLANE_DIST_EPSILON
void R_DecalSystem_Reset(decalsystem_t *decalsystem)
cvar_t r_batch_dynamicbuffer
#define R_BUFFERDATA_CYCLE
cvar_t r_hdr_irisadaptation_value
cvar_t r_hdr_irisadaptation_minvalue
static void R_SortEntities(void)
unsigned int r_maxqueries
cvar_t r_hdr_irisadaptation_fade_down
float RSurf_FogVertex(const float *v)
rtexture_t * r_texture_grey128
memexpandablearray_t r_glsl_permutationarray
storage for permutations linked in the hash table
#define R_COMPILESHADER_STATICPARM_ENABLE(p)
rtexture_t * r_shadow_prepasslightingdiffusetexture
void R_SetupShader_DepthOrShadow(qbool notrippy, qbool depthrgb, qbool skeletal)
cvar_t r_bloom_colorsubtract
rtexture_t * r_texture_fogattenuation
skinframe_t * decalskinframe
cvar_t r_viewscale_fpsscaling_stepsize
static char * R_ShaderStrCat(const char **strings)
static qbool r_gpuskeletal
cvar_t r_fullbright_directed_pitch_relative
cvar_t r_usedepthtextures
cvar_t r_bloom_colorexponent
cvar_t r_glsl_postprocess_uservec1_enable
void R_RenderScene(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight)
cvar_t r_water_clippingplanebias
qbool R_AnimCache_GetEntity(entity_render_t *ent, qbool wantnormals, qbool wanttangents)
get the skeletal data or cached animated mesh data for an entity (optionally with normals and tangent...
r_skinframe_t r_skinframe
static void R_DrawModelsDebug(void)
static void R_CalcTexCoordsForView(float x, float y, float w, float h, float tw, float th, float *texcoord2f)
shadermodeinfo_t shadermodeinfo[SHADERLANGUAGE_COUNT][SHADERMODE_COUNT]
static rtexture_t * R_LoadCubemap(const char *basename)
cvar_t r_q1bsp_skymasking
rtexture_t * r_shadow_prepasslightingspeculartexture
cvar_t r_transparent_sortmaxdist
void R_DrawCustomSurface(skinframe_t *skinframe, const matrix4x4_t *texmatrix, int materialflags, int firstvertex, int numvertices, int firsttriangle, int numtriangles, qbool writedepth, qbool prepass, qbool ui)
cvar_t r_smoothnormals_areaweighting
static void R_SkinFrame_GenerateTexturesFromQPixels(skinframe_t *skinframe, qbool colormapped)
void R_SkinFrame_PrepareForPurge(void)
cvar_t r_fullbright_directed_diffuse
void R_SetupShader_Generic(rtexture_t *t, qbool usegamma, qbool notrippy, qbool suppresstexalpha)
cvar_t r_shadows_throwdirection
cvar_t r_transparent_useplanardistance
rtexture_t * r_texture_black
void RSurf_DrawBatch(void)
static r_qwskincache_t * r_qwskincache
cvar_t r_motionblur_velocityfactor_minspeed
int r_textureframe
used only by R_GetCurrentTexture, incremented per view and per UI render
cvar_t r_glsl_deluxemapping
static void gl_main_start(void)
static r_bufferdata_buffer_t * r_bufferdata_buffer[R_BUFFERDATA_CYCLE][R_BUFFERDATA_COUNT]
cvar_t r_q1bsp_lightmap_updates_hidden_surfaces
static void R_DecalSystem_SpawnTriangle(decalsystem_t *decalsystem, const float *v0, const float *v1, const float *v2, const float *t0, const float *t1, const float *t2, const float *c0, const float *c1, const float *c2, int triangleindex, int surfaceindex, unsigned int decalsequence)
static void R_DrawModelTextureSurfaceList(int texturenumsurfaces, const msurface_t **texturesurfacelist, qbool writedepth, qbool prepass, qbool ui)
static void R_BuildBlankTextures(void)
void R_RenderWaterPlanes(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight)
static void R_DrawModelsAddWaterPlanes(void)
r_refdef_scene_t * R_GetScenePointer(r_refdef_scene_type_t scenetype)
#define BLENDFUNC_ALLOWS_FOG_HACKALPHA
r_glsl_permutation_t * r_glsl_permutation
currently selected permutation
float viewscalefpsadjusted
int r_texture_numcubemaps
void R_FillColors(float *out, int verts, float r, float g, float b, float a)
void R_Mesh_AddBrushMeshFromPlanes(rmesh_t *mesh, int numplanes, mplane_t *planes)
cvar_t r_viewscale_fpsscaling_stepmax
void R_BufferData_NewFrame(void)
begin a new frame (recycle old buffers)
static void R_DrawNoModel_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
qbool r_shadow_usingdeferredprepass
static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, const msurface_t **texturesurfacelist, qbool writedepth, qbool prepass, qbool ui)
void R_ResetViewRendering3D(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight)
cvar_t r_showcollisionbrushes_polygonfactor
static qbool R_BlendView_IsTrivial(int viewwidth, int viewheight, int width, int height)
static void R_DrawLocs(void)
static void R_Bloom_StartFrame(void)
cvar_t r_motionblur_velocityfactor_maxspeed
float RSurf_FogPoint(const float *v)
cvar_t r_cullentities_trace
static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, float g, float b, float a, float s1, float t1, float s2, float t2, unsigned int decalsequence, qbool dynamic, float(*planes)[4], matrix4x4_t *projection, int triangleindex, int surfaceindex)
cvar_t r_water_scissormode
cvar_t r_polygonoffset_decals_factor
skinframe_t * R_SkinFrame_LoadExternal(const char *name, int textureflags, qbool complain, qbool fallbacknotexture)
cvar_t r_hdr_irisadaptation_maxvalue
cvar_t r_viewscale_fpsscaling_target
const float r_screenvertex3f[12]
vertex coordinates for a quad that covers the screen exactly
void V_MakeViewIsometric(void)
rtexture_t * r_texture_notexture
static void R_BufferData_Resize(r_bufferdata_type_t type, qbool mustgrow, size_t minsize)
cvar_t r_viewscale_fpsscaling_min
static void RSurf_RenumberElements(const int *inelement3i, int *outelement3i, int numelements, int adjust)
void R_HDR_UpdateIrisAdaptation(const vec3_t point)
r_framebufferstate_t r_fb
cvar_t r_water_resolutionmultiplier
skinframe_t * R_SkinFrame_LoadInternalBGRA(const char *name, int textureflags, const unsigned char *skindata, int width, int height, int comparewidth, int compareheight, int comparecrc, qbool sRGB)
float locboxvertex3f[6 *4 *3]
matrix4x4_t r_waterscrollmatrix
static void R_FrameData_Resize(qbool mustgrow)
cvar_t r_glsl_offsetmapping_reliefmapping_refinesteps
qbool r_shadow_shadowmapsampler
static void R_BuildNormalizationCube(void)
rtexture_t * r_texture_reflectcube
cvar_t r_water_refractdistort
static void R_MotionBlurView(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight)
static float irisvecs[7][3]
void R_SetupShader_DeferredLight(const rtlight_t *rtlight)
void R_UpdateVariables(void)
void * R_FrameData_Alloc(size_t size)
allocate some temporary memory for your purposes
static int RSurf_FindWaterPlaneForSurface(const msurface_t *surface)
cvar_t r_glsl_vertextextureblend_usebothalphas
skinframe_t * R_SkinFrame_Find(const char *name, int textureflags, int comparewidth, int compareheight, int comparecrc, qbool add)
void R_RenderTarget_FreeUnused(qbool force)
static const unsigned short bboxelements[36]
r_decalsystem_splatqueue_t r_decalsystem_queue[MAX_DECALSYSTEM_QUEUE]
cvar_t r_cullentities_trace_eyejitter
static void R_SetupShader_SetPermutationGLSL(unsigned int mode, uint64_t permutation)
skinframe_t * R_SkinFrame_LoadNoTexture(void)
cvar_t r_glsl_postprocess_uservec3_enable
static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode, uint64_t permutation)
unsigned int r_texture_gammaramps_serial
cvar_t r_polygonoffset_decals_offset
static void gl_main_newmap(void)
cvar_t r_bloom_scenebrightness
static const float bboxedges[BBOXEDGES][6]
void R_Water_AddWaterPlane(msurface_t *surface, int entno)
static void R_View_Update(const int *myscissor)
void R_SkinFrame_Purge(void)
mempool_t * r_main_mempool
static void R_View_UpdateEntityVisible(void)
cvar_t r_bloom_colorscale
unsigned int r_numqueries
cvar_t r_motionblur_mousefactor
rtexture_t * r_texture_blanknormalmap
cvar_t r_transparent_sortsurfacesbynearest
static char * ShaderModeInfo_GetShaderText(shadermodeinfo_t *modeinfo, qbool printfromdisknotice, qbool builtinonly)
texture_t * R_GetCurrentTexture(texture_t *t)
static const char * shaderstaticparmstrings_list[SHADERSTATICPARMS_COUNT]
cvar_t r_glsl_offsetmapping
cvar_t r_batch_multidraw_mintriangles
rtexture_t * r_texture_fogheighttexture
void R_AnimCache_Free(void)
Animation cache prevents re-generating mesh data for an animated model multiple times in one frame fo...
void R_SelectScene(r_refdef_scene_type_t scenetype)
static void R_ProcessModelTextureSurfaceList(int texturenumsurfaces, const msurface_t **texturesurfacelist, qbool writedepth, qbool depthonly, qbool prepass, qbool ui)
static void R_DrawModels(void)
cvar_t r_water_lowquality
static void R_DrawModelDecals_FadeEntity(entity_render_t *ent)
cvar_t r_cullentities_trace_tempentitysamples
cvar_t r_cullentities_trace_delay
static const unsigned short nomodelelement3s[24]
static void R_Bloom_MakeTexture(void)
cvar_t r_bloom_resolution
void R_ResetViewRendering2D_Common(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight, float x2, float y2)
cvar_t r_hdr_irisadaptation
void RSurf_SetupDepthAndCulling(bool ui)
static void R_View_SetFrustum(const int *scissor)
svbsp_t r_svbsp
shadow volume bsp struct with automatically growing nodes buffer
static void R_GetCornerOfBox(vec3_t out, const vec3_t mins, const vec3_t maxs, int signbits)
static void R_tcMod_ApplyToMatrix(matrix4x4_t *texmatrix, q3shaderinfo_layer_tcmod_t *tcmod, int currentmaterialflags)
cvar_t r_fullbright_directed
cvar_t r_useinfinitefarclip
cvar_t r_shadows_shadowmapscale
static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, const msurface_t **texturesurfacelist)
int r_uniformbufferalignment
#define SHADERSTATICPARMS_COUNT
cvar_t r_hdr_scenebrightness
static void R_QueueModelSurfaceList(entity_render_t *ent, int numsurfaces, const msurface_t **surfacelist, int flagsmask, qbool writedepth, qbool depthonly, qbool prepass, qbool ui)
static r_refdef_scene_type_t r_currentscenetype
static void R_ProcessTransparentTextureSurfaceList(int texturenumsurfaces, const msurface_t **texturesurfacelist)
rtexture_t * R_GetCubemap(const char *basename)
qbool R_CullBox(const vec3_t mins, const vec3_t maxs, int numplanes, const mplane_t *planes)
shaderpermutationinfo_t shaderpermutationinfo[SHADERPERMUTATION_COUNT]
cvar_t r_motionblur_maxblur
cvar_t r_motionblur_averaging
cvar_t r_fullbright_directed_ambient
cvar_t r_transparent_sortarraysize
#define R_COMPILESHADER_STATICPARM_EMIT(p, n)
cvar_t r_motionblur_mousefactor_maxspeed
qbool R_CompileShader_CheckStaticParms(void)
static qbool r_loadnormalmap
static void R_DecalSystem_ApplySplatEntities(const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize, unsigned int decalsequence)
cvar_t r_showparticleedges
cvar_t r_fullbright_directed_pitch
cvar_t r_water_reflectdistort
skinframe_t * R_SkinFrame_FindNextByName(skinframe_t *last, const char *name)
cvar_t r_motionblur_mousefactor_minspeed
cvar_t r_hdr_irisadaptation_radius
static void R_CompileShader_AddStaticParms(unsigned int mode, uint64_t permutation)
cvar_t r_polygonoffset_submodel_factor
static void R_Water_ProcessPlanes(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, int viewx, int viewy, int viewwidth, int viewheight)
void R_AnimCache_ClearCache(void)
clear the animcache pointers on all known render entities
cvar_t r_drawexteriormodel
cubemapinfo_t * r_texture_cubemaps[MAX_CUBEMAPS]
void R_DebugLine(vec3_t start, vec3_t end)
static int componentorder[4]
static qbool _R_CullBox(const vec3_t mins, const vec3_t maxs, int numplanes, const mplane_t *planes, int ignore)
cvar_t developer_texturelogging
void R_CalcBeam_Vertex3f(float *vert, const float *org1, const float *org2, float width)
static const int quadedges[6][2]
cvar_t r_viewscale_fpsscaling_multiply
const msurface_t ** r_surfacelist
cvar_t r_glsl_offsetmapping_lod
void R_BufferData_Reset(void)
frees all dynamic buffers
void R_CalcSprite_Vertex3f(float *vertex3f, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2)
#define R_SKINFRAME_LOAD_AVERAGE_COLORS(cnt, getpixel)
cvar_t r_glsl_offsetmapping_scale
cvar_t r_batch_debugdynamicvertexpath
void RSurf_UploadBuffersForBatch(void)
static void R_InitShaderModeInfo(void)
void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b)
static int r_bufferdata_cycle
cvar_t r_shadows_throwdistance
void R_DrawModelSurfaces(entity_render_t *ent, qbool skysurfaces, qbool writedepth, qbool depthonly, qbool debug, qbool prepass, qbool ui)
static unsigned int r_compileshader_staticparms[(SHADERSTATICPARMS_COUNT+0x1F) > > 5]
void R_SkinFrame_PurgeSkinFrame(skinframe_t *s)
cvar_t r_transparent_sortmindist
cvar_t r_cullentities_trace_samples
cvar_t r_showbboxes_client
skinframe_t * R_SkinFrame_LoadMissing(void)
cvar_t r_glsl_postprocess_uservec2_enable
void R_SetupView(qbool allowwaterclippingplane, int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight)
cvar_t r_showcollisionbrushes
void RSurf_ActiveModelEntity(const entity_render_t *ent, qbool wantnormals, qbool wanttangents, qbool prepass)
static void R_BuildFogTexture(void)
cvar_t r_glsl_postprocess_uservec4
static r_glsl_permutation_t * R_GLSL_FindPermutation(unsigned int mode, uint64_t permutation)
@ SHADERSTATICPARM_POSTPROCESS_USERVEC4
postprocess uservec4 is enabled
@ SHADERSTATICPARM_SHADOWSAMPLER
sampler
@ SHADERSTATICPARM_EXACTSPECULARMATH
(lightsource or deluxemapping) use exact reflection map for specular effects, as opposed to the usual...
@ SHADERSTATICPARM_CELOUTLINES
celoutline (depth buffer analysis to produce outlines)
@ SHADERSTATICPARM_VERTEXTEXTUREBLEND_USEBOTHALPHAS
@ SHADERSTATICPARM_SHADOWMAPPCF_1
PCF 1.
@ SHADERSTATICPARM_CELSHADING
celshading (alternative diffuse and specular math)
@ SHADERSTATICPARM_COLORFRINGE
colorfringe (chromatic aberration)
@ SHADERSTATICPARM_POSTPROCESS_USERVEC2
postprocess uservec2 is enabled
@ SHADERSTATICPARM_OFFSETMAPPING_USELOD
LOD for offsetmapping.
@ SHADERSTATICPARM_FXAA
fast approximate anti aliasing
@ SHADERSTATICPARM_POSTPROCESS_USERVEC1
postprocess uservec1 is enabled
@ SHADERSTATICPARM_SATURATION_REDCOMPENSATE
red compensation filter for saturation
@ SHADERSTATICPARM_SHADOWMAPPCF_2
PCF 2.
@ SHADERSTATICPARM_POSTPROCESS_USERVEC3
postprocess uservec3 is enabled
skinframe_t * R_SkinFrame_LoadExternal_SkinFrame(skinframe_t *skinframe, const char *name, int textureflags, qbool complain, qbool fallbacknotexture)
int r_shadow_shadowmapatlas_modelshadows_size
cvar_t r_cullentities_trace_expand
static void R_Mesh_AddPolygon3d(rmesh_t *mesh, int numvertices, double *vertex3d)
static int shaderstaticparms_count
r_glsl_permutation_t * r_glsl_permutationhash[SHADERMODE_COUNT][SHADERPERMUTATION_HASHSIZE]
information about each possible shader permutation
cvar_t r_shadow_bouncegrid
void R_SkinFrame_MarkUsed(skinframe_t *skinframe)
void R_DecalSystem_SplatEntities(const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize)
cvar_t r_transparent_alphatocoverage
void R_FrameData_NewFrame(void)
prepare for a new frame, recycles old buffers if a resize occurred previously
cvar_t r_glsl_saturation_redcompensate
cvar_t r_glsl_offsetmapping_reliefmapping
cvar_t r_polygonoffset_submodel_offset
static void gl_main_shutdown(void)
#define BLENDFUNC_ALLOWS_FOG
cvar_t r_showcollisionbrushes_polygonoffset
static r_refdef_scene_t r_scenes_store[RST_COUNT]
cvar_t r_showdisabledepthtest
static void R_DrawDebugModel(void)
cvar_t r_motionblur_randomize
#define BLENDFUNC_ALLOWS_COLORMOD
void R_SetupShader_Surface(const float rtlightambient[3], const float rtlightdiffuse[3], const float rtlightspecular[3], rsurfacepass_t rsurfacepass, int texturenumsurfaces, const msurface_t **texturesurfacelist, void *surfacewaterplane, qbool notrippy, qbool ui)
static r_framedata_mem_t * r_framedata_mem
#define SHADERPERMUTATION_HASHSIZE
cvar_t r_cullentities_trace_pad
static int R_Mesh_AddVertex(rmesh_t *mesh, float x, float y, float z)
static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
cvar_t r_cullentities_trace_enlarge
static void R_BuildNoTexture(void)
static const float nomodelcolor4f[6 *4]
cvar_t r_glsl_postprocess_uservec4_enable
cvar_t r_hdr_irisadaptation_multiplier
cvar_t r_glsl_postprocess_uservec1
static qbool R_TestQ3WaveFunc(q3wavefunc_t func, const float *parms)
cvar_t r_water_cameraentitiesonly
static void R_Water_StartFrame(int viewwidth, int viewheight)
qbool R_CullFrustum(const vec3_t mins, const vec3_t maxs)
static float R_EvaluateQ3WaveFunc(q3wavefunc_t func, const float *parms)
cvar_t r_rendertarget_debug
rtexture_t * loadingscreentexture
cvar_t r_glsl_offsetmapping_steps
cvar_t r_q1bsp_lightmap_updates_combine
static void R_BuildFogHeightTexture(void)
rtexture_t * r_texture_gammaramps
static int R_SortEntities_Compare(const void *ap, const void *bp)
static void R_DrawModelDecals(void)
static void R_Main_ResizeViewCache(void)
static suffixinfo_t suffix[3][6]
cvar_t r_texture_dds_load
rtexture_t * r_texture_white
static int r_qwskincache_size
rtexture_t * r_texture_normalizationcube
static void R_GLSL_DumpShader_f(cmd_state_t *cmd)
unsigned int r_shadow_occlusion_buf
static void R_DrawModelsDepth(void)
cvar_t r_glsl_postprocess_uservec2
r_meshbuffer_t * R_BufferData_Store(size_t datasize, const void *data, r_bufferdata_type_t type, int *returnbufferoffset)
request space in a vertex/index/uniform buffer for the chosen data, returns the buffer pointer and of...
cvar_t r_glsl_postprocess
void R_DrawCustomSurface_Texture(texture_t *texture, const matrix4x4_t *texmatrix, int materialflags, int firstvertex, int numvertices, int firsttriangle, int numtriangles, qbool writedepth, qbool prepass, qbool ui)
static void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, float ca)
static void R_DrawTextureSurfaceList_DepthOnly(int texturenumsurfaces, const msurface_t **texturesurfacelist)
cvar_t r_hdr_glowintensity
void * R_FrameData_Store(size_t size, void *data)
allocate some temporary memory and copy this data into it
cvar_t r_cullentities_trace_entityocclusion
void RSurf_ActiveCustomEntity(const matrix4x4_t *matrix, const matrix4x4_t *inversematrix, int entflags, double shadertime, float r, float g, float b, float a, int numvertices, const float *vertex3f, const float *texcoord2f, const float *normal3f, const float *svector3f, const float *tvector3f, const float *color4f, int numtriangles, const int *element3i, const unsigned short *element3s, qbool wantnormals, qbool wanttangents)
#define BLENDFUNC_ALLOWS_ANYFOG
cvar_t r_transparentdepthmasking
static void R_DrawNoModel(entity_render_t *ent)
static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize, unsigned int decalsequence)
static const char * builtinshaderstrings[]
cvar_t r_glsl_postprocess_uservec3
static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, const msurface_t **texturesurfacelist, qbool writedepth)
cvar_t r_glsl_offsetmapping_lod_distance
skinframe_t * R_SkinFrame_LoadInternal8bit(const char *name, int textureflags, const unsigned char *skindata, int width, int height, const unsigned int *palette, const unsigned int *alphapalette)
cvar_t cl_decals_newsystem_intensitymultiplier
void R_AnimCache_CacheVisibleEntities(void)
generate animcache data for all entities marked visible
static void R_DrawEntityBBoxes(prvm_prog_t *prog)
static int R_BlendFuncFlags(int src, int dst)
unsigned int r_queries[MAX_OCCLUSION_QUERIES]
cvar_t r_viewscale_fpsscaling
cvar_t r_texture_dds_save
void R_BuildLightMap(const entity_render_t *ent, msurface_t *surface, int combine)
void R_View_WorldVisibility(qbool forcenovis)
cvar_t r_q3bsp_renderskydepth
void R_PurgeTexture(rtexture_t *rt)
void R_FreeTexturePool(rtexturepool_t **rtexturepool)
int R_TextureFlags(rtexture_t *rt)
cvar_t gl_texturecompression_lightcubemaps
cvar_t gl_texturecompression
rtexture_t * R_LoadTextureRenderBuffer(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, textype_t textype)
void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int z, int width, int height, int depth, int combine)
cvar_t gl_texturecompression_reflectmask
cvar_t gl_texturecompression_color
rtexture_t * R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filename, qbool srgb, int flags, qbool *hasalphaflag, float *avgcolor, int miplevel, qbool optionaltexture)
int R_SaveTextureDDSFile(rtexture_t *rt, const char *filename, qbool skipuncompressed, qbool hasalpha)
cvar_t gl_texturecompression_glow
rtexture_t * R_LoadTextureCubeMap(rtexturepool_t *rtexturepool, const char *identifier, int width, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette)
rtexturepool_t * R_AllocTexturePool(void)
void R_FreeTexture(rtexture_t *rt)
void R_Textures_Init(void)
void R_Textures_Frame(void)
cvar_t gl_texturecompression_gloss
int R_PicmipForFlags(int flags)
rtexture_t * R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette)
cvar_t gl_texturecompression_normal
GLubyte GLubyte GLubyte z
GLenum GLenum GLuint texture
GLenum GLsizei GLsizei height
GLfloat GLfloat GLfloat v2
GLint GLint GLint yoffset
GLubyte GLubyte GLubyte GLubyte w
#define GL_UNIFORM_BUFFER
GLsizei const GLfloat * value
GLsizei const GLchar ** string
#define GL_FRONT_AND_BACK
#define GL_POLYGON_OFFSET_FILL
#define GL_ONE_MINUS_DST_ALPHA
#define GL_ONE_MINUS_DST_COLOR
GLint GLenum GLint GLint y
GLsizeiptr const GLvoid * data
#define GL_COLOR_BUFFER_BIT
GLuint GLuint GLintptr offset
#define GL_ONE_MINUS_SRC_ALPHA
GLint GLenum GLenum GLvoid * pixels
#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT
#define GL_ACTIVE_UNIFORMS
#define GL_DEPTH_BUFFER_BIT
#define GL_ONE_MINUS_SRC_COLOR
unsigned char * Image_GenerateNoTexture(void)
void Image_HeightmapToNormalmap_BGRA(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale)
void Image_Copy8bitBGRA(const unsigned char *in, unsigned char *out, int pixels, const unsigned int *pal)
void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
unsigned char * loadimagepixelsbgra(const char *filename, qbool complain, qbool allowFixtrans, qbool convertsRGB, int *miplevel)
qbool LoadPCX_QWSkin(const unsigned char *f, int filesize, unsigned char *pixels, int outwidth, int outheight)
void Image_StripImageExtension(const char *in, char *out, size_t size_out)
#define Image_sRGBFloatFromLinearFloat(c)
int LoopingFrameNumberFromDouble(double t, int loopframes)
void AnglesFromVectors(vec3_t angles, const vec3_t forward, const vec3_t up, qbool flippitch)
LadyHavoc: calculates pitch/yaw/roll angles from forward and up vectors.
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
void PlaneClassify(mplane_t *p)
#define VectorLerp(v1, lerp, v2, out)
#define VectorNegate(a, b)
#define Vector4Multiply(a, b, out)
#define BoxesOverlap(a, b, c, d)
#define VectorReflect(a, r, b, out)
#define VectorNormalize(v)
#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 VectorMAMAM(scale1, b1, scale2, b2, scale3, b3, out)
#define Vector4Set(vec, r, g, b, a)
#define VectorSet(vec, x, y, z)
#define Vector4Copy(in, out)
#define VectorDistance2(a, b)
#define VectorSubtract(a, b, out)
#define Vector4Add(a, b, out)
#define CrossProduct(a, b, out)
#define VectorCompare(a, b)
#define TriangleNormal(a, b, c, n)
#define PlaneDiff(point, plane)
#define VectorDistance(a, b)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
#define VectorMAM(scale1, b1, scale2, b2, out)
#define VectorAdd(a, b, out)
#define VectorMA(a, scale, b, out)
#define VectorMAMAMAM(scale1, b1, scale2, b2, scale3, b3, scale4, b4, out)
void Matrix4x4_Concat(matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2)
void Matrix4x4_CreateIdentity(matrix4x4_t *out)
void Matrix4x4_TransformStandardPlane(const matrix4x4_t *in, float x, float y, float z, float d, float *o)
void Matrix4x4_FromArray12FloatGL(matrix4x4_t *out, const float in[12])
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_ToArrayFloatGL(const matrix4x4_t *in, float out[16])
void Matrix4x4_CreateTranslate(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_Transform3x3(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
int Matrix4x4_Invert_Full(matrix4x4_t *out, const matrix4x4_t *in1)
void Matrix4x4_CreateScale3(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_ConcatScale3(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_Normalize3(matrix4x4_t *out, matrix4x4_t *in1)
void Matrix4x4_Reflect(matrix4x4_t *out, double normalx, double normaly, double normalz, double dist, double axisscale)
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
void Matrix4x4_ConcatTranslate(matrix4x4_t *out, double x, double y, double z)
double Matrix4x4_ScaleFromMatrix(const matrix4x4_t *in)
void Matrix4x4_FromVectors(matrix4x4_t *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
void Matrix4x4_ToVectors(const matrix4x4_t *in, float vx[3], float vy[3], float vz[3], float t[3])
const matrix4x4_t identitymatrix
void Matrix4x4_ConcatRotate(matrix4x4_t *out, double angle, double x, double y, double z)
void Matrix4x4_OriginFromMatrix(const matrix4x4_t *in, float *out)
void R_MeshQueue_BeginScene(void)
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)
void R_MeshQueue_RenderTransparent(void)
#define MESHQUEUE_TRANSPARENT_BATCHSIZE
void Mod_Skeletal_BuildTransforms(const model_t *RESTRICT model, const frameblend_t *RESTRICT frameblend, const skeleton_t *skeleton, float *RESTRICT bonepose, float *RESTRICT boneposerelative)
#define MATERIALFLAG_VERTEXCOLOR
#define MATERIALFLAG_FULLBRIGHT
#define MATERIALFLAG_ALPHA
#define MATERIALFLAG_REFRACTION
#define MATERIALFLAG_NODRAW
#define MATERIALFLAGMASK_DEPTHSORTED
#define MATERIALFLAG_ALPHATEST
#define MATERIALFLAG_CUSTOMSURFACE
#define MATERIALFLAG_BLENDED
#define MATERIALFLAG_TRANSDEPTH
#define MATERIALFLAG_VERTEXTEXTUREBLEND
#define MATERIALFLAG_WATERALPHA
#define MATERIALFLAG_LIGHTGRID
#define MATERIALFLAG_ALPHAGEN_VERTEX
#define MATERIALFLAG_WATERSHADER
#define MATERIALFLAG_MODELLIGHT
#define MATERIALFLAG_CAMERA
#define MATERIALFLAG_OCCLUDE
#define MATERIALFLAG_NODEPTHTEST
#define MATERIALFLAGMASK_TRANSLUCENT
#define MATERIALFLAG_WALL
#define MATERIALFLAG_NOSHADOW
#define MATERIALFLAG_REFLECTION
#define MATERIALFLAG_SHORTDEPTHRANGE
#define MATERIALFLAG_NOCULLFACE
#define MATERIALFLAG_WATERSCROLL
#define MATERIALFLAG_CUSTOMBLEND
#define MATERIALFLAG_NORTLIGHT
#define Q3SURFACEFLAG_NOMARKS
msurface_t * Mod_Mesh_AddSurface(model_t *mod, texture_t *tex, qbool batchwithprevioussurface)
int Mod_Mesh_IndexForVertex(model_t *mod, msurface_t *surf, float x, float y, float z, float nx, float ny, float nz, float s, float t, float u, float v, float r, float g, float b, float a)
void Mod_BuildNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const int *elements, float *normal3f, qbool areaweighting)
texture_t * Mod_Mesh_GetTexture(model_t *mod, const char *name, int defaultdrawflags, int defaulttexflags, int defaultmaterialflags)
void Mod_Mesh_AddTriangle(model_t *mod, msurface_t *surf, int e0, int e1, int e2)
void Mod_BuildTextureVectorsFromNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const float *texcoord2f, const float *normal3f, const int *elements, float *svector3f, float *tvector3f, qbool areaweighting)
void Mod_RenderInit(void)
unsigned int palette_bgra_nocolormap[256]
unsigned int palette_bgra_transparent[256]
unsigned int palette_bgra_onlyfullbrights_transparent[256]
unsigned int palette_bgra_nocolormapnofullbrights[256]
unsigned int palette_bgra_shirtaswhite[256]
unsigned int palette_bgra_complete[256]
unsigned int palette_bgra_nofullbrights_transparent[256]
unsigned char palette_featureflags[256]
unsigned int palette_bgra_nofullbrights[256]
unsigned int palette_bgra_onlyfullbrights[256]
unsigned int palette_bgra_pantsaswhite[256]
#define PALETTEFEATURE_SHIRT
#define PALETTEFEATURE_GLOW
#define PALETTEFEATURE_PANTS
int PolygonF_Clip(int innumpoints, const float *inpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float epsilon, int outfrontmaxpoints, float *outfrontpoints)
void PolygonD_QuadForPlane(double *outpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double quadsize)
void PolygonD_Divide(int innumpoints, const double *inpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double epsilon, int outfrontmaxpoints, double *outfrontpoints, int *neededfrontpoints, int outbackmaxpoints, double *outbackpoints, int *neededbackpoints, int *oncountpointer)
#define PRVM_serveredictedict(ed, fieldname)
#define PRVM_gameedictedict(ed, fieldname)
#define PRVM_EDICT_NUM(n)
#define PRVM_serveredictfloat(ed, fieldname)
#define RENDER_EXTERIORMODEL
#define RENDER_DYNAMICMODELLIGHT
#define RENDER_WORLDOBJECT
#define RENDER_DOUBLESIDED
#define RENDER_NOSELFSHADOW
#define RENDER_CUSTOMIZEDMODELLIGHT
#define RENDER_NODEPTHTEST
#define MAX_WATERPLANES
max number of water planes visible (each one causes additional view renders)
#define MAX_EDICTS
max number of objects in game world at once (32768 protocol limit)
#define MAX_CUBEMAPS
max number of cubemap textures loaded for light filters
#define MAX_QPATH
max length of a quake game pathname
#define MAX_OCCLUSION_QUERIES
max number of query objects that can be used in one frame
#define MAX_DECALSYSTEM_QUEUE
void R_DrawExplosions(void)
void R_Explosion_Init(void)
void R_LightningBeams_Init(void)
void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
#define Q3WAVEFUNC_USER_COUNT
@ Q3DEFORM_PROJECTIONSHADOW
@ TRANSPARENTSORT_DISTANCE
#define Q3WAVEFUNC_USER_SHIFT
@ Q3TCMOD_ENTITYTRANSLATE
@ Q3WAVEFUNC_INVERSESAWTOOTH
cvar_t r_shadow_glossintensity
cvar_t r_shadow_bumpscale_bumpmap
float r_shadow_modelshadowmap_parameters[4]
rtexture_t * r_shadow_prepassgeometrynormalmaptexture
void R_Shadow_DrawShadowMaps(void)
qbool r_shadow_shadowmapvsdct
rtexture_t * r_shadow_viewdepthtexture
rtexture_t * r_shadow_attenuationgradienttexture
void R_Shadow_PrepareLights(void)
qbool R_Shadow_ShadowMappingEnabled(void)
float r_shadow_lightshadowmap_parameters[4]
void R_Shadow_PrepareModelShadows(void)
qbool r_shadow_usingshadowmap2d
cvar_t r_shadow_glossexact
float r_shadow_lightshadowmap_texturescale[4]
rtexture_t * r_shadow_viewcolortexture
qbool r_shadow_usingshadowmaportho
cvar_t r_shadow_frontsidecasting
void R_Shadow_UpdateBounceGridTexture(void)
rtexture_t * r_shadow_shadowmapvsdcttexture
rtexture_t * r_shadow_shadowmap2ddepthtexture
matrix4x4_t r_shadow_shadowmapmatrix
void R_Shadow_DrawCoronas(void)
cvar_t r_shadow_gloss2intensity
rtexture_t * r_shadow_shadowmap2ddepthbuffer
void R_Shadow_DrawLights(void)
cvar_t r_shadow_glossexponent
cvar_t r_shadow_gloss2exponent
void R_Shadow_DrawPrepass(void)
void R_Shadow_UpdateWorldLightSelection(void)
cvar_t r_shadow_bumpscale_basetexture
r_shadow_bouncegrid_state_t r_shadow_bouncegrid_state
void R_CompleteLightPoint(float *ambient, float *diffuse, float *lightdir, const vec3_t p, const int flags, float lightmapintensity, float ambientintensity)
float r_shadow_modelshadowmap_texturescale[4]
void R_SkyStartFrame(void)
void R_TimeReport(const char *desc)
@ r_stat_animcache_shape_count
@ r_stat_batch_fast_vertices
@ r_stat_batch_dynamic_triangles_because_deformvertexes_normal
@ r_stat_batch_entitycustom_surfaces
@ r_stat_batch_dynamic_vertices_because_deformvertexes_move
@ r_stat_batch_dynamic_surfaces_because_deformvertexes_wave
@ r_stat_batch_dynamic_batches_because_deformvertexes_autosprite
@ r_stat_batch_dynamic_surfaces_because_deformvertexes_move
@ r_stat_batch_dynamic_vertices_because_deformvertexes_normal
@ r_stat_batch_entityanimate_count
@ r_stat_framedatacurrent
@ r_stat_batch_dynamic_vertices_because_nogaps
@ r_stat_batch_dynamic_vertices_because_cvar
@ r_stat_batch_entitycache_triangles
@ r_stat_batch_dynamic_batches_because_deformvertexes_bulge
@ r_stat_batch_dynamic_batches_because_tcmod_turbulent
@ r_stat_batch_entityskeletal_vertices
@ r_stat_batch_dynamic_batches
@ r_stat_batch_dynamic_vertices_because_tcgen_lightmap
@ r_stat_batch_dynamic_surfaces_because_tcgen_environment
@ r_stat_batch_entitycustom_triangles
@ r_stat_animcache_skeletal_bones
@ r_stat_batch_dynamic_batches_because_deformvertexes_move
@ r_stat_rendertargets_used
@ r_stat_batch_entitystatic_surfaces
@ r_stat_batch_copytriangles_vertices
@ r_stat_batch_dynamic_vertices_because_deformvertexes_wave
@ r_stat_rendertargets_pixels
@ r_stat_batch_dynamic_triangles_because_cvar
@ r_stat_batch_dynamic_vertices_because_tcgen_environment
@ r_stat_batch_dynamic_batches_because_cvar
@ r_stat_batch_dynamic_batches_because_deformvertexes_wave
@ r_stat_batch_dynamic_triangles_because_deformvertexes_wave
@ r_stat_batch_dynamic_batches_because_lightmapvertex
@ r_stat_batch_dynamic_surfaces_because_deformvertexes_normal
@ r_stat_batch_copytriangles_batches
@ r_stat_entities_triangles
@ r_stat_animcache_shape_maxvertices
@ r_stat_bufferdatasize_vertex
@ r_stat_batch_dynamic_surfaces_because_tcgen_vector
@ r_stat_bloom_drawpixels
@ r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite2
@ r_stat_batch_dynamic_vertices
@ r_stat_batch_dynamic_triangles_because_deformvertexes_bulge
@ r_stat_batch_dynamic_triangles
@ r_stat_batch_entitycache_vertices
@ r_stat_batch_dynamic_surfaces_because_nogaps
@ r_stat_batch_entitycustom_vertices
@ r_stat_batch_dynamic_vertices_because_tcgen_vector
@ r_stat_batch_entitycache_surfaces
@ r_stat_batch_entityanimate_surfaces
@ r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite
@ r_stat_batch_dynamicskeletal_triangles
@ r_stat_batch_dynamicskeletal_batches
@ r_stat_batch_entitycustom_count
@ r_stat_batch_dynamic_surfaces_because_tcgen_lightmap
@ r_stat_batch_dynamicskeletal_vertices
@ r_stat_animcache_skeletal_maxbones
@ r_stat_batch_dynamic_batches_because_nogaps
@ r_stat_entities_surfaces
@ r_stat_batch_copytriangles_surfaces
@ r_stat_batch_fast_surfaces
@ r_stat_batch_dynamic_batches_because_tcgen_environment
@ r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite2
@ r_stat_batch_dynamic_surfaces_because_tcmod_turbulent
@ r_stat_animcache_skeletal_count
@ r_stat_batch_dynamic_batches_because_deformvertexes_normal
@ r_stat_batch_dynamic_surfaces_because_cvar
@ r_stat_batch_entitystatic_triangles
@ r_stat_batch_dynamic_batches_because_deformvertexes_autosprite2
@ r_stat_batch_dynamic_vertices_because_deformvertexes_bulge
@ r_stat_batch_dynamic_triangles_because_tcgen_environment
@ r_stat_batch_fast_triangles
@ r_stat_animcache_shade_count
@ r_stat_batch_entitystatic_count
@ r_stat_batch_dynamic_batches_because_tcgen_vector
@ r_stat_batch_dynamic_triangles_because_lightmapvertex
@ r_stat_batch_dynamic_triangles_because_nogaps
@ r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite
@ r_stat_batch_dynamic_surfaces_because_deformvertexes_bulge
@ r_stat_batch_entityskeletal_surfaces
@ r_stat_batch_copytriangles_triangles
@ r_stat_batch_fast_batches
@ r_stat_batch_dynamicskeletal_surfaces
@ r_stat_batch_dynamic_vertices_because_lightmapvertex
@ r_stat_bloom_copypixels
@ r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite2
@ r_stat_batch_dynamic_batches_because_tcgen_lightmap
@ r_stat_batch_dynamic_surfaces_because_lightmapvertex
@ r_stat_batch_entitystatic_vertices
@ r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite
@ r_stat_batch_entityanimate_vertices
@ r_stat_animcache_shape_vertices
@ r_stat_batch_dynamic_vertices_because_tcmod_turbulent
@ r_stat_batch_entitycache_count
@ r_stat_animcache_shade_vertices
@ r_stat_batch_entityskeletal_triangles
@ r_stat_batch_dynamic_triangles_because_tcgen_vector
@ r_stat_animcache_shade_maxvertices
@ r_stat_batch_dynamic_triangles_because_tcmod_turbulent
@ r_stat_bufferdatacurrent_vertex
@ r_stat_batch_entityskeletal_count
@ r_stat_batch_entityanimate_triangles
@ r_stat_batch_dynamic_surfaces
@ r_stat_batch_dynamic_triangles_because_deformvertexes_move
@ r_stat_batch_dynamic_triangles_because_tcgen_lightmap
#define TEXF_IMPORTANTBITS
#define TEXF_FORCENEAREST
@ TEXTYPE_DEPTHBUFFER24STENCIL8
#define TEXF_FORCE_RELOAD
#define TEXF_RENDERTARGET
r_bufferdata_type_t
enum of the various types of hardware buffer object used in rendering note that the r_buffermegs[] ar...
@ R_BUFFERDATA_COUNT
uniform buffer
@ R_BUFFERDATA_UNIFORM
index buffer - 32bit (because D3D cares)
@ R_BUFFERDATA_INDEX32
index buffer - 16bit (because D3D cares)
@ R_BUFFERDATA_INDEX16
vertex buffer
#define SHADERPERMUTATION_FOGALPHAHACK
fog color and density determined by texture mapped on vertical axis
#define SHADERPERMUTATION_SKELETAL
(skeletal models) use skeletal matrices to deform vertices (gpu-skinning)
#define SHADERPERMUTATION_SPECULAR
(lightsource or deluxemapping) render specular effects
#define SHADERPERMUTATION_POSTPROCESSING
user defined postprocessing (postprocessing only)
#define SHADERPERMUTATION_COUNT
size of shaderpermutationinfo array
#define SHADERPERMUTATION_BLOOM
bloom (postprocessing only)
@ SHADERMODE_DEFERREDGEOMETRY
(deferred) render material properties to screenspace geometry buffers
@ SHADERMODE_FLATCOLOR
(lightmap) modulate texture by uniform color (q1bsp, q3bsp)
@ SHADERMODE_LIGHTDIRECTION
(lightmap) use directional pixel shading from fixed light direction (q3bsp)
@ SHADERMODE_VERTEXCOLOR
(lightmap) modulate texture by vertex colors (q3bsp)
@ SHADERMODE_LIGHTDIRECTIONMAP_MODELSPACE
(lightmap) use directional pixel shading from texture containing modelspace light directions (q3bsp d...
@ SHADERMODE_LIGHTMAP
(lightmap) modulate texture by lightmap texture (q1bsp, q3bsp)
@ SHADERMODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP
@ SHADERMODE_GENERIC
(particles/HUD/etc) vertex color, optionally multiplied by one texture
@ SHADERMODE_POSTPROCESS
postprocessing shader (r_glsl_postprocess)
@ SHADERMODE_LIGHTDIRECTIONMAP_TANGENTSPACE
(lightmap) use directional pixel shading from texture containing tangentspace light directions (q1bsp...
@ SHADERMODE_DEFERREDLIGHTSOURCE
(deferred) use directional pixel shading from light source (rtlight) on screenspace geometry buffers
@ SHADERMODE_WATER
refract background and reflection (the material is rendered normally after this pass)
@ SHADERMODE_DEPTH_OR_SHADOW
(depthfirst/shadows) vertex shader only
@ SHADERMODE_LIGHTSOURCE
(lightsource) use directional pixel shading from light source (rtlight)
@ SHADERMODE_LIGHTGRID
(lightmap) use directional pixel shading from lightgrid data (q3bsp)
@ SHADERMODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR
@ SHADERMODE_REFRACTION
refract background (the material is rendered normally after this pass)
#define SHADERPERMUTATION_ALPHAKILL
(deferredgeometry) discard pixel if diffuse texture alpha below 0.5, (generic) apply global alpha
#define SHADERPERMUTATION_ALPHAGEN_VERTEX
alphaGen vertex
#define FOGMASKTABLEWIDTH
#define SHADERPERMUTATION_DEPTHRGB
read/write depth values in RGB color coded format for older hardware without depth samplers
#define SHADERPERMUTATION_GLOW
(lightmap) blend in an additive glow texture
#define SHADERPERMUTATION_FOGHEIGHTTEXTURE
fog color and density determined by texture mapped on vertical axis
#define SHADERPERMUTATION_BOUNCEGRIDDIRECTIONAL
(lightmap) use 16-component pixels in bouncegrid texture for directional lighting rather than standar...
#define SHADERPERMUTATION_FOGOUTSIDE
tint the color by fog color or black if using additive blend mode
#define BATCHNEED_ALLOWMULTIDRAW
#define SHADERPERMUTATION_SHADOWMAPVSDCT
(lightsource) use virtual shadow depth cube texture for shadowmap indexing
#define SHADERPERMUTATION_VIEWTINT
view tint (postprocessing only), use vertex colors (generic only)
#define BATCHNEED_ARRAY_VERTEXCOLOR
#define BATCHNEED_ARRAY_NORMAL
#define BATCHNEED_ALWAYSCOPY
#define SHADERPERMUTATION_OCCLUDE
use occlusion buffer for corona
#define BATCHNEED_ARRAY_SKELETAL
#define BATCHNEED_ARRAY_LIGHTMAP
#define SHADERPERMUTATION_OFFSETMAPPING
adjust texcoords to roughly simulate a displacement mapped surface
#define SHADERPERMUTATION_SHADOWMAP2D
(lightsource) use shadowmap texture as light filter
#define SHADERPERMUTATION_BOUNCEGRID
(lightmap) use Texture_BounceGrid as an additional source of ambient light
#define SHADERPERMUTATION_VERTEXTEXTUREBLEND
indicates this is a two-layer material blend based on vertex alpha (q3bsp)
#define BATCHNEED_ARRAY_VECTOR
#define SHADERPERMUTATION_FOGINSIDE
tint the color by fog color or black if using additive blend mode
#define SHADERPERMUTATION_NORMALMAPSCROLLBLEND
(water) counter-direction normalmaps scrolling
#define SHADERPERMUTATION_SHADOWMAPORTHO
(lightsource) use orthographic shadowmap projection
#define BATCHNEED_ARRAY_VERTEX
#define SHADERPERMUTATION_CUBEFILTER
(lightsource) use cubemap light filter
#define SHADERPERMUTATION_REFLECTION
normalmap-perturbed reflection of the scene infront of the surface, preformed as an overlay on the su...
@ RSURFPASS_DEFERREDGEOMETRY
#define SHADERPERMUTATION_REFLECTCUBE
fake reflections using global cubemap (not HDRI light probe)
#define SHADERPERMUTATION_SATURATION
saturation (postprocessing only)
#define SHADERPERMUTATION_DEFERREDLIGHTMAP
(lightmap) read Texture_ScreenDiffuse/Specular textures and add them on top of lightmapping
#define SHADERPERMUTATION_COLORMAPPING
indicates this is a colormapped skin
#define SHADERPERMUTATION_GAMMARAMPS
gamma (postprocessing only)
#define SHADERPERMUTATION_TRIPPY
use trippy vertex shader effect
#define BATCHNEED_ARRAY_TEXCOORD
#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING
adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also...
#define SHADERPERMUTATION_DIFFUSE
(lightsource) whether to use directional shading
#define SOLID_BBOX
touch on edge, block
#define SOLID_SLIDEBOX
touch on edge, but not an onground
#define SOLID_CORPSE
same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
#define SOLID_NOT
no interaction with other objects
#define SOLID_TRIGGER
touch on edge, but not blocking
#define SOLID_BSP
bsp clip, touch on edge, block
uniform highp float FogHeightFade
vec3 float FogPlaneVertexDist
uniform highp float FogPlaneViewDist
struct cl_locnode_s * next
unsigned int decalsequence
cshift_t cshifts[NUM_CSHIFTS]
struct model_s * worldmodel
csqc_vidvars_t csqc_vidvars
char worldnamenoextension[MAX_QPATH]
protocolversion_t protocol
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
unsigned short * element3s
frameblend_t frameblend[MAX_FRAMEBLENDS]
float render_fullbright[3]
vec_t userwavefunc_param[Q3WAVEFUNC_USER_COUNT]
float * animcache_skeletaltransform3x4
float render_rtlight_diffuse[3]
matrix4x4_t inversematrix
r_meshbuffer_t * animcache_vertex3f_vertexbuffer
float render_modellight_specular[3]
float * animcache_normal3f
int animcache_skeletaltransform3x4size
qbool render_rtlight_disabled
int animcache_vertex3f_bufferoffset
r_meshbuffer_t * animcache_svector3f_vertexbuffer
float render_modellight_lightdir_world[3]
float render_lightmap_ambient[3]
decalsystem_t decalsystem
float render_modellight_lightdir_local[3]
vec3_t colormap_shirtcolor
r_meshbuffer_t * animcache_tvector3f_vertexbuffer
qbool render_modellight_forced
framegroupblend_t framegroupblend[MAX_FRAMEGROUPBLENDS]
double last_trace_visibility
float * animcache_vertex3f
float render_lightmap_diffuse[3]
int animcache_svector3f_bufferoffset
float render_modellight_ambient[3]
float render_rtlight_specular[3]
float render_lightmap_specular[3]
r_meshbuffer_t * animcache_skeletaltransform3x4buffer
r_meshbuffer_t * animcache_normal3f_vertexbuffer
float render_modellight_diffuse[3]
float * animcache_svector3f
int animcache_tvector3f_bufferoffset
float * animcache_tvector3f
vec3_t colormap_pantscolor
int animcache_skeletaltransform3x4offset
int animcache_normal3f_bufferoffset
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
int(* BoxTouchingVisibleLeafs)(struct model_s *model, const unsigned char *visibleleafs, const vec3_t mins, const vec3_t maxs)
size_t(* FatPVS)(struct model_s *model, const vec3_t org, vec_t radius, unsigned char **pvsbuffer, mempool_t *pool, qbool merge)
mleaf_t *(* PointInLeaf)(struct model_s *model, const vec3_t p)
matrix4x4_t lightgridworldtotexturematrix
qbool deluxemapping_modelspace
rtexture_t * lightgridtexture
void(* DrawDepth)(struct entity_render_s *ent)
void(* Draw)(struct entity_render_s *ent)
void(* DrawSky)(struct entity_render_s *ent)
void(* DrawAddWaterPlanes)(struct entity_render_s *ent)
void(* DrawDebug)(struct entity_render_s *ent)
unsigned char styles[MAXLIGHTMAPS]
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
qbool free
true if this edict is unused
union prvm_edict_t::@29 priv
struct edict_engineprivate_s * server
FIXME: this server pointer really means world, not server (it is used by both server qc and client qc...
int num_edicts
copies of some vars that were former read from sv
struct colbrushf_s * colbrushf
float parms[Q3TCGEN_MAXPARMS]
float parms[Q3TCMOD_MAXPARMS]
float waveparms[Q3WAVEPARMS]
struct r_bufferdata_buffer_s * purge
unsigned int decalsequence
memexpandablearray_t rendertargets
r_rendertarget_t * rt_bloom
float offsettexcoord2f[8]
rtexture_t * ghosttexture
r_rendertarget_t * rt_screen
struct r_framedata_mem_s * purge
int loc_Texture_FogHeightTexture
int loc_Texture_ScreenSpecular
int tex_Texture_Deluxemap
int loc_ModelToReflectCube
int loc_Texture_Attenuation
int tex_Texture_ShadowMap2D
int loc_Texture_Refraction
int loc_Texture_BounceGrid
int tex_Texture_SecondaryNormal
int tex_Texture_GammaRamps
int tex_Texture_BounceGrid
int loc_Texture_ScreenDiffuse
int loc_OffsetMapping_Bias
int loc_Texture_ShadowMap2D
int loc_Skeletal_Transform12
int loc_Texture_First
locations of detected uniforms in program object, or -1 if not found
int loc_Texture_LightGrid
int tex_Texture_LightGrid
int tex_Texture_FogHeightTexture
int tex_Texture_ReflectMask
int loc_DeferredColor_Specular
int tex_Texture_ScreenDiffuse
int tex_Texture_ReflectCube
int loc_DeferredMod_Diffuse
int loc_Texture_SecondaryGlow
int loc_ScreenCenterRefractReflect
int loc_Texture_SecondaryNormal
int loc_PixelToScreenTexCoord
int loc_Texture_ScreenNormalMap
int loc_Texture_Deluxemap
int program
0 if compilation failed
struct r_glsl_permutation_s * hashnext
hash lookup data
int ubibind_Skeletal_Transform12_UniformBlock
uniform block bindings
int loc_ShadowMap_TextureScale
int tex_Texture_ScreenSpecular
int loc_ShadowMap_Parameters
int tex_Texture_SecondaryColor
qbool compiled
indicates if we have tried compiling this permutation already
int loc_Texture_SecondaryGloss
int loc_DeferredColor_Ambient
int loc_DeferredColor_Diffuse
int ubiloc_Skeletal_Transform12_UniformBlock
uniform block indices
int loc_BloomBlur_Parameters
int loc_DeferredMod_Specular
int loc_BloomColorSubtract
int loc_Texture_GammaRamps
int tex_Texture_SecondaryGloss
int tex_Texture_Refraction
int loc_NormalmapScrollBlend
int loc_Texture_Reflection
int loc_ScreenScaleRefractReflect
int loc_OffsetMapping_ScaleSteps
int loc_DistortScaleRefractReflect
int loc_OffsetMapping_LodDistance
int tex_Texture_Attenuation
int loc_LightGridNormalMatrix
int tex_Texture_CubeProjection
int loc_Texture_SecondaryColor
int loc_Texture_ReflectCube
int loc_Texture_CubeProjection
int loc_BackgroundTexMatrix
int tex_Texture_ScreenNormalMap
int loc_Texture_ReflectMask
int tex_Texture_Reflection
int loc_BounceGridIntensity
int tex_Texture_SecondaryGlow
int loc_ModelViewProjectionMatrix
float rtlightstylevalue[MAX_LIGHTSTYLES]
float fraction of base light value
entity_render_t ** entities
renderable entities (excluding world)
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
double time
(client gameworld) time for rendering time based effects
float fogmasktable[FOGMASKTABLEWIDTH]
float fog_height_texcoordscale
r_refdef_viewcache_t viewcache
char fog_height_texturename[64]
float fog_height_tablescale
double lastdrawscreentime
float fogmasktabledistmultiplier
unsigned char * fog_height_table1d
unsigned char * fog_height_table2d
char fogheighttexturename[64]
float fogmasktable_density
qbool clear
whether to call R_ClearScreen before rendering stuff
qbool usecustompvs
uses r_refdef.viewcache.pvsbits as-is rather than computing it
float colorscale
global RGB color multiplier for rendering
float quality
render quality (0 to 1) - affects r_drawparticles_drawdistance and others
int useperspective
if turned off it renders an ortho view
qbool isoverlay
if true, don't clear or do any post process effects (bloom, etc)
r_viewport_t viewport
note: if r_viewscale is used, the viewport.width and viewport.height may be less than width and heigh...
qbool ismain
if true, this is the MAIN view (which is, after CSQC, copied into the scene for use e....
int colormask[4]
which color components to allow (for anaglyph glasses)
matrix4x4_t inverse_matrix
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
unsigned char * entityvisible
which entities are currently visible for this viewpoint (the used range is 0...r_refdef....
rtexture_t * depthtexture
textype_t colortextype[4]
rtexture_t * colortexture[4]
struct rtexture_s * texture
unsigned int loadsequence
skinframe_t * hash[SKINFRAME_HASH]
memexpandablearray_t array
float screentodepth[2]
used by deferred renderer to calculate linear depth from device depth coordinates
matrix4x4_t viewmatrix
actual matrix for rendering (transforms to viewspace)
r_waterstate_waterplane_t waterplanes[MAX_WATERPLANES]
r_rendertarget_t * rt_refraction
r_rendertarget_t * rt_camera
r_rendertarget_t * rt_reflection
int batchskeletalindex4ub_bufferoffset
int batchvertex3f_bufferoffset
int modelskeletalweight4ub_bufferoffset
float * modellightmapcolor4f
unsigned short * batchelement3s
const msurface_t * modelsurfaces
float * entityskeletaltransform3x4
unsigned char * modelskeletalindex4ub
const rtlight_t * rtlight
const msurface_t ** batchmultidrawsurfacelist
int modeltvector3f_bufferoffset
int batchskeletalweight4ub_bufferoffset
int batchelement3s_bufferoffset
float * batchtexcoordlightmap2f
float * batchtexcoordtexture2f
int batchelement3i_bufferoffset
int modelelement3i_bufferoffset
const r_meshbuffer_t * batchtexcoordlightmap2f_vertexbuffer
int modelsvector3f_bufferoffset
unsigned short * modelelement3s
matrix4x4_t entitytolight
rtexture_t * lightmaptexture
int batchtexcoordlightmap2f_bufferoffset
int modeltexcoordlightmap2f_bufferoffset
int * modellightmapoffsets
const r_meshbuffer_t * modellightmapcolor4f_vertexbuffer
int modelelement3s_bufferoffset
int batchnormal3f_bufferoffset
unsigned char * batchskeletalindex4ub
const r_meshbuffer_t * batchlightmapcolor4f_vertexbuffer
const r_meshbuffer_t * modeltexcoordlightmap2f_vertexbuffer
const r_meshbuffer_t * batchsvector3f_vertexbuffer
qbool modelgeneratedvertex
float fogmasktabledistmultiplier
float * modeltexcoordtexture2f
int modellightmapcolor4f_bufferoffset
const r_meshbuffer_t * batchtvector3f_vertexbuffer
rtexture_t * deluxemaptexture
int batchlightmapcolor4f_bufferoffset
const r_meshbuffer_t * entityskeletaltransform3x4buffer
unsigned char * modelskeletalweight4ub
const r_meshbuffer_t * modelvertex3f_vertexbuffer
const r_meshbuffer_t * batchvertex3f_vertexbuffer
const r_meshbuffer_t * modelnormal3f_vertexbuffer
int modelnormal3f_bufferoffset
int entityskeletaltransform3x4size
const r_meshbuffer_t * modelelement3s_indexbuffer
int batchtvector3f_bufferoffset
int entityskeletaltransform3x4offset
const r_meshbuffer_t * modeltvector3f_vertexbuffer
const r_meshbuffer_t * batchtexcoordtexture2f_vertexbuffer
int modelskeletalindex4ub_bufferoffset
const r_meshbuffer_t * batchskeletalweight4ub_vertexbuffer
int entityskeletalnumtransforms
const r_meshbuffer_t * batchskeletaltransform3x4buffer
int batchskeletalnumtransforms
const r_meshbuffer_t * batchelement3i_indexbuffer
float * modeltexcoordlightmap2f
int modelvertex3f_bufferoffset
int batchskeletaltransform3x4size
frameblend_t frameblend[MAX_FRAMEBLENDS]
const r_meshbuffer_t * batchnormal3f_vertexbuffer
int modeltexcoordtexture2f_bufferoffset
const r_meshbuffer_t * modelskeletalindex4ub_vertexbuffer
float userwavefunc_param[Q3WAVEFUNC_USER_COUNT]
int batchskeletaltransform3x4offset
int batchmultidrawnumsurfaces
unsigned char * batchskeletalweight4ub
const r_meshbuffer_t * modelelement3i_indexbuffer
const r_meshbuffer_t * modelsvector3f_vertexbuffer
qbool forcecurrenttextureupdate
const r_meshbuffer_t * modelskeletalweight4ub_vertexbuffer
float * batchskeletaltransform3x4
int batchsvector3f_bufferoffset
int batchtexcoordtexture2f_bufferoffset
matrix4x4_t inversematrix
const r_meshbuffer_t * batchelement3s_indexbuffer
const r_meshbuffer_t * batchskeletalindex4ub_vertexbuffer
qbool batchgeneratedvertex
float * batchlightmapcolor4f
const r_meshbuffer_t * modeltexcoordtexture2f_vertexbuffer
vec_t ambientscale
ambient intensity to render
rtexture_t * currentcubemap
this is R_GetCubemap(rtlight->cubemapname)
vec_t specularscale
specular intensity to render
vec3_t shadoworigin
used only for casting shadows
matrix4x4_t matrix_lighttoworld
matrix for transforming light filter coordinates to world coordinates
vec_t diffusescale
diffuse intensity to render
qbool active
false if only a net client
const char ** builtinshaderstrings
const char * sourcebasename
struct matrix4x4_s * relativetransforms
struct rtexture_s * pants
struct rtexture_s * stain
struct rtexture_s * merged
struct rtexture_s * shirt
struct skinframe_s * next
struct rtexture_s * reflect
struct rtexture_s * gloss
unsigned int loadsequence
q3shaderinfo_layer_tcmod_t tcmods[Q3MAXTCMODS]
struct skinframe_s * skinframes[TEXTURE_MAXFRAMES]
q3shaderinfo_layer_tcgen_t tcgen
struct skinframe_s * backgroundcurrentskinframe
struct rtexture_s * basetexture
float render_rtlight_specular[3]
matrix4x4_t currenttexmatrix
struct rtexture_s * glosstexture
float render_modellight_lightdir_world[3]
dptransparentsortcategory_t transparentsort
float render_colormap_pants[3]
struct rtexture_s * nmaptexture
dpoffsetmapping_technique_t offsetmapping
struct rtexture_s * backgroundglosstexture
struct rtexture_s * backgroundbasetexture
texture_shaderpass_t * backgroundshaderpass
void * update_lastrenderentity
float render_colormap_shirt[3]
float r_water_waterscroll[2]
float render_modellight_diffuse[3]
float render_rtlight_diffuse[3]
float render_modellight_ambient[3]
struct rtexture_s * shirttexture
struct rtexture_s * pantstexture
struct texture_s * currentframe
struct rtexture_s * glowtexture
int update_lastrenderframe
float render_modellight_lightdir_local[3]
struct rtexture_s * backgroundglowtexture
q3shaderinfo_deform_t deforms[Q3MAXDEFORMS]
float render_lightmap_specular[3]
struct rtexture_s * reflectmasktexture
matrix4x4_t currentbackgroundtexmatrix
struct rtexture_s * fogtexture
struct rtexture_s * reflectcubetexture
float render_lightmap_diffuse[3]
texture_shaderpass_t * materialshaderpass
float render_lightmap_ambient[3]
struct rtexture_s * backgroundnmaptexture
float render_modellight_specular[3]
struct skinframe_s * currentskinframe
struct texture_s * anim_frames[2][10]
unsigned int decalsequence
qbool ext_texture_compression_s3tc
int glshaderversion
this is at least 150 (GL 3.2)
unsigned int maxtexturesize_2d
qbool sRGB3D
whether 3D rendering is sRGB corrected (based on sRGBcapable3D)
qbool sRGB2D
whether 2D rendering is sRGB corrected (based on sRGBcapable2D)
viddef_mode_t mode
currently active video mode
qbool allowalphatocoverage
indicates the GL_AlphaToCoverage function works on this renderpath and framebuffer
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
qbool vid_gammatables_trivial
this is set to true if all color control values are at default setting, and it therefore would make n...
unsigned int vid_gammatables_serial
so other subsystems can poll if gamma parameters have changed; this starts with 0 and gets increased ...
viddef_t vid
global video state
void VID_BuildGammaTables(unsigned short *ramps, int rampsize)
builds the current gamma tables into an array (needs 3*rampsize items)
size_t Mem_ExpandableArray_IndexRange(const memexpandablearray_t *l)
void Mem_ExpandableArray_NewArray(memexpandablearray_t *l, mempool_t *mempool, size_t recordsize, int numrecordsperarray)
void Mem_ExpandableArray_FreeRecord(memexpandablearray_t *l, void *record)
void * Mem_ExpandableArray_AllocRecord(memexpandablearray_t *l)
void * Mem_ExpandableArray_RecordAtIndex(const memexpandablearray_t *l, size_t index)
void Mem_ExpandableArray_FreeArray(memexpandablearray_t *l)
#define Mem_Alloc(pool, size)
#define Mem_strdup(pool, s)
#define Mem_AllocPool(name, flags, parent)