static signed int blocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHavoc: *3 for colored lighting
-static byte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4];
+static qbyte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4];
cvar_t r_ambient = {0, "r_ambient", "0"};
cvar_t r_vertexsurfaces = {0, "r_vertexsurfaces", "0"};
void GL_Surf_Init(void)
{
int i;
- if (!dlightdivtable[1])
- {
- dlightdivtable[0] = 4194304;
- for (i = 1;i < 32768;i++)
- dlightdivtable[i] = 4194304 / (i << 7);
- }
+ dlightdivtable[0] = 4194304;
+ for (i = 1;i < 32768;i++)
+ dlightdivtable[i] = 4194304 / (i << 7);
Cvar_RegisterVariable(&r_ambient);
Cvar_RegisterVariable(&r_vertexsurfaces);
float ndist;
msurface_t *surf, *endsurf;
int sdtable[256], td, maxdist, maxdist2, maxdist3, i, s, t, smax, tmax, smax3, dist2, impacts, impactt, subtract, a, stained, cr, cg, cb, ca, ratio;
- byte *bl;
+ qbyte *bl;
vec3_t impact;
// LordHavoc: use 64bit integer... shame it's not very standardized...
#if _MSC_VER || __BORLANDC__
cr = (((icolor[4] - icolor[0]) * ratio) >> 8) + icolor[0];
cg = (((icolor[5] - icolor[1]) * ratio) >> 8) + icolor[1];
cb = (((icolor[6] - icolor[2]) * ratio) >> 8) + icolor[2];
- bl[0] = (byte) ((((cr - (int) bl[0]) * a) >> 8) + (int) bl[0]);
- bl[1] = (byte) ((((cg - (int) bl[1]) * a) >> 8) + (int) bl[1]);
- bl[2] = (byte) ((((cb - (int) bl[2]) * a) >> 8) + (int) bl[2]);
+ bl[0] = (qbyte) ((((cr - (int) bl[0]) * a) >> 8) + (int) bl[0]);
+ bl[1] = (qbyte) ((((cg - (int) bl[1]) * a) >> 8) + (int) bl[1]);
+ bl[2] = (qbyte) ((((cb - (int) bl[2]) * a) >> 8) + (int) bl[2]);
stained = true;
}
}
*/
static void R_BuildLightMap (msurface_t *surf, int dlightchanged)
{
- int smax, tmax, i, j, size, size3, shift, scale, maps, *bl, stride, l;
- byte *lightmap, *out, *stain;
+ int smax, tmax, i, j, size, size3, shift, scale, maps, *bl, stride, l;
+ qbyte *lightmap, *out, *stain;
// update cached lighting info
surf->cached_dlight = 0;
m.cg = 1;
m.cb = 1;
m.ca = 1;
- if (r_mergesky.integer)
- m.tex[0] = R_GetTexture(mergeskytexture);
- else
- m.tex[0] = R_GetTexture(solidskytexture);
+ m.tex[0] = R_GetTexture(solidskytexture);
m.texcoords[0] = &svert[0].st[0];
m.texcoordstep[0] = sizeof(surfvert_t);
speedscale = cl.time * (8.0/128.0);
}
else if (stage == 1)
{
- if (skyrenderglquake && !r_mergesky.integer)
+ if (skyrenderglquake)
{
memset(&m, 0, sizeof(m));
m.transparent = false;
m.numtriangles = s->mesh.numtriangles;
m.numverts = s->mesh.numverts;
m.index = s->mesh.index;
- m.cr = 1;
- if (lighthalf)
- m.cr *= 2;
- if (gl_combine.integer)
- m.cr *= 4;
- m.cg = m.cr;
- m.cb = m.cr;
+ m.cr = m.cg = m.cb = (float) (1 << lightscalebit);
m.ca = currentrenderentity->alpha;
m.tex[0] = R_GetTexture(s->currenttexture->texture);
m.tex[1] = R_GetTexture(s->lightmaptexture);
m.numtriangles = s->mesh.numtriangles;
m.numverts = s->mesh.numverts;
m.index = s->mesh.index;
- if (lighthalf)
- {
- m.cr = 2;
- m.cg = 2;
- m.cb = 2;
- }
- else
- {
- m.cr = 1;
- m.cg = 1;
- m.cb = 1;
- }
+ m.cr = m.cg = m.cb = (float) (1 << v_overbrightbits.integer);
m.ca = 1;
m.tex[0] = R_GetTexture(s->currenttexture->texture);
m.texcoords[0] = &s->mesh.vertex->st[0];
m.numtriangles = s->mesh.numtriangles;
m.numverts = s->mesh.numverts;
m.index = s->mesh.index;
- m.cr = 1;
- if (lighthalf)
- m.cr *= 2.0f;
- m.cg = m.cr;
- m.cb = m.cr;
+ m.cr = m.cg = m.cb = (float) (1 << v_overbrightbits.integer);
m.ca = 1;
m.tex[0] = R_GetTexture(s->lightmaptexture);
m.texcoords[0] = &s->mesh.vertex->uv[0];
static void RSurfShader_Wall_Pass_BaseVertex(msurface_t *s)
{
- int i, size3;
- float c[3], base[3], scale, diff[3], ifog;
- surfvertex_t *v;
- surfvert_t *sv;
- rmeshinfo_t m;
- byte *lm;
+ int i, size3;
+ float c[3], base[3], scale, diff[3], ifog;
+ surfvertex_t *v;
+ surfvert_t *sv;
+ rmeshinfo_t m;
+ qbyte *lm;
size3 = ((s->extents[0]>>4)+1)*((s->extents[1]>>4)+1)*3;
static int RSurfShader_Wall_Fullbright(int stage, msurface_t *s)
{
+ if (stage == 0)
+ c_brush_polys++;
switch(stage)
{
case 0:
static int RSurfShader_Wall_Vertex(int stage, msurface_t *s)
{
+ if (stage == 0)
+ c_brush_polys++;
switch(stage)
{
case 0:
static int RSurfShader_Wall_Lightmap(int stage, msurface_t *s)
{
+ if (stage == 0)
+ c_brush_polys++;
if (r_vertexsurfaces.integer)
{
switch(stage)
msurface_t *surf, **mark, **endmark;
mleaf_t *leaf;
tinyplane_t plane;
- byte *worldvis;
+ qbyte *worldvis;
worldvis = Mod_LeafPVS (r_viewleaf, cl.worldmodel);
}
}
-void R_DrawSurfacesAll (void)
-{
- R_DrawSurfaces(SHADERSTAGE_SKY);
- R_DrawSurfaces(SHADERSTAGE_NORMAL);
- R_DrawSurfaces(SHADERSTAGE_FOG);
-}
-
static float portalpointbuffer[256][3];
void R_DrawPortals(void)