9typedef enum r_shadow_rendermode_e
25typedef enum r_shadow_shadowmode_e
45int r_shadow_drawbuffer;
46int r_shadow_readbuffer;
141cvar_t r_shadow_bumpscale_basetexture = {
CF_CLIENT,
"r_shadow_bumpscale_basetexture",
"0",
"generate fake bumpmaps from diffuse textures at this bumpyness, try 4 to match tenebrae, higher values increase depth, requires r_restart to take effect"};
144cvar_t r_shadow_deferred = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadow_deferred",
"0",
"uses image-based lighting instead of geometry-based lighting, the method used renders a depth image and a normalmap image, renders lights into separate diffuse and specular images, and then combines this into the normal rendering, requires r_shadow_shadowmapping"};
147cvar_t r_shadow_gloss = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadow_gloss",
"1",
"0 disables gloss (specularity) rendering, 1 uses gloss if textures are found, 2 forces a flat metallic specular effect on everything without textures (similar to tenebrae)"};
171cvar_t r_shadow_scissor = {
CF_CLIENT,
"r_shadow_scissor",
"1",
"use scissor optimization of light rendering (restricts rendering to the portion of the screen affected by the light)"};
178cvar_t r_shadow_shadowmapping_maxsize = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadow_shadowmapping_maxsize",
"512",
"limit of shadowmap side size - can not be more than 1/8th of atlassize because lights store 6 sides (2x3 grid) and sometimes 12 sides (4x3 grid for shadows from EF_NOSELFSHADOW entities) and there are multiple lights..."};
180cvar_t r_shadow_shadowmapping_precision = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadow_shadowmapping_precision",
"1",
"makes shadowmaps have a maximum resolution of this number of pixels per light source radius unit such that, for example, at precision 0.5 a light with radius 200 will have a maximum resolution of 100 pixels"};
198cvar_t r_shadow_bouncegrid = {
CF_CLIENT |
CF_ARCHIVE,
"r_shadow_bouncegrid",
"0",
"perform particle tracing for indirect lighting (Global Illumination / radiosity) using a 3D texture covering the scene, only active on levels with realtime lights active (r_shadow_realtime_world is usually required for these)"};
262#define ATTENTABLESIZE 256
264#define ATTEN1DSIZE 32
265#define ATTEN2DSIZE 64
266#define ATTEN3DSIZE 32
290#define EDLIGHTSPRSIZE 8
737 {0.5, 0.0, 0.0, 0.5},
738 {0.0, 0.5, 0.0, 0.5},
739 {0.0, 0.0, 0.5, 0.5},
747 {0.0, 0.0, 0.5, 0.5},
748 {0.0, 0.0, 0.0, 0.5},
749 {0.0, 0.0, 0.0, 0.5},
756 numvertices = ((numvertices + 255) & ~255) * vertscale;
757 numtriangles = ((numtriangles + 255) & ~255) * triscale;
778 int numleafpvsbytes = (((numleafs + 7) >> 3) + 255) & ~255;
779 int numsurfacepvsbytes = (((numsurfaces + 7) >> 3) + 255) & ~255;
780 int numshadowtrispvsbytes = (((numshadowtriangles + 7) >> 3) + 255) & ~255;
781 int numlighttrispvsbytes = (((numlighttriangles + 7) >> 3) + 255) & ~255;
869 float dp1 = p1[0] + p1[1], dn1 = p1[0] - p1[1], ap1 =
fabs(dp1), an1 =
fabs(dn1),
870 dp2 = p2[0] + p2[1], dn2 = p2[0] - p2[1], ap2 =
fabs(dp2), an2 =
fabs(dn2),
871 dp3 = p3[0] + p3[1], dn3 = p3[0] - p3[1], ap3 =
fabs(dp3), an3 =
fabs(dn3);
872 if(ap1 > bias*an1 && ap2 > bias*an2 && ap3 > bias*an3)
874 | (dp1 >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2))
875 | (dp2 >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2))
876 | (dp3 >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2));
877 if(an1 > bias*ap1 && an2 > bias*ap2 && an3 > bias*ap3)
879 | (dn1 >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2))
880 | (dn2 >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2))
881 | (dn3 >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2));
883 dp1 = p1[1] + p1[2], dn1 = p1[1] - p1[2], ap1 =
fabs(dp1), an1 =
fabs(dn1),
884 dp2 = p2[1] + p2[2], dn2 = p2[1] - p2[2], ap2 =
fabs(dp2), an2 =
fabs(dn2),
885 dp3 = p3[1] + p3[2], dn3 = p3[1] - p3[2], ap3 =
fabs(dp3), an3 =
fabs(dn3);
886 if(ap1 > bias*an1 && ap2 > bias*an2 && ap3 > bias*an3)
888 | (dp1 >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4))
889 | (dp2 >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4))
890 | (dp3 >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4));
891 if(an1 > bias*ap1 && an2 > bias*ap2 && an3 > bias*ap3)
893 | (dn1 >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4))
894 | (dn2 >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4))
895 | (dn3 >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4));
897 dp1 = p1[2] + p1[0], dn1 = p1[2] - p1[0], ap1 =
fabs(dp1), an1 =
fabs(dn1),
898 dp2 = p2[2] + p2[0], dn2 = p2[2] - p2[0], ap2 =
fabs(dp2), an2 =
fabs(dn2),
899 dp3 = p3[2] + p3[0], dn3 = p3[2] - p3[0], ap3 =
fabs(dp3), an3 =
fabs(dn3);
900 if(ap1 > bias*an1 && ap2 > bias*an2 && ap3 > bias*an3)
902 | (dp1 >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0))
903 | (dp2 >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0))
904 | (dp3 >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0));
905 if(an1 > bias*ap1 && an2 > bias*ap2 && an3 > bias*ap3)
907 | (dn1 >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0))
908 | (dn2 >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0))
909 | (dn3 >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0));
916 vec3_t center, radius, lightcenter, lightradius, pmin, pmax;
917 float dp1, dn1, ap1, an1, dp2, dn2, ap2, an2;
926 VectorAdd(lightcenter, lightradius, pmax);
928 dp1 = pmax[0] + pmax[1], dn1 = pmax[0] - pmin[1], ap1 =
fabs(dp1), an1 =
fabs(dn1),
929 dp2 = pmin[0] + pmin[1], dn2 = pmin[0] - pmax[1], ap2 =
fabs(dp2), an2 =
fabs(dn2);
930 if(ap1 > bias*an1 && ap2 > bias*an2)
932 | (dp1 >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2))
933 | (dp2 >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2));
934 if(an1 > bias*ap1 && an2 > bias*ap2)
936 | (dn1 >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2))
937 | (dn2 >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2));
939 dp1 = pmax[1] + pmax[2], dn1 = pmax[1] - pmin[2], ap1 =
fabs(dp1), an1 =
fabs(dn1),
940 dp2 = pmin[1] + pmin[2], dn2 = pmin[1] - pmax[2], ap2 =
fabs(dp2), an2 =
fabs(dn2);
941 if(ap1 > bias*an1 && ap2 > bias*an2)
943 | (dp1 >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4))
944 | (dp2 >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4));
945 if(an1 > bias*ap1 && an2 > bias*ap2)
947 | (dn1 >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4))
948 | (dn2 >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4));
950 dp1 = pmax[2] + pmax[0], dn1 = pmax[2] - pmin[0], ap1 =
fabs(dp1), an1 =
fabs(dn1),
951 dp2 = pmin[2] + pmin[0], dn2 = pmin[2] - pmax[0], ap2 =
fabs(dp2), an2 =
fabs(dn2);
952 if(ap1 > bias*an1 && ap2 > bias*an2)
954 | (dp1 >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0))
955 | (dp2 >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0));
956 if(an1 > bias*ap1 && an2 > bias*ap2)
958 | (dn1 >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0))
959 | (dn2 >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0));
964#define R_Shadow_CalcEntitySideMask(ent, worldtolight, radiustolight, bias) R_Shadow_CalcBBoxSideMask((ent)->mins, (ent)->maxs, worldtolight, radiustolight, bias)
970 float dxyp = p[0] + p[1], dxyn = p[0] - p[1], axyp =
fabs(dxyp), axyn =
fabs(dxyn);
971 float dyzp = p[1] + p[2], dyzn = p[1] - p[2], ayzp =
fabs(dyzp), ayzn =
fabs(dyzn);
972 float dzxp = p[2] + p[0], dzxn = p[2] - p[0], azxp =
fabs(dzxp), azxn =
fabs(dzxn);
974 if(axyp > bias*axyn + radius)
mask &= dxyp < 0 ? ~((1<<0)|(1<<2)) : ~((2<<0)|(2<<2));
975 if(axyn > bias*axyp + radius)
mask &= dxyn < 0 ? ~((1<<0)|(2<<2)) : ~((2<<0)|(1<<2));
976 if(ayzp > bias*ayzn + radius)
mask &= dyzp < 0 ? ~((1<<2)|(1<<4)) : ~((2<<2)|(2<<4));
977 if(ayzn > bias*ayzp + radius)
mask &= dyzn < 0 ? ~((1<<2)|(2<<4)) : ~((2<<2)|(1<<4));
978 if(azxp > bias*azxn + radius)
mask &= dzxp < 0 ? ~((1<<4)|(1<<0)) : ~((2<<4)|(2<<0));
979 if(azxn > bias*azxp + radius)
mask &= dzxn < 0 ? ~((1<<4)|(2<<0)) : ~((2<<4)|(1<<0));
987 int sides = 0x3F, masks[6] = { 3<<4, 3<<4, 3<<0, 3<<0, 3<<2, 3<<2 };
993 for (
i = 0;
i < 5;
i++)
999 if(
n[0]*
n[0] > len) sides &=
n[0] < 0 ? ~(1<<0) : ~(2 << 0);
1000 if(
n[1]*
n[1] > len) sides &=
n[1] < 0 ? ~(1<<2) : ~(2 << 2);
1001 if(
n[2]*
n[2] > len) sides &=
n[2] < 0 ? ~(1<<4) : ~(2 << 4);
1007 if(
n[0]*
n[0] > len) sides &=
n[0] >= 0 ? ~(1<<0) : ~(2 << 0);
1008 if(
n[1]*
n[1] > len) sides &=
n[1] >= 0 ? ~(1<<2) : ~(2 << 2);
1009 if(
n[2]*
n[2] > len) sides &=
n[2] >= 0 ? ~(1<<4) : ~(2 << 4);
1016 dp = p[0] + p[1], dn = p[0] - p[1], ap =
fabs(dp), an =
fabs(dn);
1017 masks[0] |= ap <= bias*an ? 0x3F : (dp >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2));
1018 masks[1] |= an <= bias*ap ? 0x3F : (dn >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2));
1019 dp = p[1] + p[2], dn = p[1] - p[2], ap =
fabs(dp), an =
fabs(dn);
1020 masks[2] |= ap <= bias*an ? 0x3F : (dp >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4));
1021 masks[3] |= an <= bias*ap ? 0x3F : (dn >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4));
1022 dp = p[2] + p[0], dn = p[2] - p[0], ap =
fabs(dp), an =
fabs(dn);
1023 masks[4] |= ap <= bias*an ? 0x3F : (dp >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0));
1024 masks[5] |= an <= bias*ap ? 0x3F : (dn >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0));
1025 for (
i = 0;
i < 4;
i++)
1029 dp =
n[0] +
n[1], dn =
n[0] -
n[1], ap =
fabs(dp), an =
fabs(dn);
1030 if(ap > 0) masks[0] |= dp >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2);
1031 if(an > 0) masks[1] |= dn >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2);
1032 dp =
n[1] +
n[2], dn =
n[1] -
n[2], ap =
fabs(dp), an =
fabs(dn);
1033 if(ap > 0) masks[2] |= dp >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4);
1034 if(an > 0) masks[3] |= dn >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4);
1035 dp =
n[2] +
n[0], dn =
n[2] -
n[0], ap =
fabs(dp), an =
fabs(dn);
1036 if(ap > 0) masks[4] |= dp >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0);
1037 if(an > 0) masks[5] |= dn >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0);
1041 for (
i = 0;
i < 5;
i++)
1044 dp = p[0] + p[1], dn = p[0] - p[1], ap =
fabs(dp), an =
fabs(dn);
1045 masks[0] |= ap <= bias*an ? 0x3F : (dp >= 0 ? (1<<0)|(1<<2) : (2<<0)|(2<<2));
1046 masks[1] |= an <= bias*ap ? 0x3F : (dn >= 0 ? (1<<0)|(2<<2) : (2<<0)|(1<<2));
1047 dp = p[1] + p[2], dn = p[1] - p[2], ap =
fabs(dp), an =
fabs(dn);
1048 masks[2] |= ap <= bias*an ? 0x3F : (dp >= 0 ? (1<<2)|(1<<4) : (2<<2)|(2<<4));
1049 masks[3] |= an <= bias*ap ? 0x3F : (dn >= 0 ? (1<<2)|(2<<4) : (2<<2)|(1<<4));
1050 dp = p[2] + p[0], dn = p[2] - p[0], ap =
fabs(dp), an =
fabs(dn);
1051 masks[4] |= ap <= bias*an ? 0x3F : (dp >= 0 ? (1<<4)|(1<<0) : (2<<4)|(2<<0));
1052 masks[5] |= an <= bias*ap ? 0x3F : (dn >= 0 ? (1<<4)|(2<<0) : (2<<4)|(1<<0));
1055 return sides & masks[0] & masks[1] & masks[2] & masks[3] & masks[4] & masks[5];
1058int R_Shadow_ChooseSidesFromBox(
int firsttriangle,
int numtris,
const float *invertex3f,
const int *elements,
const matrix4x4_t *worldtolight,
const vec3_t projectorigin,
const vec3_t projectdirection,
const vec3_t lightmins,
const vec3_t lightmaxs,
const vec3_t surfacemins,
const vec3_t surfacemaxs,
int *totals)
1066 int mask, surfacemask = 0;
1067 if (!
BoxesOverlap(lightmins, lightmaxs, surfacemins, surfacemaxs))
1070 tend = firsttriangle + numtris;
1071 if (
BoxInsideBox(surfacemins, surfacemaxs, lightmins, lightmaxs))
1074 if (projectdirection)
1076 for (t = firsttriangle, e = elements + t * 3;t < tend;t++, e += 3)
1078 v[0] = invertex3f + e[0] * 3,
v[1] = invertex3f + e[1] * 3,
v[2] = invertex3f + e[2] * 3;
1084 surfacemask |=
mask;
1087 totals[0] +=
mask&1, totals[1] += (
mask>>1)&1, totals[2] += (
mask>>2)&1, totals[3] += (
mask>>3)&1, totals[4] += (
mask>>4)&1, totals[5] +=
mask>>5;
1096 for (t = firsttriangle, e = elements + t * 3;t < tend;t++, e += 3)
1098 v[0] = invertex3f + e[0] * 3,
v[1] = invertex3f + e[1] * 3,
v[2] = invertex3f + e[2] * 3;
1103 surfacemask |=
mask;
1106 totals[0] +=
mask&1, totals[1] += (
mask>>1)&1, totals[2] += (
mask>>2)&1, totals[3] += (
mask>>3)&1, totals[4] += (
mask>>4)&1, totals[5] +=
mask>>5;
1117 if (projectdirection)
1119 for (t = firsttriangle, e = elements + t * 3;t < tend;t++, e += 3)
1121 v[0] = invertex3f + e[0] * 3,
v[1] = invertex3f + e[1] * 3,
v[2] = invertex3f + e[2] * 3;
1128 surfacemask |=
mask;
1131 totals[0] +=
mask&1, totals[1] += (
mask>>1)&1, totals[2] += (
mask>>2)&1, totals[3] += (
mask>>3)&1, totals[4] += (
mask>>4)&1, totals[5] +=
mask>>5;
1140 for (t = firsttriangle, e = elements + t * 3;t < tend;t++, e += 3)
1142 v[0] = invertex3f + e[0] * 3,
v[1] = invertex3f + e[1] * 3,
v[2] = invertex3f + e[2] * 3;
1148 surfacemask |=
mask;
1151 totals[0] +=
mask&1, totals[1] += (
mask>>1)&1, totals[2] += (
mask>>2)&1, totals[3] += (
mask>>3)&1, totals[4] += (
mask>>4)&1, totals[5] +=
mask>>5;
1162void R_Shadow_ShadowMapFromList(
int numverts,
int numtris,
const float *vertex3f,
const int *elements,
int numsidetris,
const int *sidetotals,
const unsigned char *sides,
const int *sidetris)
1164 int i, j, outtriangles = 0;
1165 int *outelement3i[6];
1168 outtriangles = sidetotals[0] + sidetotals[1] + sidetotals[2] + sidetotals[3] + sidetotals[4] + sidetotals[5];
1175 for (
i = 0;
i < 6;
i++)
1180 outtriangles += sidetotals[
i];
1184 for (
i = 0;
i < numsidetris;
i++)
1186 const int *element = elements + sidetris[
i] * 3;
1187 for (j = 0;j < 6;j++)
1189 if (sides[
i] & (1 << j))
1191 outelement3i[j][0] = element[0];
1192 outelement3i[j][1] = element[1];
1193 outelement3i[j][2] = element[2];
1194 outelement3i[j] += 3;
1206 unsigned char pixels[32][32][4];
1207 for (
y = 0;
y < 32;
y++)
1209 dy = (
y - 15.5f) * (1.0f / 16.0f);
1210 for (
x = 0;
x < 32;
x++)
1212 dx = (
x - 15.5f) * (1.0f / 16.0f);
1213 a = (
int)(((1.0f / (dx * dx + dy * dy + 0.2f)) - (1.0f / (1.0f + 0.2))) * 32.0f / (1.0f / (1.0f + 0.2)));
1229 return bound(0, (
unsigned int)(
intensity * 256.0f), 255) * 0x01010101U;
1397 r_shadow_drawbuffer = drawbuffer;
1398 r_shadow_readbuffer = readbuffer;
1444 unsigned char data[4*6] =
1483 float clearcolor[4];
1506 R_Viewport_InitOrtho(&viewport, &
identitymatrix, 0, 0,
r_shadow_shadowmaptexturesize,
r_shadow_shadowmaptexturesize, 0, 0, 1.0, 1.0, 0.001f, 1.0f,
NULL);
1531 float farclip = 1.0f;
1551 float nearclip, farclip;
1577 flipped = (side & 1) ^ (side >> 2);
1645 float vertex3f[8*3];
1661 for (
i = 0;
i < 8;
i++)
1688 for (lightindex = 0;lightindex < range;lightindex++)
1691 if (!light || !(light->
flags & flag))
1695 if (rtlight->
style > 0)
1716 memset(settings, 0,
sizeof(*settings));
1733 settings->
spacing[0] = spacing;
1734 settings->
spacing[1] = spacing;
1735 settings->
spacing[2] = spacing;
1765 spacing[0] = settings->
spacing[0];
1766 spacing[1] = settings->
spacing[1];
1767 spacing[2] = settings->
spacing[2];
1768 ispacing[0] = 1.0f / spacing[0];
1769 ispacing[1] = 1.0f / spacing[1];
1770 ispacing[2] = 1.0f / spacing[2];
1777 qbool bounds_set =
false;
1784 for (lightindex = 0;lightindex < range;lightindex++)
1786 const vec_t *rtlmins, *rtlmaxs;
1838 size[0] = spacing[0] * resolution[0];
1839 size[1] = spacing[1] * resolution[1];
1840 size[2] = spacing[2] * resolution[2];
1854 size[0] = spacing[0] * resolution[0];
1855 size[1] = spacing[1] * resolution[1];
1856 size[2] = spacing[2] * resolution[2];
1891 memset(m, 0,
sizeof(m));
1906 int skipsupercontentsmask = 0;
1930 unsigned int range2 = range + range1;
1933 float normalphotonscaling;
1934 float photonscaling;
1935 float photonintensity;
1936 float photoncount = 0.0f;
1937 float lightintensity;
1943 unsigned int lightindex;
1948 float bounceminimumintensity2;
1949 float startrefractiveindex;
1955 for (lightindex = 0;lightindex < range2;lightindex++)
1957 if (lightindex < range)
1968 if (!(light->
flags & flag))
2038 if (lightindex >= range)
2052 photonscaling = 1.0f;
2053 photonintensity = 1.0f;
2057 photonintensity = 1.0f / photonscaling;
2061 for (lightindex = 0; lightindex < range2; lightindex++)
2063 if (lightindex < range)
2080 for (lightindex = 0; lightindex < range2; lightindex++)
2082 if (lightindex < range)
2096 if (!shootparticles)
2174 float color[32] = { 0 };
2176 float iradius = 1.0f / radius;
2177 int slicemins[3], slicemaxs[3];
2183 float isamples = 1.0f /
samples;
2184 float samplescolorscale = isamples * isamples * isamples;
2193 for (pathindex = 0; pathindex < photon->
numpaths; pathindex++)
2196 float pathstart[3], pathend[3], pathmins[3], pathmaxs[3], pathdelta[3], pathdir[3], pathlength2, pathilength;
2201 pathmins[2] =
min(pathstart[2], pathend[2]);
2203 pathmaxs[2] =
max(pathstart[2], pathend[2]);
2207 if (zi < slicemins[2] || zi >= slicemaxs[2])
2210 pathmins[0] =
min(pathstart[0], pathend[0]);
2212 slicemins[0] =
max(slicemins[0], 1);
2213 pathmaxs[0] =
max(pathstart[0], pathend[0]);
2215 slicemaxs[0] =
min(slicemaxs[0], resolution[0] - 1);
2217 pathmins[1] =
min(pathstart[1], pathend[1]);
2219 slicemins[1] =
max(slicemins[1], 1);
2220 pathmaxs[1] =
max(pathstart[1], pathend[1]);
2222 slicemaxs[1] =
min(slicemaxs[1], resolution[1] - 1);
2225 if (slicemins[0] >= slicemaxs[0] || slicemins[1] >= slicemaxs[1])
2232 pathilength = pathlength2 > 0.0f ? 1.0f /
sqrt(pathlength2) : 0.0f;
2235 color[0] = path->
color[0] * samplescolorscale;
2236 color[1] = path->
color[1] * samplescolorscale;
2237 color[2] = path->
color[2] * samplescolorscale;
2278 for (yi = slicemins[1]; yi < slicemaxs[1]; yi++)
2280 for (xi = slicemins[0]; xi < slicemaxs[0]; xi++)
2282 float sample[3], diff[3], nearest[3], along, distance2;
2283 float *p = highpixels + 4 * ((zi * resolution[1] + yi) * resolution[0] + xi);
2286 for (zs = 0; zs <
samples; zs++)
2289 for (ys = 0; ys <
samples; ys++)
2292 for (xs = 0; xs <
samples; xs++)
2297 along =
DotProduct(sample, pathdir) * pathilength;
2300 else if (along >= 1)
2303 VectorLerp(pathstart, along, pathend, nearest);
2307 if (distance2 < 1.0f)
2310 float w = 1.0f -
sqrt(distance2);
2316 p[pixelsperband * 4 + 3] +=
color[7] *
w;
2318 for (band = 0; band < pixelbands; band++)
2321 p[band * pixelsperband * 4 + 0] +=
color[band * 4 + 0] *
w;
2322 p[band * pixelsperband * 4 + 1] +=
color[band * 4 + 1] *
w;
2323 p[band * pixelsperband * 4 + 2] +=
color[band * 4 + 2] *
w;
2351 for (
i = 0;
i < slices;
i++)
2361 const float *inpixel;
2366 unsigned int x,
y,
z;
2367 unsigned int resolution[3];
2369 for (pixelband = 0;pixelband < pixelbands;pixelband++)
2371 for (
z = 1;
z < resolution[2]-1;
z++)
2373 for (
y = 1;
y < resolution[1]-1;
y++)
2376 index = ((pixelband*resolution[2]+
z)*resolution[1]+
y)*resolution[0]+
x;
2377 inpixel = inpixels + 4*
index;
2378 outpixel = outpixels + 4*
index;
2379 for (;
x < resolution[0]-1;
x++, inpixel += 4, outpixel += 4)
2381 outpixel[0] = (inpixel[0] + inpixel[ off] + inpixel[0-off]) * (1.0f / 3.0);
2382 outpixel[1] = (inpixel[1] + inpixel[1+off] + inpixel[1-off]) * (1.0f / 3.0);
2383 outpixel[2] = (inpixel[2] + inpixel[2+off] + inpixel[2-off]) * (1.0f / 3.0);
2384 outpixel[3] = (inpixel[3] + inpixel[3+off] + inpixel[3-off]) * (1.0f / 3.0);
2394 unsigned int resolution[3];
2421 unsigned char *pixelsbgra8 =
NULL;
2422 unsigned char *pixelbgra8;
2423 unsigned short *pixelsrgba16f =
NULL;
2424 unsigned short *pixelrgba16f;
2425 float *pixelsrgba32f =
NULL;
2431 unsigned int pixelband;
2432 unsigned int x,
y,
z;
2433 unsigned int index, bandindex;
2434 unsigned int resolution[3];
2448 for (
z = 0;
z < resolution[2]-1;
z++)
2450 for (
y = 0;
y < resolution[1]-1;
y++)
2453 index = ((pixelband*resolution[2]+
z)*resolution[1]+
y)*resolution[0]+
x;
2454 highpixel = highpixels + 4*
index;
2455 for (;
x < resolution[0]-1;
x++,
index++, highpixel += 4)
2458 if (highpixel[3] != 0.0f)
2460 VectorSet(highpixel, highpixel[0] * 0.5f + 0.5f, highpixel[1] * 0.5f + 0.5f, highpixel[2] * 0.5f + 0.5f);
2461 highpixel[pixelsperband * 4 + 3] = 1.0f;
2471 switch (floatcolors)
2477 for (pixelband = 0;pixelband < pixelbands;pixelband++)
2484 for (
z = 1;
z < resolution[2]-1;
z++)
2486 for (
y = 1;
y < resolution[1]-1;
y++)
2490 index = ((pixelband*resolution[2]+
z)*resolution[1]+
y)*resolution[0]+
x;
2491 highpixel = highpixels + 4*
index;
2492 for (;
x < resolution[0]-1;
x++,
index++, highpixel += 4)
2501 highpixel[pixelsperband * 4 + 3] = 1.0f;
2504 for (pixelband = 0, bandindex =
index;pixelband < pixelbands;pixelband++, bandindex += pixelsperband)
2506 pixelbgra8 = pixelsbgra8 + 4*bandindex;
2507 bandpixel = highpixels + 4*bandindex;
2508 c[0] = (
int)(bandpixel[0]*256.0f);
2509 c[1] = (
int)(bandpixel[1]*256.0f);
2510 c[2] = (
int)(bandpixel[2]*256.0f);
2511 c[3] = (
int)(bandpixel[3]*256.0f);
2512 pixelbgra8[2] = (
unsigned char)
bound(0, c[0], 255);
2513 pixelbgra8[1] = (
unsigned char)
bound(0, c[1], 255);
2514 pixelbgra8[0] = (
unsigned char)
bound(0, c[2], 255);
2515 pixelbgra8[3] = (
unsigned char)
bound(0, c[3], 255);
2532 for (
z = 1;
z < resolution[2]-1;
z++)
2534 for (
y = 1;
y < resolution[1]-1;
y++)
2538 index = ((pixelband*resolution[2]+
z)*resolution[1]+
y)*resolution[0]+
x;
2539 highpixel = highpixels + 4*
index;
2540 for (;
x < resolution[0]-1;
x++,
index++, highpixel += 4)
2546 for (pixelband = 0, bandindex =
index;pixelband < pixelbands;pixelband++, bandindex += pixelsperband)
2551 unsigned int raw[4];
2553 pixelrgba16f = pixelsrgba16f + 4*bandindex;
2554 bandpixel = highpixels + 4*bandindex;
2563 pixelrgba16f[0] = (
unsigned short)((c[0] < 0x38000000) ? 0 : ((c[0] - 0x38000000) >> 13));
2564 pixelrgba16f[1] = (
unsigned short)((c[1] < 0x38000000) ? 0 : ((c[1] - 0x38000000) >> 13));
2565 pixelrgba16f[2] = (
unsigned short)((c[2] < 0x38000000) ? 0 : ((c[2] - 0x38000000) >> 13));
2566 pixelrgba16f[3] = (
unsigned short)((c[3] < 0x38000000) ? 0 : ((c[3] - 0x38000000) >> 13));
2580 pixelsrgba32f = highpixels;
2600 int hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask;
2603 vec3_t reflectstart, reflectend, reflectcolor;
2606 float reflectamount = 1.0f;
2610 skipsupercontentsmask = 0;
2618 cliptrace =
CL_TraceLine(shotstart, shotend,
r_shadow_bouncegrid_state.
settings.
staticmode ?
MOVE_WORLDONLY : (
r_shadow_bouncegrid_state.
settings.
hitmodels ?
MOVE_HITMODEL :
MOVE_NOMONSTERS),
NULL, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask,
collision_extendmovelength.
value,
true,
false,
NULL,
true,
true);
2628 qbool notculled =
true;
2633 vec3_t cullmins, cullmaxs;
2651 if (cliptrace.
fraction < 1.0f && remainingbounces > 0)
2656 VectorSet(reflectcolor, 0.5f, 0.5f, 0.5f);
2665 reflectamount *= cliptrace.
hittexture->currentalpha;
2667 reflectamount *= cliptrace.
hittexture->currentskinframe->avgcolor[3];
2684 reflectcolor[0] =
min(reflectcolor[0], 1.0f);
2685 reflectcolor[1] =
min(reflectcolor[1], 1.0f);
2686 reflectcolor[2] =
min(reflectcolor[2], 1.0f);
2704 VectorAdd(reflectstart, reflectend, reflectend);
2711 float refractiveindex;
2716 s = refractiveindex / previousrefractiveindex;
2717 VectorReflect(refractend, -1.0f / s, surfacenormal, refractend);
2721 VectorAdd(refractstart, refractend, refractend);
2759 qbool enable =
false;
2760 qbool settingschanged;
2772 if (settingschanged || !enable)
2939 float ambientcolor[3], diffusecolor[3], specularcolor[3];
2945 VectorMAM(1.0f, ambientcolor, 1.0f, diffusecolor, ambientcolor);
2980void R_RTLight_Update(
rtlight_t *rtlight,
int isstatic,
matrix4x4_t *matrix,
vec3_t color,
int style,
const char *cubemapname,
int shadow,
vec_t corona,
vec_t coronasizescale,
vec_t ambientscale,
vec_t diffusescale,
vec_t specularscale,
int flags)
2989 memset(rtlight, 0,
sizeof(*rtlight));
2998 if (cubemapname && cubemapname[0])
3000 rtlight->
shadow = shadow;
3001 rtlight->
corona = corona;
3026 int numsurfaces, numleafs, numleafpvsbytes, numshadowtrispvsbytes, numlighttrispvsbytes;
3027 int lighttris, shadowtris;
3030 unsigned char *
data;
3054 model->GetLightInfo(ent, rtlight->
shadoworigin, rtlight->
radius, rtlight->
cullmins, rtlight->
cullmaxs,
r_shadow_buffer_leaflist,
r_shadow_buffer_leafpvs, &numleafs,
r_shadow_buffer_surfacelist,
r_shadow_buffer_surfacepvs, &numsurfaces,
r_shadow_buffer_shadowtrispvs,
r_shadow_buffer_lighttrispvs,
r_shadow_buffer_visitingleafpvs, 0,
NULL, rtlight->
shadow == 0);
3056 numleafpvsbytes = (
model->brush.num_leafs + 7) >> 3;
3057 numshadowtrispvsbytes = (
model->surfmesh.num_triangles + 7) >> 3;
3058 numlighttrispvsbytes = (
model->surfmesh.num_triangles + 7) >> 3;
3059 data = (
unsigned char *)
Mem_Alloc(
r_main_mempool,
sizeof(
int) * numsurfaces +
sizeof(
int) * numleafs + numleafpvsbytes + numshadowtrispvsbytes + numlighttrispvsbytes);
3106 Con_DPrintf(
"static light built: %f %f %f : %f %f %f box, %i light triangles, %i shadow triangles\n", rtlight->
cullmins[0], rtlight->
cullmins[1], rtlight->
cullmins[2], rtlight->
cullmaxs[0], rtlight->
cullmaxs[1], rtlight->
cullmaxs[2], lighttris, shadowtris);
3138 for (lightindex = 0;lightindex < range;lightindex++)
3163 for (
i = 0;
i < 4;
i++)
3167 for (
i = 0;
i < 4;
i++)
3183 for (
i = 0;
i < 4;
i++)
3198 for (
i = 0;
i < 4;
i++)
3206 for (j = 0;j < 4;j++)
3214 for (j = 0;j < 4;j++)
3241 Con_Printf(
"light %p plane #%i %f %f %f : %f (%f %f %f %f %f)\n", rtlight,
i, plane.
normal[0], plane.
normal[1], plane.
normal[2], plane.
dist,
PlaneDiff(
r_refdef.
view.
frustumcorner[0], &plane),
PlaneDiff(
r_refdef.
view.
frustumcorner[1], &plane),
PlaneDiff(
r_refdef.
view.
frustumcorner[2], &plane),
PlaneDiff(
r_refdef.
view.
frustumcorner[3], &plane),
PlaneDiff(rtlight->
shadoworigin, &plane));
3251 for (
i = 0;
i < 6;
i++)
3255 v[
i >> 1] = (
i & 1) ? -1 : 1;
3267 for (
i = 0;
i < 6;
i++)
3270 plane.
normal[
i >> 1] = (
i & 1) ? -1 : 1;
3293 for (j = 0;j < oldnum;j++)
3297 for (
i = 1;
i < 8;
i++)
3300 if (bestdist > dist)
3341 vec3_t relativeshadoworigin, relativeshadowmins, relativeshadowmaxs;
3342 vec_t relativeshadowradius;
3347 relativeshadowmins[0] = relativeshadoworigin[0] - relativeshadowradius;
3348 relativeshadowmins[1] = relativeshadoworigin[1] - relativeshadowradius;
3349 relativeshadowmins[2] = relativeshadoworigin[2] - relativeshadowradius;
3350 relativeshadowmaxs[0] = relativeshadoworigin[0] + relativeshadowradius;
3351 relativeshadowmaxs[1] = relativeshadoworigin[1] + relativeshadowradius;
3352 relativeshadowmaxs[2] = relativeshadoworigin[2] + relativeshadowradius;
3387 if (!
model->DrawLight)
3392 model->DrawLight(ent,
model->submodelsurfaces_end -
model->submodelsurfaces_start,
model->modelsurfaces_sorted +
model->submodelsurfaces_start,
NULL);
3401 int numleafs, numsurfaces;
3402 int *leaflist, *surfacelist;
3403 unsigned char *leafpvs;
3404 unsigned char *shadowtrispvs;
3405 unsigned char *lighttrispvs;
3407 int numlightentities;
3408 int numlightentities_noselfshadow;
3409 int numshadowentities;
3410 int numshadowentities_noselfshadow;
3419 rtlight->
draw =
false;
3514 r_refdef.
scene.
worldmodel->
GetLightInfo(
r_refdef.
scene.
worldentity, rtlight->
shadoworigin, rtlight->
radius, rtlight->
cached_cullmins, rtlight->
cached_cullmaxs,
r_shadow_buffer_leaflist,
r_shadow_buffer_leafpvs, &numleafs,
r_shadow_buffer_surfacelist,
r_shadow_buffer_surfacepvs, &numsurfaces,
r_shadow_buffer_shadowtrispvs,
r_shadow_buffer_lighttrispvs,
r_shadow_buffer_visitingleafpvs, rtlight->
cached_numfrustumplanes, rtlight->
cached_frustumplanes, rtlight->
shadow == 0);
3535 shadowtrispvs =
NULL;
3536 lighttrispvs =
NULL;
3541 for (
i = 0;
i < numleafs;
i++)
3549 numlightentities = 0;
3550 numlightentities_noselfshadow = 0;
3551 numshadowentities = 0;
3552 numshadowentities_noselfshadow = 0;
3577 lightentities_noselfshadow[numlightentities_noselfshadow++] = ent;
3579 lightentities[numlightentities++] = ent;
3592 shadowentities_noselfshadow[numshadowentities_noselfshadow++] = ent;
3594 shadowentities[numshadowentities++] = ent;
3610 shadowentities_noselfshadow[numshadowentities_noselfshadow++] = ent;
3612 shadowentities[numshadowentities++] = ent;
3618 if (numsurfaces + numlightentities + numlightentities_noselfshadow == 0)
3625 rtlight->
draw =
true;
3630 numshadowentities = numshadowentities_noselfshadow = 0;
3634 for (
i = 0;
i < numshadowentities;
i++)
3636 for (
i = 0;
i < numshadowentities_noselfshadow;
i++)
3642 for (
i = 0;
i < numshadowentities_noselfshadow;
i++)
3643 shadowentities[numshadowentities++] = shadowentities_noselfshadow[
i];
3644 numshadowentities_noselfshadow = 0;
3648 if (numlightentities_noselfshadow > 0 && numshadowentities_noselfshadow == 0)
3650 for (
i = 0;
i < numlightentities_noselfshadow;
i++)
3651 lightentities[numlightentities++] = lightentities_noselfshadow[
i];
3652 numlightentities_noselfshadow = 0;
3704 unsigned char *shadowtrispvs, *surfacesides;
3705 int numlightentities;
3706 int numlightentities_noselfshadow;
3707 int numshadowentities;
3708 int numshadowentities_noselfshadow;
3714 static unsigned char entitysides[
MAX_EDICTS];
3715 static unsigned char entitysides_noselfshadow[
MAX_EDICTS];
3759 surfacesides =
NULL;
3772 for (
i = 0;
i < numsurfaces;
i++)
3776 castermask |= surfacesides[
i];
3777 receivermask |= surfacesides[
i];
3782 for (
i = 0;
i < numlightentities && receivermask < 0x3F;
i++)
3784 for (
i = 0;
i < numlightentities_noselfshadow && receivermask < 0x3F;
i++)
3791 for (
i = 0;
i < numshadowentities;
i++)
3793 for (
i = 0;
i < numshadowentities_noselfshadow;
i++)
3798 castermask &= receivermask;
3803 for (side = 0; side < 6; side++)
3805 int bit = 1 << side;
3806 if (castermask & bit)
3811 for (
i = 0;
i < numshadowentities;
i++)
3812 if (entitysides[
i] & bit)
3814 for (
i = 0;
i < numshadowentities_noselfshadow;
i++)
3815 if (entitysides_noselfshadow[
i] & bit)
3820 if (numshadowentities_noselfshadow)
3822 for (side = 0; side < 6; side++)
3824 int bit = 1 << side;
3825 if (castermask & bit)
3830 for (
i = 0;
i < numshadowentities;
i++)
3831 if (entitysides[
i] & bit)
3842 unsigned char *lighttrispvs;
3843 int numlightentities;
3844 int numlightentities_noselfshadow;
3877 for (
i = 0;
i < numlightentities;
i++)
3879 for (
i = 0;
i < numlightentities_noselfshadow;
i++)
3892 if (numsurfaces + numlightentities)
3898 for (
i = 0;
i < numlightentities;
i++)
3902 if (numlightentities_noselfshadow)
3905 for (
i = 0;
i < numlightentities_noselfshadow;
i++)
3919 for (
i = 0;
i < numlightentities;
i++)
3921 for (
i = 0;
i < numlightentities_noselfshadow;
i++)
3963 float clearcolor[4];
4015#define MAX_SCENELIGHTS 65536
4114 for (lightindex = 0; lightindex < range; lightindex++)
4117 if (light && (light->
flags & flag))
4163 int packing_success = 0;
4164 int packing_failure = 0;
4195 if (packing_failure == 0)
4238#define MAX_MODELSHADOWS 1024
4247 vec3_t shadowdir, shadowforward, shadowright, shadoworigin, shadowfocus, shadowmins, shadowmaxs;
4277 if (shadowfocus[0] || shadowfocus[1] || shadowfocus[2])
4279 VectorMA(shadoworigin, (1.0f -
fabs(dot1)) * radius, shadowforward, shadoworigin);
4314 float relativethrowdistance,
scale,
size, radius, nearclip, farclip, bias, dot1, dot2;
4316 vec3_t relativelightorigin;
4317 vec3_t relativelightdirection, relativeforward, relativeright;
4318 vec3_t relativeshadowmins, relativeshadowmaxs;
4319 vec3_t shadowdir, shadowforward, shadowright, shadoworigin, shadowfocus;
4322 matrix4x4_t shadowmatrix, cameramatrix, mvpmatrix, invmvpmatrix, scalematrix, texmatrix;
4327 radius = 0.5f /
scale;
4360 if (shadowfocus[0] || shadowfocus[1] || shadowfocus[2])
4365 m[7] = 0.5f -
DotProduct(shadoworigin, &m[4]);
4366 VectorM(1.0f / (farclip - nearclip), shadowdir, &m[8]);
4367 m[11] = 0.5f -
DotProduct(shadoworigin, &m[8]);
4370 R_Viewport_InitOrtho(&viewport, &cameramatrix,
r_shadow_shadowmapatlas_modelshadows_x,
r_shadow_shadowmapatlas_modelshadows_y,
r_shadow_shadowmapatlas_modelshadows_size,
r_shadow_shadowmapatlas_modelshadows_size, 0, 0, 1, 1, 0, -1,
NULL);
4373 VectorMA(shadoworigin, (1.0f -
fabs(dot1)) * radius, shadowforward, shadoworigin);
4472 unsigned int occlude = 0;
4485#define BUFFER_OFFSET(i) ((GLint *)((unsigned char*)NULL + (i)))
4521 RSurf_ActiveCustomEntity(&
identitymatrix, &
identitymatrix,
RENDER_NODEPTHTEST, 0,
color[0],
color[1],
color[2], 1, 4, vertex3f,
spritetexcoord2f,
NULL,
NULL,
NULL,
NULL, 2,
polygonelement3i,
polygonelement3s,
false,
false);
4531 qbool usequery =
false;
4580 for (lightindex = 0;lightindex < range;lightindex++)
4589 if (!(rtlight->
flags & flag))
4591 if (rtlight->
corona <= 0)
4603 if (!(rtlight->
flags & flag))
4605 if (rtlight->
corona <= 0)
4613 for (lightindex = 0;lightindex < range;lightindex++)
4639static void R_Shadow_UpdateWorldLight(
dlight_t *light,
vec3_t origin,
vec3_t angles,
vec3_t color,
vec_t radius,
vec_t corona,
int style,
int shadowenable,
const char *cubemapname,
vec_t coronasizescale,
vec_t ambientscale,
vec_t diffusescale,
vec_t specularscale,
int flags)
4664 light->
shadow = shadowenable;
4675 R_RTLight_Update(&light->
rtlight,
true, &matrix, light->
color, light->
style, light->
cubemapname[0] ? light->
cubemapname :
NULL, light->
shadow, light->
corona, light->
coronasizescale, light->
ambientscale, light->
diffusescale, light->
specularscale, light->
flags);
4691 for (lightindex = 0;lightindex < range;lightindex++)
4714 RSurf_ActiveCustomEntity(&
identitymatrix, &
identitymatrix, 0, 0, 1, 1, 1, 1, 4, vertex3f,
spritetexcoord2f,
NULL,
NULL,
NULL,
NULL, 2,
polygonelement3i,
polygonelement3s,
false,
false);
4736 VectorSet(spritecolor, 0.1f, 0.1f, 0.1f);
4750 RSurf_ActiveCustomEntity(&
identitymatrix, &
identitymatrix, 0, 0, spritecolor[0], spritecolor[1], spritecolor[2], 1, 4, vertex3f,
spritetexcoord2f,
NULL,
NULL,
NULL,
NULL, 2,
polygonelement3i,
polygonelement3s,
false,
false);
4756 RSurf_ActiveCustomEntity(&
identitymatrix, &
identitymatrix, 0, 0, 1, 1, 1, 1, 4, vertex3f,
spritetexcoord2f,
NULL,
NULL,
NULL,
NULL, 2,
polygonelement3i,
polygonelement3s,
false,
false);
4767 for (lightindex = 0;lightindex < range;lightindex++)
4783 if (lightindex >= range)
4792 *radius = rtlight->
radius;
4799 float bestrating, rating, temp[3];
4809 for (lightindex = 0;lightindex < range;lightindex++)
4819 if (bestrating < rating &&
CL_TraceLine(light->
origin,
r_refdef.
view.
origin,
MOVE_NORMAL,
NULL,
SUPERCONTENTS_SOLID, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.
value,
true,
false,
NULL,
false,
true).
fraction == 1.0f)
4821 bestrating = rating;
4833 float origin[3], radius,
color[3],
angles[3], corona, coronasizescale, ambientscale, diffusescale, specularscale;
4864 while (*s && *s !=
'\n' && *s !=
'\r')
4878#define sscanf sscanf_s
4880 cubemapname[
sizeof(cubemapname)-1] = 0;
4882#error update this code if MAX_QPATH changes
4884 a = sscanf(t,
"%f %f %f %f %f %f %f %d %127s %f %f %f %f %f %f %f %f %i", &
origin[0], &
origin[1], &
origin[2], &radius, &
color[0], &
color[1], &
color[2], &
style, cubemapname
4886, (
unsigned int)
sizeof(cubemapname)
4888, &corona, &
angles[0], &
angles[1], &
angles[2], &coronasizescale, &ambientscale, &diffusescale, &specularscale, &
flags);
4899 coronasizescale = 0.25f;
4904 if (
a < 9 || !strcmp(cubemapname,
"\"\""))
4907 if (cubemapname[0] ==
'"' && cubemapname[
strlen(cubemapname) - 1] ==
'"')
4910 namelen =
strlen(cubemapname) - 2;
4911 memmove(cubemapname, cubemapname + 1, namelen);
4912 cubemapname[namelen] =
'\0';
4916 Con_Printf(
"found %d parameters on line %i, should be 8 or more parameters (origin[0] origin[1] origin[2] radius color[0] color[1] color[2] style \"cubemapname\" corona angles[0] angles[1] angles[2] coronasizescale ambientscale diffusescale specularscale flags)\n",
a,
n + 1);
4919 R_Shadow_UpdateWorldLight(
R_Shadow_NewWorldLight(),
origin,
angles,
color, radius, corona,
style, shadow, cubemapname, coronasizescale, ambientscale, diffusescale, specularscale,
flags);
4936 size_t bufchars, bufmaxchars;
4950 bufchars = bufmaxchars = 0;
4952 for (lightindex = 0;lightindex < range;lightindex++)
4958 dpsnprintf(line,
sizeof(line),
"%s%f %f %f %f %f %f %f %d \"%s\" %f %f %f %f %f %f %f %f %i\n", light->
shadow ?
"" :
"!", light->
origin[0], light->
origin[1], light->
origin[2], light->
radius, light->
color[0], light->
color[1], light->
color[2], light->
style, light->
cubemapname, light->
corona, light->
angles[0], light->
angles[1], light->
angles[2], light->
coronasizescale, light->
ambientscale, light->
diffusescale, light->
specularscale, light->
flags);
4960 dpsnprintf(line,
sizeof(line),
"%s%f %f %f %f %f %f %f %d \"%s\" %f %f %f %f\n", light->
shadow ?
"" :
"!", light->
origin[0], light->
origin[1], light->
origin[2], light->
radius, light->
color[0], light->
color[1], light->
color[2], light->
style, light->
cubemapname, light->
corona, light->
angles[0], light->
angles[1], light->
angles[2]);
4962 dpsnprintf(line,
sizeof(line),
"%s%f %f %f %f %f %f %f %d\n", light->
shadow ?
"" :
"!", light->
origin[0], light->
origin[1], light->
origin[2], light->
radius, light->
color[0], light->
color[1], light->
color[2], light->
style);
4963 if (bufchars +
strlen(line) > bufmaxchars)
4965 bufmaxchars = bufchars +
strlen(line) + 2048;
4971 memcpy(
buf, oldbuf, bufchars);
4977 memcpy(
buf + bufchars, line,
strlen(line));
4978 bufchars +=
strlen(line);
4991 float origin[3], radius,
color[3], subtract, spotdir[3], spotcone, falloff, distbias;
5006 while (*s && *s !=
'\n' && *s !=
'\r')
5012 a = sscanf(t,
"%f %f %f %f %f %f %f %f %f %f %f %f %f %d", &
origin[0], &
origin[1], &
origin[2], &falloff, &
color[0], &
color[1], &
color[2], &subtract, &spotdir[0], &spotdir[1], &spotdir[2], &spotcone, &distbias, &
style);
5016 Con_Printf(
"invalid lights file, found %d parameters on line %i, should be 14 parameters (origin[0] origin[1] origin[2] falloff light[0] light[1] light[2] subtract spotdir[0] spotdir[1] spotdir[2] spotcone distancebias style)\n",
a,
n + 1);
5020 radius =
bound(15, radius, 4096);
5022 R_Shadow_UpdateWorldLight(
R_Shadow_NewWorldLight(),
origin,
vec3_origin,
color, radius, 0,
style,
true,
NULL, 0.25, 0, 1, 1,
LIGHTFLAG_REALTIMEMODE);
5050 float origin[3],
angles[3], radius,
color[3], light[4], fadescale, lightscale, originhack[3], overridecolor[3], vec[4];
5071 originhack[0] = originhack[1] = originhack[2] = 0;
5074 light[0] = light[1] = light[2] = 1;light[3] = 300;
5075 overridecolor[0] = overridecolor[1] = overridecolor[2] = 1;
5093 while (key[
strlen(key)-1] ==
' ')
5100 if (!strcmp(
"light", key))
5102 n = sscanf(
value,
"%f %f %f %f", &vec[0], &vec[1], &vec[2], &vec[3]);
5106 light[0] = vec[0] * (1.0f / 256.0f);
5107 light[1] = vec[0] * (1.0f / 256.0f);
5108 light[2] = vec[0] * (1.0f / 256.0f);
5114 light[0] = vec[0] * (1.0f / 255.0f);
5115 light[1] = vec[1] * (1.0f / 255.0f);
5116 light[2] = vec[2] * (1.0f / 255.0f);
5120 else if (!strcmp(
"delay", key))
5122 else if (!strcmp(
"origin", key))
5124 else if (!strcmp(
"angle", key))
5126 else if (!strcmp(
"angles", key))
5128 else if (!strcmp(
"color", key))
5130 else if (!strcmp(
"wait", key))
5131 fadescale = atof(
value);
5132 else if (!strcmp(
"classname", key))
5134 if (!strncmp(
value,
"light", 5))
5137 if (!strcmp(
value,
"light_fluoro"))
5142 overridecolor[0] = 1;
5143 overridecolor[1] = 1;
5144 overridecolor[2] = 1;
5146 if (!strcmp(
value,
"light_fluorospark"))
5151 overridecolor[0] = 1;
5152 overridecolor[1] = 1;
5153 overridecolor[2] = 1;
5155 if (!strcmp(
value,
"light_globe"))
5160 overridecolor[0] = 1;
5161 overridecolor[1] = 0.8;
5162 overridecolor[2] = 0.4;
5164 if (!strcmp(
value,
"light_flame_large_yellow"))
5169 overridecolor[0] = 1;
5170 overridecolor[1] = 0.5;
5171 overridecolor[2] = 0.1;
5173 if (!strcmp(
value,
"light_flame_small_yellow"))
5178 overridecolor[0] = 1;
5179 overridecolor[1] = 0.5;
5180 overridecolor[2] = 0.1;
5182 if (!strcmp(
value,
"light_torch_small_white"))
5187 overridecolor[0] = 1;
5188 overridecolor[1] = 0.5;
5189 overridecolor[2] = 0.1;
5191 if (!strcmp(
value,
"light_torch_small_walltorch"))
5196 overridecolor[0] = 1;
5197 overridecolor[1] = 0.5;
5198 overridecolor[2] = 0.1;
5202 else if (!strcmp(
"style", key))
5204 else if (!strcmp(
"skin", key))
5206 else if (!strcmp(
"pflags", key))
5212 if (!strcmp(
"scale", key))
5213 lightscale = atof(
value);
5214 if (!strcmp(
"fade", key))
5215 fadescale = atof(
value);
5220 if (lightscale <= 0)
5226 color[0] *= overridecolor[0];
5227 color[1] *= overridecolor[1];
5228 color[2] *= overridecolor[2];
5256 R_Shadow_UpdateWorldLight(
R_Shadow_NewWorldLight(),
origin,
angles,
color, radius, (
pflags &
PFLAGS_CORONA) != 0,
style, (
pflags &
PFLAGS_NOSHADOW) == 0,
skin >= 16 ?
va(vabuf,
sizeof(vabuf),
"cubemaps/%i",
skin) :
NULL, 0.25, 0, 1, 1,
LIGHTFLAG_REALTIMEMODE);
5269 trace =
CL_TraceLine(
r_refdef.
view.
origin, dest,
MOVE_NORMAL,
NULL,
SUPERCONTENTS_SOLID, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.
value,
true,
false,
NULL,
false,
true);
5348 Con_Print(
"Cannot spawn light when not in editing mode. Set r_editlights to 1.\n");
5353 Con_Print(
"r_editlights_spawn does not take parameters\n");
5357 R_Shadow_UpdateWorldLight(
R_Shadow_NewWorldLight(),
r_editlights_cursorlocation,
vec3_origin,
color, 200, 0, 0,
true,
NULL, 0.25, 0, 1, 1,
LIGHTFLAG_REALTIMEMODE);
5363 vec_t radius, corona, coronasizescale, ambientscale, diffusescale, specularscale;
5364 int style, shadows,
flags, normalmode, realtimemode;
5368 Con_Print(
"Cannot spawn light when not in editing mode. Set r_editlights to 1.\n");
5405 else if (!strcmp(
Cmd_Argv(
cmd, 1),
"originscale"))
5552 Con_Printf(
"usage: r_editlights_edit %s red green blue (OR grey instead of red green blue)\n",
Cmd_Argv(
cmd, 1));
5653 else if (!strcmp(
Cmd_Argv(
cmd, 1),
"realtimemode"))
5664 Con_Print(
"usage: r_editlights_edit [property] [value]\n");
5665 Con_Print(
"Selected light's properties:\n");
5683 R_Shadow_UpdateWorldLight(
r_shadow_selectedlight,
origin,
angles,
color, radius, corona,
style, shadows, cubemapname, coronasizescale, ambientscale, diffusescale, specularscale,
flags);
5694 Con_Print(
"Cannot edit lights when not in editing mode. Set r_editlights to 1.\n");
5701 for (lightindex = 0;lightindex < range;lightindex++)
5715 int lightnumber, lightcount;
5716 size_t lightindex, range;
5755 for (lightindex = 0;lightindex < range;lightindex++)
5761 lightnumber = (
int)lightindex;
5764 dpsnprintf(temp,
sizeof(temp),
"Cursor origin: %.0f %.0f %.0f",
r_editlights_cursorlocation[0],
r_editlights_cursorlocation[1],
r_editlights_cursorlocation[2]);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
false,
FONT_DEFAULT);
y += 8;
5765 dpsnprintf(temp,
sizeof(temp),
"Total lights : %i active (%i total)", lightcount, (
int)
Mem_ExpandableArray_IndexRange(&
r_shadow_worldlightsarray));
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
false,
FONT_DEFAULT);
y += 8;
5769 dpsnprintf(temp,
sizeof(temp),
"Light #%i properties:", lightnumber);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5770 dpsnprintf(temp,
sizeof(temp),
"Origin : %.0f %.0f %.0f\n",
r_shadow_selectedlight->
origin[0],
r_shadow_selectedlight->
origin[1],
r_shadow_selectedlight->
origin[2]);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5771 dpsnprintf(temp,
sizeof(temp),
"Angles : %.0f %.0f %.0f\n",
r_shadow_selectedlight->
angles[0],
r_shadow_selectedlight->
angles[1],
r_shadow_selectedlight->
angles[2]);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5772 dpsnprintf(temp,
sizeof(temp),
"Color : %.2f %.2f %.2f\n",
r_shadow_selectedlight->
color[0],
r_shadow_selectedlight->
color[1],
r_shadow_selectedlight->
color[2]);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5773 dpsnprintf(temp,
sizeof(temp),
"Radius : %.0f\n",
r_shadow_selectedlight->
radius);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5774 dpsnprintf(temp,
sizeof(temp),
"Corona : %.0f\n",
r_shadow_selectedlight->
corona);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5775 dpsnprintf(temp,
sizeof(temp),
"Style : %i\n",
r_shadow_selectedlight->
style);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5776 dpsnprintf(temp,
sizeof(temp),
"Shadows : %s\n",
r_shadow_selectedlight->
shadow ?
"yes" :
"no");
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5777 dpsnprintf(temp,
sizeof(temp),
"Cubemap : %s\n",
r_shadow_selectedlight->
cubemapname);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5778 dpsnprintf(temp,
sizeof(temp),
"CoronaSize : %.2f\n",
r_shadow_selectedlight->
coronasizescale);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5779 dpsnprintf(temp,
sizeof(temp),
"Ambient : %.2f\n",
r_shadow_selectedlight->
ambientscale);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5780 dpsnprintf(temp,
sizeof(temp),
"Diffuse : %.2f\n",
r_shadow_selectedlight->
diffusescale);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5781 dpsnprintf(temp,
sizeof(temp),
"Specular : %.2f\n",
r_shadow_selectedlight->
specularscale);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5782 dpsnprintf(temp,
sizeof(temp),
"NormalMode : %s\n", (
r_shadow_selectedlight->
flags &
LIGHTFLAG_NORMALMODE) ?
"yes" :
"no");
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5783 dpsnprintf(temp,
sizeof(temp),
"RealTimeMode : %s\n", (
r_shadow_selectedlight->
flags &
LIGHTFLAG_REALTIMEMODE) ?
"yes" :
"no");
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5785 dpsnprintf(temp,
sizeof(temp),
"Render stats\n");
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5786 dpsnprintf(temp,
sizeof(temp),
"Current color: %.3f %.3f %.3f\n",
r_shadow_selectedlight->
rtlight.
currentcolor[0],
r_shadow_selectedlight->
rtlight.
currentcolor[1],
r_shadow_selectedlight->
rtlight.
currentcolor[2]);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5787 dpsnprintf(temp,
sizeof(temp),
"Shadow size : %ix%ix6\n",
r_shadow_selectedlight->
rtlight.
shadowmapatlassidesize,
r_shadow_selectedlight->
rtlight.
shadowmapatlassidesize);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5788 dpsnprintf(temp,
sizeof(temp),
"World surfs : %i\n",
r_shadow_selectedlight->
rtlight.
cached_numsurfaces);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5789 dpsnprintf(temp,
sizeof(temp),
"Shadow ents : %i + %i noself\n",
r_shadow_selectedlight->
rtlight.
cached_numshadowentities,
r_shadow_selectedlight->
rtlight.
cached_numshadowentities_noselfshadow);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5790 dpsnprintf(temp,
sizeof(temp),
"Lit ents : %i + %i noself\n",
r_shadow_selectedlight->
rtlight.
cached_numlightentities,
r_shadow_selectedlight->
rtlight.
cached_numlightentities_noselfshadow);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5791 dpsnprintf(temp,
sizeof(temp),
"BG photons : %.3f\n",
r_shadow_selectedlight->
rtlight.
bouncegrid_photons);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5792 dpsnprintf(temp,
sizeof(temp),
"BG radius : %.0f\n",
r_shadow_selectedlight->
rtlight.
bouncegrid_effectiveradius);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5793 dpsnprintf(temp,
sizeof(temp),
"BG color : %.3f %.3f %.3f\n",
r_shadow_selectedlight->
rtlight.
bouncegrid_photoncolor[0],
r_shadow_selectedlight->
rtlight.
bouncegrid_photoncolor[1],
r_shadow_selectedlight->
rtlight.
bouncegrid_photoncolor[2]);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5794 dpsnprintf(temp,
sizeof(temp),
"BG stats : %i traces %i hits\n",
r_shadow_selectedlight->
rtlight.
bouncegrid_traces,
r_shadow_selectedlight->
rtlight.
bouncegrid_hits);
DrawQ_String(
x,
y, temp, 0, 8, 8, 1, 1, 1, 1, 0,
NULL,
true,
FONT_DEFAULT);
y += 8;
5801 Con_Print(
"Cannot spawn light when not in editing mode. Set r_editlights to 1.\n");
5809 R_Shadow_UpdateWorldLight(
r_shadow_selectedlight,
r_shadow_selectedlight->
origin,
r_shadow_selectedlight->
angles,
r_shadow_selectedlight->
color,
r_shadow_selectedlight->
radius,
r_shadow_selectedlight->
corona,
r_shadow_selectedlight->
style, !
r_shadow_selectedlight->
shadow,
r_shadow_selectedlight->
cubemapname,
r_shadow_selectedlight->
coronasizescale,
r_shadow_selectedlight->
ambientscale,
r_shadow_selectedlight->
diffusescale,
r_shadow_selectedlight->
specularscale,
r_shadow_selectedlight->
flags);
5816 Con_Print(
"Cannot spawn light when not in editing mode. Set r_editlights to 1.\n");
5824 R_Shadow_UpdateWorldLight(
r_shadow_selectedlight,
r_shadow_selectedlight->
origin,
r_shadow_selectedlight->
angles,
r_shadow_selectedlight->
color,
r_shadow_selectedlight->
radius, !
r_shadow_selectedlight->
corona,
r_shadow_selectedlight->
style,
r_shadow_selectedlight->
shadow,
r_shadow_selectedlight->
cubemapname,
r_shadow_selectedlight->
coronasizescale,
r_shadow_selectedlight->
ambientscale,
r_shadow_selectedlight->
diffusescale,
r_shadow_selectedlight->
specularscale,
r_shadow_selectedlight->
flags);
5831 Con_Print(
"Cannot remove light when not in editing mode. Set r_editlights to 1.\n");
5846"Documentation on r_editlights system:\n"
5848"r_editlights : enable/disable editing mode\n"
5849"r_editlights_cursordistance : maximum distance of cursor from eye\n"
5850"r_editlights_cursorpushback : push back cursor this far from surface\n"
5851"r_editlights_cursorpushoff : push cursor off surface this far\n"
5852"r_editlights_cursorgrid : snap cursor to grid of this size\n"
5853"r_editlights_quakelightsizescale : imported quake light entity size scaling\n"
5855"r_editlights_help : this help\n"
5856"r_editlights_clear : remove all lights\n"
5857"r_editlights_reload : reload .rtlights, .lights file, or entities\n"
5858"r_editlights_lock : lock selection to current light, if already locked - unlock\n"
5859"r_editlights_save : save to .rtlights file\n"
5860"r_editlights_spawn : create a light with default settings\n"
5861"r_editlights_edit command : edit selected light - more documentation below\n"
5862"r_editlights_remove : remove selected light\n"
5863"r_editlights_toggleshadow : toggles on/off selected light's shadow property\n"
5864"r_editlights_importlightentitiesfrommap : reload light entities\n"
5865"r_editlights_importlightsfile : reload .light file (produced by hlight)\n"
5867"origin x y z : set light location\n"
5868"originx x: set x component of light location\n"
5869"originy y: set y component of light location\n"
5870"originz z: set z component of light location\n"
5871"move x y z : adjust light location\n"
5872"movex x: adjust x component of light location\n"
5873"movey y: adjust y component of light location\n"
5874"movez z: adjust z component of light location\n"
5875"angles x y z : set light angles\n"
5876"anglesx x: set x component of light angles\n"
5877"anglesy y: set y component of light angles\n"
5878"anglesz z: set z component of light angles\n"
5879"color r g b : set color of light (can be brighter than 1 1 1)\n"
5880"radius radius : set radius (size) of light\n"
5881"colorscale grey : multiply color of light (1 does nothing)\n"
5882"colorscale r g b : multiply color of light (1 1 1 does nothing)\n"
5883"radiusscale scale : multiply radius (size) of light (1 does nothing)\n"
5884"sizescale scale : multiply radius (size) of light (1 does nothing)\n"
5885"originscale x y z : multiply origin of light (1 1 1 does nothing)\n"
5886"style style : set lightstyle of light (flickering patterns, switches, etc)\n"
5887"cubemap basename : set filter cubemap of light\n"
5888"shadows 1/0 : turn on/off shadows\n"
5889"corona n : set corona intensity\n"
5890"coronasize n : set corona size (0-1)\n"
5891"ambient n : set ambient intensity (0-1)\n"
5892"diffuse n : set diffuse intensity (0-1)\n"
5893"specular n : set specular intensity (0-1)\n"
5894"normalmode 1/0 : turn on/off rendering of this light in rtworld 0 mode\n"
5895"realtimemode 1/0 : turn on/off rendering of this light in rtworld 1 mode\n"
5896"<nothing> : print light properties to console\n"
5904 Con_Print(
"Cannot copy light info when not in editing mode. Set r_editlights to 1.\n");
5933 Con_Print(
"Cannot paste light info when not in editing mode. Set r_editlights to 1.\n");
5941 R_Shadow_UpdateWorldLight(
r_shadow_selectedlight,
r_shadow_selectedlight->
origin,
r_shadow_bufferlight.
angles,
r_shadow_bufferlight.
color,
r_shadow_bufferlight.
radius,
r_shadow_bufferlight.
corona,
r_shadow_bufferlight.
style,
r_shadow_bufferlight.
shadow,
r_shadow_bufferlight.
cubemapname,
r_shadow_bufferlight.
coronasizescale,
r_shadow_bufferlight.
ambientscale,
r_shadow_bufferlight.
diffusescale,
r_shadow_bufferlight.
specularscale,
r_shadow_bufferlight.
flags);
5948 Con_Print(
"Cannot lock on light when not in editing mode. Set r_editlights to 1.\n");
5958 Con_Print(
"No selected light to lock on.\n");
6016 int i, numlights, flag, q;
6019 float relativepoint[3];
6024 float sa[3], sx[3], sy[3], sz[3], sd[3];
6028 for (q = 0; q < 3; q++)
6029 sa[q] = sx[q] = sy[q] = sz[q] = sd[q] = 0;
6035 float tempambient[3];
6036 for (q = 0; q < 3; q++)
6037 tempambient[q] =
color[q] = relativepoint[q] = 0;
6041 for (q = 0; q < 3; q++)
6043 sa[q] += (0.5f *
color[q] + tempambient[q]) * lightmapintensity;
6044 sx[q] += (relativepoint[0] *
color[q]) * lightmapintensity;
6045 sy[q] += (relativepoint[1] *
color[q]) * lightmapintensity;
6046 sz[q] += (relativepoint[2] *
color[q]) * lightmapintensity;
6047 sd[q] += (
intensity * relativepoint[q]) * lightmapintensity;
6053 for (q = 0; q < 3; q++)
6054 sa[q] += lightmapintensity;
6062 for (
i = 0;
i < numlights;
i++)
6068 if (!(light->
flags & flag))
6074 if (dist2 >= lightradius2)
6080 if (light->
shadow &&
CL_TraceLine(p, light->
shadoworigin,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.
value,
true,
false,
NULL,
false,
true).
fraction < 1)
6082 for (q = 0; q < 3; q++)
6086 for (q = 0; q < 3; q++)
6088 sa[q] += 0.5f *
color[q];
6089 sx[q] += relativepoint[0] *
color[q];
6090 sy[q] += relativepoint[1] *
color[q];
6091 sz[q] += relativepoint[2] *
color[q];
6108 if (dist2 >= lightradius2)
6114 if (light->
shadow &&
CL_TraceLine(p, light->
shadoworigin,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.
value,
true,
false,
NULL,
false,
true).
fraction < 1)
6116 for (q = 0; q < 3; q++)
6120 for (q = 0; q < 3; q++)
6122 sa[q] += 0.5f *
color[q];
6123 sx[q] += relativepoint[0] *
color[q];
6124 sy[q] += relativepoint[1] *
color[q];
6125 sz[q] += relativepoint[2] *
color[q];
6132 for (q = 0; q < 3; q++)
6133 lightdir[q] = sd[q];
6135 for (q = 0; q < 3; q++)
6138 diffuse[q] = (lightdir[0] * sx[q] + lightdir[1] * sy[q] + lightdir[2] * sz[q]);
6140 ambient[q] = sa[q] + -0.333f * diffuse[q] + ambientintensity;
#define SUPERCONTENTS_SOLID
#define SUPERCONTENTS_LIQUIDSMASK
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_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, qbool hitnetworkbrushmodels, qbool hitnetworkplayers, int *hitnetworkentity, qbool hitcsqcentities)
trace_t CL_Cache_TraceLineSurfaces(const vec3_t start, const vec3_t end, int type, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
#define LIGHTFLAG_NORMALMODE
#define LIGHTFLAG_REALTIMEMODE
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...
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
cvar_t collision_extendmovelength
char com_token[MAX_INPUTLINE]
char * va(char *buf, size_t buflen, const char *format,...)
qbool COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments)
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 ...
#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.
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.
void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, float red, float green, float blue, float alpha, int flags)
float DrawQ_String(float x, float y, const char *text, size_t maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qbool ignorecolorcodes, const dp_font_t *fnt)
qbool FS_WriteFile(const char *filename, const void *data, fs_offset_t len)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
static int(ZEXPORT *qz_inflate)(z_stream *strm
void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilvalue)
void GL_BlendEquationSubtract(qbool negated)
void GL_CullFace(int state)
void GL_ColorMask(int r, int g, int b, int a)
unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void GL_DepthMask(int state)
int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void 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_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, int border, float nearclip, float farclip, const float *nearplane, int offsetx, int offsety)
void GL_DepthTest(int state)
void GL_DepthRange(float nearfrac, float farfrac)
void R_Mesh_SetRenderTargets(int fbo)
void GL_PolygonOffset(float planeoffset, float depthoffset)
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)
void R_Mesh_ResetTextureState(void)
void GL_Color(float cr, float cg, float cb, float ca)
void GL_BlendFunc(int blendfunc1, int blendfunc2)
qbool R_ScissorForBBox(const float *mins, const float *maxs, int *scissor)
void GL_Scissor(int x, int y, int width, int height)
void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3f, const float *color4f, const float *texcoord2f)
void R_Mesh_DestroyFramebufferObject(int fbo)
void R_EntityMatrix(const matrix4x4_t *matrix)
rtexture_t * r_texture_whitecube
void R_FrameData_SetMark(void)
set a marker that allows you to discard the following temporary memory allocations
cvar_t r_shadows_castfrombmodels
cvar_t r_shadows_shadowmapbias
void R_GLSL_Restart_f(cmd_state_t *cmd)
void R_SetupShader_Generic_NoTexture(qbool usegamma, qbool notrippy)
qbool R_CanSeeBox(int numsamples, vec_t eyejitter, vec_t entboxenlarge, vec_t entboxexpand, vec_t pad, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs)
void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const msurface_t **texturesurfacelist)
void R_FrameData_ReturnToMark(void)
discard recent memory allocations (rewind to marker)
unsigned int r_maxqueries
void R_SetupShader_DepthOrShadow(qbool notrippy, qbool depthrgb, qbool skeletal)
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...
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_shadows_throwdirection
void RSurf_DrawBatch(void)
r_framebufferstate_t r_fb
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)
void R_SetupShader_DeferredLight(const rtlight_t *rtlight)
mempool_t * r_main_mempool
unsigned int r_numqueries
void RSurf_SetupDepthAndCulling(bool ui)
cvar_t r_shadows_shadowmapscale
rtexture_t * R_GetCubemap(const char *basename)
qbool R_CullBox(const vec3_t mins, const vec3_t maxs, int numplanes, const mplane_t *planes)
qbool R_CompileShader_CheckStaticParms(void)
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)
cvar_t r_shadows_throwdistance
void RSurf_ActiveModelEntity(const entity_render_t *ent, qbool wantnormals, qbool wanttangents, qbool prepass)
void R_SkinFrame_MarkUsed(skinframe_t *skinframe)
cvar_t r_showdisabledepthtest
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)
qbool R_CullFrustum(const vec3_t mins, const vec3_t maxs)
void * R_FrameData_Store(size_t size, void *data)
allocate some temporary memory and copy this data into it
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)
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)
unsigned int r_queries[MAX_OCCLUSION_QUERIES]
void R_FreeTexturePool(rtexturepool_t **rtexturepool)
rtexture_t * R_LoadTextureRenderBuffer(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, textype_t textype)
int R_TextureHeight(rtexture_t *rt)
void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int z, int width, int height, int depth, int combine)
rtexture_t * R_LoadTextureShadowMap2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, textype_t textype, qbool filter)
int R_TextureWidth(rtexture_t *rt)
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)
rtexture_t * R_LoadTexture3D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette)
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)
GLubyte GLubyte GLubyte z
GLenum GLsizei GLsizei height
GLint GLenum GLsizei GLsizei GLint border
GLubyte GLubyte GLubyte GLubyte w
#define GL_UNIFORM_BUFFER
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei const GLfloat * value
GLint GLenum GLint GLint y
GLsizeiptr const GLvoid * data
#define GL_COLOR_BUFFER_BIT
GLint GLenum GLenum GLvoid * pixels
#define GL_DEPTH_COMPONENT
#define GL_SAMPLES_PASSED
#define GL_STENCIL_BUFFER_BIT
GLenum GLuint GLenum GLsizei const GLchar * buf
#define GL_DEPTH_BUFFER_BIT
qbool Image_WriteTGABGRA(const char *filename, int width, int height, const unsigned char *data)
void Math_RandomSeed_FromInts(randomseed_t *r, unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3)
int Math_atov(const char *s, prvm_vec3_t out)
float VectorNormalizeLength(vec3_t v)
returns vector length
void PlaneClassify(mplane_t *p)
#define VectorLerp(v1, lerp, v2, out)
#define VectorNegate(a, b)
#define BoxesOverlap(a, b, c, d)
#define VectorReflect(a, r, b, out)
#define VectorNormalize(v)
#define BoxInsideBox(a, b, c, d)
#define bound(min, num, max)
#define Vector4Set(vec, r, g, b, a)
#define VectorSet(vec, x, y, z)
#define VectorLehmerRandom(seed, v)
#define VectorDistance2(a, b)
#define PointInfrontOfTriangle(p, a, b, c)
#define VectorSubtract(a, b, out)
#define CrossProduct(a, b, out)
#define VectorMultiply(a, b, out)
#define VectorCheeseRandom(seed, v)
#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 VectorCopy4(a, b)
#define TriangleBBoxOverlapsBox(a, b, c, d, e)
#define VectorM(scale1, b1, out)
void Matrix4x4_AdjustOrigin(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_Concat(matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2)
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_FromArrayFloatD3D(matrix4x4_t *out, const float in[16])
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_FromArray12FloatD3D(matrix4x4_t *out, const float in[12])
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
void Matrix4x4_Abs(matrix4x4_t *out)
double Matrix4x4_ScaleFromMatrix(const matrix4x4_t *in)
const matrix4x4_t identitymatrix
void Matrix4x4_Scale(matrix4x4_t *out, double rotatescale, double originscale)
void Matrix4x4_OriginFromMatrix(const matrix4x4_t *in, float *out)
void R_MeshQueue_AddTransparent(dptransparentsortcategory_t category, const vec3_t center, void(*callback)(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist), const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
#define MATERIALFLAG_FULLBRIGHT
#define MATERIALFLAG_ALPHA
#define MATERIALFLAG_REFRACTION
#define MATERIALFLAG_ALPHATEST
#define MATERIALFLAG_BLENDED
#define CHECKPVSBIT(pvs, b)
#define MATERIALFLAG_WATERSHADER
#define MATERIALFLAG_OCCLUDE
#define MATERIALFLAG_NODEPTHTEST
#define MATERIALFLAGMASK_TRANSLUCENT
#define MATERIALFLAG_NOCULLFACE
#define MATERIALFLAG_CUSTOMBLEND
void Mod_AllocLightmap_Reset(mod_alloclightmap_state_t *state)
void Mod_AllocLightmap_Init(mod_alloclightmap_state_t *state, mempool_t *mempool, int width, int height)
void Mod_AllocLightmap_Free(mod_alloclightmap_state_t *state)
void Mod_ShadowMesh_Free(shadowmesh_t *mesh)
qbool Mod_AllocLightmap_Block(mod_alloclightmap_state_t *state, int blockwidth, int blockheight, int *outx, int *outy)
void Mod_ShadowMesh_AddMesh(shadowmesh_t *mesh, const float *vertex3f, int numtris, const int *element3i)
unsigned int palette_bgra_embeddedpic[256]
#define RENDER_EXTERIORMODEL
#define RENDER_NOSELFSHADOW
#define RENDER_NODEPTHTEST
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
#define MAX_EDICTS
max number of objects in game world at once (32768 protocol limit)
#define MAX_LIGHTSTYLES
max flickering light styles in level (note: affects savegame format)
#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
prvm_vec_t prvm_vec3_t[3]
void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
@ TRANSPARENTSORT_DISTANCE
cvar_t r_shadow_glossintensity
void R_Shadow_RenderMode_Begin(void)
cvar_t r_shadow_shadowmapping_filterquality
static void R_Shadow_RenderLighting_VisibleLighting(int texturenumsurfaces, const msurface_t **texturesurfacelist)
void R_Shadow_RenderMode_Lighting(qbool transparent, qbool shadowmapping, qbool noselfshadowpass)
cvar_t r_shadow_lightradiusscale
cvar_t r_shadow_shadowmapping_maxsize
static float spritetexcoord2f[4 *2]
cvar_t r_shadow_culllights_trace
static void R_Shadow_SetShadowmapParametersForLight(qbool noselfshadowpass)
static int R_Shadow_CalcBBoxSideMask(const vec3_t mins, const vec3_t maxs, const matrix4x4_t *worldtolight, const matrix4x4_t *radiustolight, float bias)
unsigned char * r_shadow_buffer_surfacesides
static void R_Shadow_EditLights_Clear_f(cmd_state_t *cmd)
void R_Shadow_EditLights_Reload_f(cmd_state_t *cmd)
int * r_shadow_buffer_leaflist
static void R_Shadow_MakeTextures_MakeCorona(void)
cvar_t r_shadow_bumpscale_bumpmap
cvar_t r_editlights_current_realtimemode
cvar_t r_shadow_realtime_world_compileportalculling
static void R_Shadow_SelectLight(dlight_t *light)
cvar_t r_shadow_shadowmapping_vsdct
int r_shadow_buffer_numlighttrispvsbytes
float r_shadow_modelshadowmap_parameters[4]
cvar_t r_shadow_culllights_trace_enlarge
cvar_t r_shadow_usenormalmap
static void R_Shadow_EditLights_EditAll_f(cmd_state_t *cmd)
static void R_Shadow_BounceGrid_BlurPixels_Task(taskqueue_task_t *t)
cvar_t r_shadow_lightattenuationdividebias
static void R_Shadow_BounceGrid_ClearTex_Task(taskqueue_task_t *t)
unsigned char * r_shadow_buffer_leafpvs
void R_Shadow_SetupEntityLight(const entity_render_t *ent)
cvar_t r_editlights_current_angles
cvar_t r_shadow_culllights_trace_expand
void R_Shadow_PrepareShadowSides(int numtris)
static void R_Shadow_BounceGrid_UpdateSpacing(void)
static void R_Shadow_EditLights_Lock_f(cmd_state_t *cmd)
int r_shadow_shadowmappcf
cvar_t r_shadow_bouncegrid_static
int R_Shadow_CalcTriangleSideMask(const vec3_t p1, const vec3_t p2, const vec3_t p3, float bias)
cvar_t r_shadow_bouncegrid_static_maxbounce
void R_Shadow_EditLights_DrawSelectedLightProperties(void)
cvar_t r_shadow_bouncegrid_static_lightradiusscale
int R_Shadow_ChooseSidesFromBox(int firsttriangle, int numtris, const float *invertex3f, const int *elements, const matrix4x4_t *worldtolight, const vec3_t projectorigin, const vec3_t projectdirection, const vec3_t lightmins, const vec3_t lightmaxs, const vec3_t surfacemins, const vec3_t surfacemaxs, int *totals)
cvar_t r_shadow_shadowmapping_nearclip
void R_Shadow_DrawLightSprites(void)
qbool R_Shadow_ScissorForBBox(const float *mins, const float *maxs)
cvar_t r_shadow_usebihculling
cvar_t r_editlights_current_color
rtexture_t * r_shadow_prepassgeometrynormalmaptexture
rtexture_t * r_shadow_prepasslightingdiffusetexture
int r_shadow_lightscissor[4]
vec3_t r_editlights_cursorlocation
skinframe_t * r_editlights_sprnoshadowlight
void R_Shadow_ClearStencil(void)
GLuint r_shadow_prepasslightingdiffusefbo
static void R_Shadow_FreeDeferred(void)
static void R_Shadow_BounceGrid_EnqueueSlices_Task(taskqueue_task_t *t)
void R_Shadow_DrawShadowMaps(void)
cvar_t r_shadow_realtime_dlight
void R_Shadow_UncompileWorldLights(void)
static void R_Shadow_BounceGrid_Slice(int zi)
int r_shadow_shadowmapmaxsize
void R_Shadow_LoadLightsFile(void)
cvar_t r_shadow_bouncegrid_dynamic_hitmodels
#define R_Shadow_CalcEntitySideMask(ent, worldtolight, radiustolight, bias)
static void R_Shadow_BounceGrid_FreeHighPixels(void)
cvar_t r_shadow_bouncegrid_includedirectlighting
cvar_t r_shadow_shadowmapping_bordersize
int r_shadow_scenenumlights
unsigned char * r_shadow_buffer_surfacepvs
cvar_t r_editlights_current_style
rtexture_t * r_shadow_prepasslightingspeculartexture
char r_shadow_mapname[MAX_QPATH]
void R_Shadow_PrepareShadowMark(int numtris)
unsigned char * r_shadow_buffer_visitingleafpvs
qbool r_shadow_shadowmapshadowsampler
static void R_Shadow_EditLights_Save_f(cmd_state_t *cmd)
cvar_t r_shadow_debuglight
cvar_t r_shadow_shadowmapping_minsize
int r_shadow_buffer_numshadowtrispvsbytes
cvar_t r_editlights_cursorpushoff
cvar_t r_shadow_culllights_trace_samples
static void R_Shadow_EditLights_Remove_f(cmd_state_t *cmd)
cvar_t r_shadow_realtime_world_shadows
cvar_t r_shadow_shadowmapping_depthbits
qbool r_shadow_shadowmapvsdct
cvar_t r_shadow_bouncegrid_dynamic_dlightparticlemultiplier
static void R_Shadow_DrawCursor_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
cvar_t r_shadow_bouncegrid_dynamic_maxbounce
static void R_Shadow_FreeShadowMaps(void)
int r_shadow_cullface_front
cvar_t r_editlights_current_normalmode
cvar_t r_shadow_sortsurfaces
int r_shadow_shadowmode_shadowmapping
skinframe_t * r_editlights_sprlight
static void R_Shadow_EditLights_ToggleCorona_f(cmd_state_t *cmd)
qbool r_shadow_usingdeferredprepass
cvar_t r_shadow_realtime_world
static void R_Shadow_DrawEntityLight(entity_render_t *ent)
cvar_t r_shadow_bouncegrid_static_quality
rtexture_t * r_shadow_viewdepthtexture
static float R_Shadow_BounceGrid_RefractiveIndexAtPoint(vec3_t point)
int R_Shadow_GetRTLightInfo(unsigned int lightindex, float *origin, float *radius, float *color)
cvar_t r_shadow_bouncegrid_static_directionalshading
cvar_t r_shadow_realtime_dlight_svbspculling
cvar_t r_shadow_shadowmapping
static void R_Shadow_EditLights_CopyInfo_f(cmd_state_t *cmd)
static void R_Shadow_EditLights_Edit_f(cmd_state_t *cmd)
cvar_t r_shadow_bouncegrid_particleintensity
mod_alloclightmap_state_t r_shadow_shadowmapatlas_state
cvar_t r_shadow_shadowmapping_precision
static void R_Shadow_EditLights_ImportLightEntitiesFromMap_f(cmd_state_t *cmd)
static void R_Shadow_MakeTextures(void)
int R_Shadow_CalcSphereSideMask(const vec3_t p, float radius, float bias)
cvar_t r_shadow_bouncegrid_lightpathsize
cvar_t r_shadow_projectdistance
int r_shadow_shadowmapfilterquality
cvar_t r_shadow_shadowmapping_useshadowsampler
static void R_Shadow_ResizeShadowArrays(int numvertices, int numtriangles, int vertscale, int triscale)
static entity_render_t * r_shadow_modelshadows[MAX_MODELSHADOWS]
int r_shadow_shadowmapside
r_shadow_rendermode_t r_shadow_rendermode
rtexture_t * r_shadow_attenuationgradienttexture
static void R_Shadow_EditLights_Init(void)
dlight_t * r_shadow_selectedlight
static void R_Shadow_EnlargeLeafSurfaceTrisBuffer(int numleafs, int numsurfaces, int numshadowtriangles, int numlighttriangles)
static void R_Shadow_SetCursorLocationForView(void)
cvar_t r_shadow_realtime_world_importlightentitiesfrommap
cvar_t r_editlights_cursordistance
static void R_Shadow_MakeVSDCT(void)
qbool r_shadow_shadowmapsampler
cvar_t r_editlights_quakelightsizescale
int r_shadow_shadowmapdepthbits
void R_Shadow_RenderMode_DrawDeferredLight(qbool shadowmapping)
void R_Shadow_PrepareLights(void)
qbool R_Shadow_ShadowMappingEnabled(void)
cvar_t r_editlights_current_cubemap
cvar_t r_shadow_bouncegrid_intensity
static void R_Shadow_BounceGrid_TracePhotons_ShotTask(taskqueue_task_t *t)
unsigned char * r_shadow_buffer_lighttrispvs
static const unsigned short bboxelements[36]
GLuint r_shadow_prepasslightingdiffusespecularfbo
cvar_t r_editlights_current_coronasize
float r_shadow_lightshadowmap_parameters[4]
static void R_Shadow_BounceGrid_TracePhotons_Shot(r_shadow_bouncegrid_photon_t *p, int remainingbounces, vec3_t shotstart, vec3_t shotend, vec3_t shotcolor, float bounceminimumintensity2, float previousrefractiveindex)
cvar_t r_shadow_bouncegrid_dynamic_bounceminimumintensity
int * r_shadow_buffer_surfacelist
void R_Shadow_PrepareModelShadows(void)
cvar_t r_editlights_current_origin
cvar_t r_shadow_bouncegrid_rng_seed
skinframe_t * r_editlights_sprcursor
static qbool R_Shadow_PrepareLights_AddSceneLight(rtlight_t *rtlight)
cvar_t r_shadow_bouncegrid_static_bounceminimumintensity
qbool r_shadow_usingshadowmap2d
cvar_t r_shadow_culllights_trace_eyejitter
cvar_t r_shadow_bouncegrid_dynamic_lightradiusscale
static void R_Shadow_EditLights_ToggleShadow_f(cmd_state_t *cmd)
cvar_t r_shadow_culllights_trace_pad
cvar_t r_shadow_bouncegrid_dynamic_updateinterval
rtexture_t * r_shadow_prepassgeometrydepthbuffer
cvar_t r_shadow_bouncegrid_static_spacing
@ R_SHADOW_SHADOWMODE_DISABLED
@ R_SHADOW_SHADOWMODE_SHADOWMAP2D
void R_RTLight_Uncompile(rtlight_t *rtlight)
static void R_Shadow_MakeShadowMap(int texturesize)
int r_shadow_shadowmaptexturesize
cvar_t r_shadow_glossexact
void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec3_t color, int style, const char *cubemapname, int shadow, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags)
static void R_Shadow_RenderLighting_Light_GLSL(int texturenumsurfaces, const msurface_t **texturesurfacelist, const float ambientcolor[3], const float diffusecolor[3], const float specularcolor[3])
static void R_Shadow_DrawLightShadowMaps(rtlight_t *rtlight)
r_shadow_shadowmode_t r_shadow_shadowmode
cvar_t r_editlights_current_corona
static void r_shadow_shutdown(void)
float r_shadow_lightshadowmap_texturescale[4]
cvar_t r_shadow_lightintensityscale
void R_Shadow_RenderLighting(int texturenumsurfaces, const msurface_t **texturesurfacelist)
rtexture_t * r_shadow_viewcolortexture
cvar_t r_editlights_cursorpushback
cvar_t r_editlights_cursorgrid
cvar_t r_shadow_bouncegrid_subsamples
cvar_t r_shadow_bouncegrid_particlebounceintensity
rtlight_t ** r_shadow_scenelightlist
matrix4x4_t matrix_attenuationz
cvar_t r_shadow_realtime_world_compile
static const float bboxpoints[8][3]
void R_Shadow_RenderMode_VisibleLighting(qbool transparent)
static void R_Shadow_DrawModelShadowMaps(void)
r_shadow_rendermode_t r_shadow_lightingrendermode
matrix4x4_t matrix_attenuationxyz
skinframe_t * r_editlights_sprselection
static void R_Shadow_DrawLightSprite_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
static void R_Shadow_DrawEntityShadow(entity_render_t *ent)
int r_shadow_buffer_numleafpvsbytes
GLuint r_shadow_prepassgeometryfbo
cvar_t r_editlights_current_ambient
static void R_Shadow_BounceGrid_EnqueuePhotons_Task(taskqueue_task_t *t)
static void R_Shadow_EditLights_PasteInfo_f(cmd_state_t *cmd)
static int r_shadow_nummodelshadows
cvar_t r_shadow_realtime_world_compilesvbsp
static void R_Shadow_RenderMode_ShadowMap(int side, int size, int x, int y)
cvar_t r_shadow_bouncegrid_dynamic_y
static float r_shadow_attendividebias
int r_shadow_prepass_width
cvar_t r_shadow_bouncegrid_rng_type
rtlight_t * r_shadow_compilingrtlight
qbool r_shadow_usingshadowmaportho
unsigned char * shadowsides
@ R_SHADOW_RENDERMODE_VISIBLEVOLUMES
@ R_SHADOW_RENDERMODE_NONE
@ R_SHADOW_RENDERMODE_ZPASS_STENCIL
@ R_SHADOW_RENDERMODE_SHADOWMAP2D
@ R_SHADOW_RENDERMODE_ZFAIL_STENCIL
@ R_SHADOW_RENDERMODE_VISIBLELIGHTING
@ R_SHADOW_RENDERMODE_LIGHT_GLSL
@ R_SHADOW_RENDERMODE_ZFAIL_SEPARATESTENCIL
@ R_SHADOW_RENDERMODE_ZPASS_SEPARATESTENCIL
@ R_SHADOW_RENDERMODE_ZFAIL_STENCILTWOSIDE
@ R_SHADOW_RENDERMODE_ZPASS_STENCILTWOSIDE
static dlight_t * R_Shadow_NewWorldLight(void)
cvar_t r_shadow_frontsidecasting
static void R_Shadow_BounceGrid_ConvertPixelsAndUpload(void)
skinframe_t * r_editlights_sprcubemaplight
void R_Shadow_ClearWorldLights(void)
rtexturepool_t * r_shadow_texturepool
cvar_t r_shadow_culllights_pvs
void R_Shadow_UpdateBounceGridTexture(void)
void R_Shadow_RenderMode_Reset(void)
cvar_t r_shadow_realtime_world_compileshadow
static void R_Shadow_BounceGrid_AssignPhotons_Task(taskqueue_task_t *t)
cvar_t r_shadow_bouncegrid_blur
static unsigned int R_Shadow_MakeTextures_SamplePoint(float x, float y, float z)
rtexture_t * r_shadow_shadowmapvsdcttexture
cvar_t r_shadow_bouncegrid_dynamic_maxphotons
int r_shadow_scenemaxlights
cvar_t r_shadow_bouncegrid_normalizevectors
cvar_t r_shadow_culllights_trace_delay
rtexture_t * r_shadow_shadowmap2ddepthtexture
unsigned char * r_shadow_buffer_shadowtrispvs
static void R_BeginCoronaQuery(rtlight_t *rtlight, float scale, qbool usequery)
int r_shadow_shadowmapatlas_modelshadows_size
static float r_shadow_attenlinearscale
cvar_t r_shadow_bouncegrid
matrix4x4_t r_shadow_shadowmapmatrix
void R_Shadow_DrawCoronas(void)
int r_shadow_prepass_height
int r_shadow_shadowmapatlas_modelshadows_y
cvar_t r_shadow_realtime_dlight_portalculling
static memexpandablearray_t r_shadow_worldlightsarray
static void r_shadow_start(void)
static void R_Shadow_BounceGrid_GenerateSettings(r_shadow_bouncegrid_settings_t *settings)
static int R_Shadow_CullFrustumSides(rtlight_t *rtlight, float size, float border)
static void R_Shadow_DrawWorldShadow_ShadowMap(int numsurfaces, int *surfacelist, const unsigned char *trispvs, const unsigned char *surfacesides)
cvar_t r_shadow_gloss2intensity
void R_Shadow_SaveWorldLights(void)
static void R_Shadow_ComputeShadowCasterCullingPlanes(rtlight_t *rtlight)
int r_shadow_buffer_numsurfacepvsbytes
void R_Shadow_LoadWorldLights(void)
cvar_t r_shadow_lightattenuationlinearscale
cvar_t r_shadow_bouncegrid_dynamic_z
rtexture_t * r_shadow_shadowmap2ddepthbuffer
cvar_t r_shadow_realtime_dlight_shadows
cvar_t r_shadow_bouncegrid_dynamic_spacing
cvar_t r_coronas_occlusionquery
cvar_t r_shadow_bouncegrid_dynamic_culllightpaths
cvar_t r_editlights_current_diffuse
void R_Shadow_DrawLights(void)
cvar_t r_shadow_glossexponent
static void R_Shadow_DrawLight(rtlight_t *rtlight)
cvar_t r_shadow_shadowmapping_bias
dlight_t r_shadow_bufferlight
qbool r_shadow_shadowmapdepthtexture
void R_Shadow_ClearShadowMapTexture(void)
cvar_t r_shadow_bouncegrid_floatcolors
int r_shadow_cullface_back
cvar_t r_shadow_gloss2exponent
static qbool R_Shadow_BounceGrid_CheckEnable(int flag)
static void R_Shadow_EditLights_ImportLightsFile_f(cmd_state_t *cmd)
cvar_t r_shadow_bouncegrid_dynamic_quality
static void R_Shadow_BounceGrid_BlurPixelsInDirection(const float *inpixels, float *outpixels, int off)
static void R_Shadow_SetShadowMode(void)
void R_Shadow_RenderMode_ActiveLight(const rtlight_t *rtlight)
static float r_shadow_attentable[ATTENTABLESIZE+1]
static void r_shadow_newmap(void)
cvar_t r_editlights_current_radius
void R_Shadow_RenderMode_End(void)
cvar_t r_shadow_culllights_trace_tempsamples
void R_Shadow_DrawPrepass(void)
cvar_t r_shadow_bouncegrid_threaded
static void R_Shadow_BounceGrid_Slice_Task(taskqueue_task_t *t)
cvar_t r_shadow_bouncegrid_dynamic_x
void R_Shadow_UpdateWorldLightSelection(void)
int r_shadow_shadowmode_deferred
int r_shadow_shadowmapborder
unsigned int r_shadow_occlusion_buf
skinframe_t * r_editlights_sprcubemapnoshadowlight
cvar_t r_shadow_bouncegrid_dynamic_directionalshading
void R_RTLight_Compile(rtlight_t *rtlight)
cvar_t r_editlights_current_specular
cvar_t r_shadow_realtime_world_lightmaps
skinframe_t * r_shadow_lightcorona
cvar_t r_shadow_bumpscale_basetexture
rtexturepool_t * r_shadow_filters_texturepool
cvar_t r_shadow_shadowmapping_polygonoffset
void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
static void R_Shadow_DrawWorldLight(int numsurfaces, int *surfacelist, const unsigned char *lighttrispvs)
cvar_t r_shadow_bouncegrid_static_maxphotons
int r_shadow_shadowmapatlas_modelshadows_x
static void R_Shadow_SelectLightInView(void)
cvar_t r_editlights_current_shadows
static void R_Shadow_PrepareLight(rtlight_t *rtlight)
cvar_t r_shadow_shadowmapping_texturesize
r_shadow_bouncegrid_state_t r_shadow_bouncegrid_state
static void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale)
static void R_Shadow_EditLights_Spawn_f(cmd_state_t *cmd)
static void R_Shadow_UpdateWorldLight(dlight_t *light, vec3_t origin, vec3_t angles, vec3_t color, vec_t radius, vec_t corona, int style, int shadowenable, const char *cubemapname, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags)
void R_CompleteLightPoint(float *ambient, float *diffuse, float *lightdir, const vec3_t p, const int flags, float lightmapintensity, float ambientintensity)
static void R_Shadow_FreeWorldLight(dlight_t *light)
cvar_t r_coronas_occlusionsizescale
cvar_t r_shadow_shadowmapping_polygonfactor
void R_Shadow_ShadowMapFromList(int numverts, int numtris, const float *vertex3f, const int *elements, int numsidetris, const int *sidetotals, const unsigned char *sides, const int *sidetris)
qbool r_editlights_lockcursor
cvar_t r_editlights_drawproperties
static void R_Shadow_EditLights_Help_f(cmd_state_t *cmd)
float r_shadow_modelshadowmap_texturescale[4]
void R_TimeReport(const char *desc)
@ r_stat_bouncegrid_particles
@ r_stat_bouncegrid_lights
@ r_stat_lights_scissored
@ r_stat_lights_shadowtriangles
#define TEXF_FORCENEAREST
@ TEXTYPE_SHADOWMAP16_RAW
@ TEXTYPE_SHADOWMAP16_COMP
@ TEXTYPE_SHADOWMAP24_RAW
@ TEXTYPE_SHADOWMAP24_COMP
#define TEXF_RENDERTARGET
#define BATCHNEED_ARRAY_VERTEX
struct model_s * worldmodel
char worldname[MAX_QPATH]
csqc_vidvars_t csqc_vidvars
char worldnamenoextension[MAX_QPATH]
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
matrix4x4_t inversematrix
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
int(* BoxTouchingVisibleLeafs)(struct model_s *model, const unsigned char *visibleleafs, const vec3_t mins, const vec3_t maxs)
void(* LightPoint)(struct model_s *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal)
int(* BoxTouchingLeafPVS)(struct model_s *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs)
int * modelsurfaces_sorted
surface indices of model in an optimal draw order (submodelindex -> texture -> lightmap -> index)
msurface_t * data_surfaces
int submodelsurfaces_start
void(* DrawPrepass)(struct entity_render_s *ent)
void(* DrawShadowMap)(int side, struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const unsigned char *surfacesides, const vec3_t lightmins, const vec3_t lightmaxs)
void(* GetLightInfo)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs, unsigned char *visitingleafpvs, int numfrustumplanes, const mplane_t *frustumplanes, qbool noocclusion)
void(* DrawLight)(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs)
describes the textures to use on a range of triangles in the model, and mins/maxs (AABB) for culling.
vec3_t mins
bounding box for onscreen checks
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
rtlight_t * lights[MAX_DLIGHTS]
r_refdef_viewcache_t viewcache
float colorscale
global RGB color multiplier for rendering
int useperspective
if turned off it renders an ortho view
r_viewport_t viewport
note: if r_viewscale is used, the viewport.width and viewport.height may be less than width and heigh...
int colormask[4]
which color components to allow (for anaglyph glasses)
unsigned char * world_leafvisible
unsigned char * entityvisible
which entities are currently visible for this viewpoint (the used range is 0...r_refdef....
r_shadow_bouncegrid_photon_path_t paths[PHOTON_MAX_PATHS]
float startrefractiveindex
float bounceminimumintensity2
float bounceminimumintensity2
float dlightparticlemultiplier
qbool includedirectlighting
float particlebounceintensity
taskqueue_task_t enqueuephotons_task
taskqueue_task_t enqueue_slices_task
taskqueue_task_t photons_done_task
taskqueue_task_t slices_done_task
qbool allowdirectionalshading
taskqueue_task_t * photons_tasks
r_shadow_bouncegrid_settings_t settings
taskqueue_task_t cleartex_task
unsigned short * fp16pixels
taskqueue_task_t * slices_tasks
taskqueue_task_t blurpixels_task
r_shadow_bouncegrid_photon_t * photons
taskqueue_task_t assignphotons_task
struct rtexture_s * texture
matrix4x4_t projectmatrix
actual projection matrix (transforms from viewspace to screen)
matrix4x4_t viewmatrix
actual matrix for rendering (transforms to viewspace)
const rtlight_t * rtlight
matrix4x4_t entitytolight
matrix4x4_t entitytoattenuationz
matrix4x4_t entitytoattenuationxyz
vec_t ambientscale
ambient intensity to render
rtexture_t * currentcubemap
this is R_GetCubemap(rtlight->cubemapname)
struct entity_render_s ** cached_lightentities_noselfshadow
float corona_visibility
used by corona updates, due to occlusion query
unsigned char * static_shadowtrispvs
int shadowmapatlassidesize
size of one side of this light in the shadowmap atlas (for omnidirectional shadowmaps this is the min...
int shadow
whether light should render shadows (see castshadows for whether it actually does this frame)
int static_shadowmap_receivers
masks of all shadowmap sides that have any potential static receivers or casters
int cached_numlightentities
these fields are set by R_Shadow_PrepareLight for later drawing
unsigned char * static_leafpvs
vec3_t color
typically 1 1 1, can be lower (dim) or higher (overbright)
int static_shadowmap_casters
double trace_timer
when r_shadow_culllights_trace is set, this is refreshed by each successful trace.
unsigned char * cached_shadowtrispvs
vec_t corona
intensity of corona to render
int static_numleafpvsbytes
vec_t specularscale
specular intensity to render
unsigned int corona_queryindex_visiblepixels
int cached_numlightentities_noselfshadow
int flags
LIGHTFLAG_* flags.
mplane_t cached_frustumplanes[5]
int compiled
true if this is a compiled world light, cleared if the light changes
unsigned char * static_lighttrispvs
int cached_numshadowentities
int style
light style to monitor for brightness
qbool draw
set by R_Shadow_PrepareLight to decide whether R_Shadow_DrawLight should draw it
shadowmesh_t * static_meshchain_shadow_shadowmap
optimized and culled mesh to render for world entity shadows
int cached_numfrustumplanes
vec3_t shadoworigin
used only for casting shadows
float bouncegrid_effectiveradius
int isstatic
static light info true if this light should be compiled as a static light
int static_numlighttrispvsbytes
this allows the lighting batch code to skip backfaces andother culled triangles not relevant for ligh...
vec_t coronasizescale
radius scale of corona to render (1.0 means same as light radius)
char cubemapname[64]
light filter
int static_numsurfaces
surfaces seen by light
int shadowmapsidesize
the size that this light should have (assuming no scene LOD kicking in to reduce it)
matrix4x4_t matrix_lighttoworld
matrix for transforming light filter coordinates to world coordinates
struct entity_render_s ** cached_shadowentities_noselfshadow
matrix4x4_t matrix_worldtolight
matrix for transforming world coordinates to light filter coordinates
int static_numshadowtrispvsbytes
flag bits indicating which triangles of the world model should cast shadows, and which ones should be...
float bouncegrid_photoncolor[3]
bouncegrid light info
vec_t diffusescale
diffuse intensity to render
struct entity_render_s ** cached_lightentities
int static_numleafs
used for visibility testing (more exact than bbox)
int cached_numshadowentities_noselfshadow
unsigned char * cached_lighttrispvs
qbool castshadows
set by R_Shadow_PrepareLight to indicate whether R_Shadow_DrawShadowMaps should do anything
vec_t radius
size of the light (remove?)
int shadowmapatlasposition[2]
position of this light in the shadowmap atlas
struct entity_render_s ** cached_shadowentities
unsigned int corona_queryindex_allpixels
int element3s_bufferoffset
int element3i_bufferoffset
r_meshbuffer_t * element3s_indexbuffer
r_meshbuffer_t * vbo_vertexbuffer
r_meshbuffer_t * element3i_indexbuffer
unsigned short * element3s
void(* func)(struct taskqueue_task_s *task)
float render_rtlight_specular[3]
float render_rtlight_diffuse[3]
const struct texture_s * hittexture
const struct texture_s * starttexture
qbool amd_texture_texture4
int glversion
this is at least 32
unsigned int maxtexturesize_2d
unsigned int maxtexturesize_3d
unsigned int maxdrawbuffers
void TaskQueue_Yield(taskqueue_task_t *t)
void TaskQueue_WaitForTaskDone(taskqueue_task_t *t)
void TaskQueue_Setup(taskqueue_task_t *t, taskqueue_task_t *preceding, void(*func)(taskqueue_task_t *), size_t i0, size_t i1, void *p0, void *p1)
void TaskQueue_Enqueue(int numtasks, taskqueue_task_t *tasks)
void TaskQueue_Task_CheckTasksDone(taskqueue_task_t *t)
const char * gl_vendor
brand of graphics chip
const char * gl_version
begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
const char * gl_renderer
graphics chip model and other information
viddef_t vid
global video state
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)
#define Mem_Alloc(pool, size)
#define Mem_Realloc(pool, data, size)