static int R_IntAddDynamicLights (const matrix4x4_t *matrix, msurface_t *surf)
{
- int sdtable[256], lnum, td, maxdist, maxdist2, maxdist3, i, s, t, smax, tmax, smax3, red, green, blue, lit, dist2, impacts, impactt, subtract;
+ int sdtable[256], lnum, td, maxdist, maxdist2, maxdist3, i, s, t, smax, tmax, smax3, red, green, blue, lit, dist2, impacts, impactt, subtract, k;
unsigned int *bl;
float dist, impact[3], local[3];
- // LordHavoc: use 64bit integer... shame it's not very standardized...
-#if _MSC_VER || __BORLANDC__
- __int64 k;
-#else
- long long k;
-#endif
-
lit = false;
smax = (surf->extents[0] >> 4) + 1;
maxdist3 = maxdist - dist2;
// convert to 8.8 blocklights format
- red = r_dlight[lnum].light[0];
- green = r_dlight[lnum].light[1];
- blue = r_dlight[lnum].light[2];
+ red = r_dlight[lnum].light[0] * (1.0f / 128.0f);
+ green = r_dlight[lnum].light[1] * (1.0f / 128.0f);
+ blue = r_dlight[lnum].light[2] * (1.0f / 128.0f);
subtract = (int) (r_dlight[lnum].subtract * 4194304.0f);
bl = intblocklights;
k = dlightdivtable[(sdtable[s] + td) >> 7] - subtract;
if (k > 0)
{
- bl[0] += (red * k) >> 7;
- bl[1] += (green * k) >> 7;
- bl[2] += (blue * k) >> 7;
+ bl[0] += (red * k);
+ bl[1] += (green * k);
+ bl[2] += (blue * k);
lit = true;
}
}
// update cached lighting info
surf->cached_dlight = 0;
- surf->cached_lightscalebit = lightscalebit;
+ surf->cached_lightmapscalebit = r_lightmapscalebit;
surf->cached_ambient = r_ambient.value;
surf->cached_light[0] = d_lightstylevalue[surf->styles[0]];
surf->cached_light[1] = d_lightstylevalue[surf->styles[1]];
bl = intblocklights;
out = templight;
// deal with lightmap brightness scale
- shift = 7 + lightscalebit + 8;
+ shift = 7 + r_lightmapscalebit + 8;
if (ent->model->lightmaprgba)
{
stride = (surf->lightmaptexturestride - smax) * 4;
// update cached lighting info
surf->cached_dlight = 0;
- surf->cached_lightscalebit = lightscalebit;
+ surf->cached_lightmapscalebit = r_lightmapscalebit;
surf->cached_ambient = r_ambient.value;
surf->cached_light[0] = d_lightstylevalue[surf->styles[0]];
surf->cached_light[1] = d_lightstylevalue[surf->styles[1]];
bl = floatblocklights;
out = templight;
// deal with lightmap brightness scale
- scale = 1.0f / (1 << (7 + lightscalebit + 8));
+ scale = 1.0f / (1 << (7 + r_lightmapscalebit + 8));
if (ent->model->lightmaprgba)
{
stride = (surf->lightmaptexturestride - smax) * 4;
}
}
-void R_StainNode (mnode_t *node, model_t *model, vec3_t origin, float radius, int icolor[8])
+void R_StainNode (mnode_t *node, model_t *model, vec3_t origin, float radius, float fcolor[8])
{
- float ndist;
+ float ndist, a, ratio, maxdist, maxdist2, maxdist3, invradius, sdtable[256], td, dist2;
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;
+ int i, s, t, smax, tmax, smax3, impacts, impactt, stained;
qbyte *bl;
vec3_t impact;
- // LordHavoc: use 64bit integer... shame it's not very standardized...
-#if _MSC_VER || __BORLANDC__
- __int64 k;
-#else
- long long k;
-#endif
-
-
- // for comparisons to minimum acceptable light
- // compensate for 256 offset
- maxdist = radius * radius + 256.0f;
- // clamp radius to avoid exceeding 32768 entry division table
- if (maxdist > 4194304)
- maxdist = 4194304;
-
- subtract = (int) ((1.0f / maxdist) * 4194304.0f);
+ maxdist = radius * radius;
+ invradius = 1.0f / radius;
loc0:
if (node->contents < 0)
goto loc0;
}
- dist2 = ndist * ndist + 256.0f;
- if (dist2 < maxdist)
- {
- maxdist3 = maxdist - dist2;
+ dist2 = ndist * ndist;
+ maxdist3 = maxdist - dist2;
- if (node->plane->type < 3)
- {
- VectorCopy(origin, impact);
- impact[node->plane->type] -= ndist;
- }
- else
- {
- impact[0] = origin[0] - node->plane->normal[0] * ndist;
- impact[1] = origin[1] - node->plane->normal[1] * ndist;
- impact[2] = origin[2] - node->plane->normal[2] * ndist;
- }
+ if (node->plane->type < 3)
+ {
+ VectorCopy(origin, impact);
+ impact[node->plane->type] -= ndist;
+ }
+ else
+ {
+ impact[0] = origin[0] - node->plane->normal[0] * ndist;
+ impact[1] = origin[1] - node->plane->normal[1] * ndist;
+ impact[2] = origin[2] - node->plane->normal[2] * ndist;
+ }
- for (surf = model->surfaces + node->firstsurface, endsurf = surf + node->numsurfaces;surf < endsurf;surf++)
+ for (surf = model->surfaces + node->firstsurface, endsurf = surf + node->numsurfaces;surf < endsurf;surf++)
+ {
+ if (surf->stainsamples)
{
- if (surf->stainsamples)
- {
- smax = (surf->extents[0] >> 4) + 1;
- tmax = (surf->extents[1] >> 4) + 1;
+ smax = (surf->extents[0] >> 4) + 1;
+ tmax = (surf->extents[1] >> 4) + 1;
- impacts = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0];
- impactt = DotProduct (impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1];
+ impacts = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0];
+ impactt = DotProduct (impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1];
- s = bound(0, impacts, smax * 16) - impacts;
- t = bound(0, impactt, tmax * 16) - impactt;
- i = s * s + t * t + dist2;
- if (i > maxdist)
- continue;
+ s = bound(0, impacts, smax * 16) - impacts;
+ t = bound(0, impactt, tmax * 16) - impactt;
+ i = s * s + t * t + dist2;
+ if (i > maxdist)
+ continue;
- // reduce calculations
- for (s = 0, i = impacts; s < smax; s++, i -= 16)
- sdtable[s] = i * i + dist2;
+ // reduce calculations
+ for (s = 0, i = impacts; s < smax; s++, i -= 16)
+ sdtable[s] = i * i + dist2;
- // convert to 8.8 blocklights format
- bl = surf->stainsamples;
- smax3 = smax * 3;
- stained = false;
+ bl = surf->stainsamples;
+ smax3 = smax * 3;
+ stained = false;
- i = impactt;
- for (t = 0;t < tmax;t++, i -= 16)
+ i = impactt;
+ for (t = 0;t < tmax;t++, i -= 16)
+ {
+ td = i * i;
+ // make sure some part of it is visible on this line
+ if (td < maxdist3)
{
- td = i * i;
- // make sure some part of it is visible on this line
- if (td < maxdist3)
+ maxdist2 = maxdist - td;
+ for (s = 0;s < smax;s++)
{
- maxdist2 = maxdist - td;
- for (s = 0;s < smax;s++)
+ if (sdtable[s] < maxdist2)
{
- if (sdtable[s] < maxdist2)
+ ratio = lhrandom(0.0f, 1.0f);
+ a = (fcolor[3] + ratio * fcolor[7]) * (1.0f - sqrt(sdtable[s] + td) * invradius);
+ if (a >= (1.0f / 64.0f))
{
- k = dlightdivtable[(sdtable[s] + td) >> 7] - subtract;
- if (k > 0)
- {
- ratio = rand() & 255;
- ca = (((icolor[7] - icolor[3]) * ratio) >> 8) + icolor[3];
- a = (ca * k) >> 8;
- if (a > 0)
- {
- a = bound(0, a, 256);
- 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] = (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;
- }
- }
+ if (a > 1)
+ a = 1;
+ bl[0] = (qbyte) ((float) bl[0] + a * ((fcolor[0] + ratio * fcolor[4]) - (float) bl[0]));
+ bl[1] = (qbyte) ((float) bl[1] + a * ((fcolor[1] + ratio * fcolor[5]) - (float) bl[1]));
+ bl[2] = (qbyte) ((float) bl[2] + a * ((fcolor[2] + ratio * fcolor[6]) - (float) bl[2]));
+ stained = true;
}
- bl += 3;
}
+ bl += 3;
}
- else // skip line
- bl += smax3;
}
- // force lightmap upload
- if (stained)
- surf->cached_dlight = true;
+ else // skip line
+ bl += smax3;
}
+ // force lightmap upload
+ if (stained)
+ surf->cached_dlight = true;
}
}
{
if (node->children[1]->contents >= 0)
{
- R_StainNode(node->children[0], model, origin, radius, icolor);
+ R_StainNode(node->children[0], model, origin, radius, fcolor);
node = node->children[1];
goto loc0;
}
void R_Stain (vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2)
{
- int n, icolor[8];
+ int n;
+ float fcolor[8];
entity_render_t *ent;
model_t *model;
vec3_t org;
- icolor[0] = cr1;
- icolor[1] = cg1;
- icolor[2] = cb1;
- icolor[3] = ca1;
- icolor[4] = cr2;
- icolor[5] = cg2;
- icolor[6] = cb2;
- icolor[7] = ca2;
+ fcolor[0] = cr1;
+ fcolor[1] = cg1;
+ fcolor[2] = cb1;
+ fcolor[3] = ca1 * (1.0f / 64.0f);
+ fcolor[4] = cr2 - cr1;
+ fcolor[5] = cg2 - cg1;
+ fcolor[6] = cb2 - cb1;
+ fcolor[7] = (ca2 - ca1) * (1.0f / 64.0f);
model = cl.worldmodel;
if (model)
- R_StainNode(model->nodes + model->hulls[0].firstclipnode, model, origin, radius, icolor);
+ R_StainNode(model->nodes + model->hulls[0].firstclipnode, model, origin, radius, fcolor);
// look for embedded bmodels
for (n = 0;n < cl_num_brushmodel_entities;n++)
if (model->type == mod_brush)
{
Matrix4x4_Transform(&ent->inversematrix, origin, org);
- R_StainNode(model->nodes + model->hulls[0].firstclipnode, model, org, radius, icolor);
+ R_StainNode(model->nodes + model->hulls[0].firstclipnode, model, org, radius, fcolor);
}
}
}
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = false;
m.depthwrite = true;
R_Mesh_State(&m);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
- if (skyrendermasked)
- memset(varray_color, 0, mesh->numverts * sizeof(float[4]));
- else
- R_FillColors(varray_color, mesh->numverts, fogcolor[0] * mesh_colorscale, fogcolor[1] * mesh_colorscale, fogcolor[2] * mesh_colorscale, 1);
+ GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
{
const entity_render_t *ent = calldata1;
const msurface_t *surf = ent->model->surfaces + calldata2;
- float f;
+ float f, colorscale;
const surfmesh_t *mesh;
rmeshstate_t m;
float alpha = ent->alpha * (surf->flags & SURF_DRAWNOALPHA ? 1 : r_wateralpha.value);
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(surf->currenttexture->texture);
+ colorscale = r_colorscale;
+ if (gl_combine.integer)
+ {
+ m.texrgbscale[0] = 4;
+ colorscale *= 0.25f;
+ }
R_Mesh_State(&m);
+ GL_UseColorArray();
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
R_Mesh_ResizeCheck(mesh->numverts);
if (surf->flags & SURF_LIGHTMAP)
RSurf_AddLightmapToVertexColors(mesh->lightmapoffsets, varray_color, mesh->numverts, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
}
- RSurf_FogColors(varray_vertex, varray_color, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogColors(varray_vertex, varray_color, colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->fogtexture);
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
if (m.tex[0])
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const msurface_t *surf)
{
- float base;
+ float base, colorscale;
const surfmesh_t *mesh;
rmeshstate_t m;
float modelorg[3];
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(surf->currenttexture->texture);
+ colorscale = r_colorscale;
+ if (gl_combine.integer)
+ {
+ m.texrgbscale[0] = 4;
+ colorscale *= 0.25f;
+ }
base = ent->effects & EF_FULLBRIGHT ? 2.0f : r_ambient.value * (1.0f / 64.0f);
R_Mesh_State(&m);
+ GL_UseColorArray();
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
R_Mesh_ResizeCheck(mesh->numverts);
if (surf->flags & SURF_LIGHTMAP)
RSurf_AddLightmapToVertexColors(mesh->lightmapoffsets, varray_color, mesh->numverts, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
}
- RSurf_FogColors(varray_vertex, varray_color, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogColors(varray_vertex, varray_color, colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->texture);
R_Mesh_State(&m);
+ GL_UseColorArray();
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->glowtexture);
R_Mesh_State(&m);
+ GL_UseColorArray();
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->fogtexture);
R_Mesh_State(&m);
+ GL_UseColorArray();
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
if (m.tex[0])
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
- //m.wantoverbright = false;
m.tex[0] = R_GetTexture(texture->texture);
m.tex[1] = R_GetTexture(texture->surfacechain->lightmaptexture);
m.tex[2] = R_GetTexture(texture->detailtexture);
m.texrgbscale[1] = 4;
m.texrgbscale[2] = 2;
R_Mesh_State(&m);
+ cl = (float) (1 << r_lightmapscalebit) * r_colorscale;
+ GL_Color(cl, cl, cl, 1);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
memcpy(varray_texcoord[1], mesh->uv, mesh->numverts * sizeof(float[2]));
memcpy(varray_texcoord[2], mesh->ab, mesh->numverts * sizeof(float[2]));
- cl = (float) (1 << lightscalebit) * mesh_colorscale;
- R_FillColors(varray_color, mesh->numverts, cl, cl, cl, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
const surfmesh_t *mesh;
rmeshstate_t m;
int lightmaptexturenum;
- float cl;
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(texture->texture);
m.tex[1] = R_GetTexture(texture->surfacechain->lightmaptexture);
+ if (gl_combine.integer)
+ m.texrgbscale[1] = 4;
R_Mesh_State(&m);
+ GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
memcpy(varray_texcoord[1], mesh->uv, mesh->numverts * sizeof(float[2]));
- cl = (float) (1 << lightscalebit) * mesh_colorscale;
- R_FillColors(varray_color, mesh->numverts, cl, cl, cl, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
- //m.wantoverbright = false;
m.tex[0] = R_GetTexture(texture->texture);
R_Mesh_State(&m);
+ GL_Color(1, 1, 1, 1);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- R_FillColors(varray_color, mesh->numverts, 1, 1, 1, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
const surfmesh_t *mesh;
rmeshstate_t m;
int lightmaptexturenum;
- float cl;
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_ZERO;
m.blendfunc2 = GL_SRC_COLOR;
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(texture->surfacechain->lightmaptexture);
+ if (gl_combine.integer)
+ m.texrgbscale[0] = 4;
R_Mesh_State(&m);
+ GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->uv, mesh->numverts * sizeof(float[2]));
- cl = (float) (1 << lightscalebit) * mesh_colorscale;
- R_FillColors(varray_color, mesh->numverts, cl, cl, cl, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
{
const msurface_t *surf;
const surfmesh_t *mesh;
+ float colorscale;
rmeshstate_t m;
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(texture->texture);
+ colorscale = r_colorscale;
+ if (gl_combine.integer)
+ {
+ m.texrgbscale[0] = 4;
+ colorscale *= 0.25f;
+ }
R_Mesh_State(&m);
+ GL_UseColorArray();
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
if (surf->dlightframe == r_framecount)
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
R_FillColors(varray_color, mesh->numverts, 0, 0, 0, 1);
RSurf_LightSeparate(&ent->inversematrix, surf->dlightbits, mesh->numverts, varray_vertex, varray_color);
- RSurf_ScaleColors(varray_color, mesh_colorscale, mesh->numverts);
+ RSurf_ScaleColors(varray_color, colorscale, mesh->numverts);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
- //m.wantoverbright = false;
- //m.tex[0] = 0;
R_Mesh_State(&m);
+ GL_UseColorArray();
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
if (m.tex[0])
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], 1, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], 1, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_DST_COLOR;
m.blendfunc2 = GL_SRC_COLOR;
- //m.wantoverbright = false;
m.tex[0] = R_GetTexture(texture->detailtexture);
R_Mesh_State(&m);
+ GL_Color(1, 1, 1, 1);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->ab, mesh->numverts * sizeof(float[2]));
- R_FillColors(varray_color, mesh->numverts, 1, 1, 1, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- //m.wantoverbright = false;
m.tex[0] = R_GetTexture(texture->glowtexture);
R_Mesh_State(&m);
+ GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- R_FillColors(varray_color, mesh->numverts, mesh_colorscale, mesh_colorscale, mesh_colorscale, 1);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
{
if (surf->cached_dlight
|| surf->cached_ambient != r_ambient.value
- || surf->cached_lightscalebit != lightscalebit)
+ || surf->cached_lightmapscalebit != r_lightmapscalebit)
R_BuildLightMap(ent, surf, false); // base lighting changed
else if (r_dynamic.integer)
{
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
- //m.wantoverbright = false;
R_Mesh_Matrix(&ent->matrix);
R_Mesh_State(&m);
R_Mesh_ResizeCheck(portal->numpoints);
i = portal - ent->model->portals;
- R_FillColors(varray_color, portal->numpoints,
- ((i & 0x0007) >> 0) * (1.0f / 7.0f) * mesh_colorscale,
- ((i & 0x0038) >> 3) * (1.0f / 7.0f) * mesh_colorscale,
- ((i & 0x01C0) >> 6) * (1.0f / 7.0f) * mesh_colorscale,
- 0.125f);
+ GL_Color(((i & 0x0007) >> 0) * (1.0f / 7.0f) * r_colorscale,
+ ((i & 0x0038) >> 3) * (1.0f / 7.0f) * r_colorscale,
+ ((i & 0x01C0) >> 6) * (1.0f / 7.0f) * r_colorscale,
+ 0.125f);
if (PlaneDiff(r_origin, (&portal->plane)) > 0)
{
for (i = portal->numpoints - 1, v = varray_vertex;i >= 0;i--, v += 4)