r_colorscale gone, v_overbrightbits (cvar which controlled r_colorscale) gone
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Sep 2003 22:06:27 +0000 (22:06 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Sep 2003 22:06:27 +0000 (22:06 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3495 d7cf8633-e32d-0410-b094-e92efae38249

15 files changed:
cl_particles.c
cl_video.c
gl_backend.c
gl_backend.h
gl_draw.c
gl_models.c
gl_rmain.c
gl_rsurf.c
menu.c
r_explosion.c
r_shadow.c
r_sky.c
render.h
vid.h
vid_shared.c

index 52b5c9b..9f09eee 100644 (file)
@@ -1832,9 +1832,6 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
                        cb += fogcolor[2] * fog;
                }
        }
-       cr *= r_colorscale;
-       cg *= r_colorscale;
-       cb *= r_colorscale;
 
        GL_Color(cr, cg, cb, ca);
 
index 998f088..debe422 100644 (file)
@@ -103,7 +103,7 @@ void CL_DrawVideo(void)
                texcoord2f[2] = s2;texcoord2f[3] = t1;
                texcoord2f[4] = s2;texcoord2f[5] = t2;
                texcoord2f[6] = s1;texcoord2f[7] = t2;
-               R_FillColors(color4f, 4, r_colorscale, r_colorscale, r_colorscale, 1);
+               R_FillColors(color4f, 4, 1, 1, 1, 1);
                vertex3f[ 0] = x1;vertex3f[ 1] = y1;vertex3f[ 2] = 0;
                vertex3f[ 3] = x2;vertex3f[ 4] = y1;vertex3f[ 5] = 0;
                vertex3f[ 6] = x2;vertex3f[ 7] = y2;vertex3f[ 8] = 0;
index 6d2f7b9..c3eef34 100644 (file)
@@ -74,7 +74,6 @@ void SCR_ScreenShot_f (void);
 
 // these are externally accessible
 int r_lightmapscalebit;
-float r_colorscale;
 
 static matrix4x4_t backend_viewmatrix;
 static matrix4x4_t backend_modelmatrix;
@@ -994,7 +993,6 @@ void R_Mesh_State_Texture(const rmeshstate_t *m)
 qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg)
 {
        qboolean ret;
-       int i, j;
        qbyte *buffer;
 
        if (!r_render.integer)
@@ -1004,16 +1002,6 @@ qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qbo
        qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
        CHECKGLERROR
 
-       // LordHavoc: compensate for v_overbrightbits when using hardware gamma
-       if (v_hwgamma.integer)
-       {
-               for (i = 0;i < width * height * 3;i++)
-               {
-                       j = buffer[i] << v_overbrightbits.integer;
-                       buffer[i] = (qbyte) (bound(0, j, 255));
-               }
-       }
-
        if (jpeg)
                ret = JPEG_SaveImage_preflipped (filename, width, height, buffer);
        else
@@ -1078,11 +1066,8 @@ void SCR_UpdateScreen (void)
        if (gl_combine.integer && (!gl_combine_extension || r_textureunits.integer < 2))
                Cvar_SetValueQuick(&gl_combine, 0);
 
-       // lighting scale
-       r_colorscale = 1.0f / (float) (1 << v_overbrightbits.integer);
-
        // lightmaps only
-       r_lightmapscalebit = v_overbrightbits.integer;
+       r_lightmapscalebit = 0;
        if (gl_combine.integer && r_textureunits.integer > 1)
                r_lightmapscalebit += 2;
 
index 435f48f..584332c 100644 (file)
@@ -49,9 +49,8 @@ typedef struct
 }
 rmeshstate_t;
 
-// overbright rendering scale for the current state
+// lightmap overbright scaling
 extern int r_lightmapscalebit;
-extern float r_colorscale;
 
 // adds console variables and registers the render module (only call from GL_Init)
 void gl_backend_init(void);
index 4ef340d..6304fb8 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -378,7 +378,7 @@ float blendvertex3f[9] = {-5000, -5000, 10, 10000, -5000, 10, -5000, 10000, 10};
 int quadelements[768];
 void R_DrawQueue(void)
 {
-       int pos, num, chartexnum, overbright, texnum, batch;
+       int pos, num, chartexnum, texnum, batch;
        float x, y, w, h, s, t, u, v, *av, *at, c[4];
        cachepic_t *pic;
        drawqueue_t *dq;
@@ -421,27 +421,26 @@ void R_DrawQueue(void)
        texnum = 0;
        color = 0;
 
-       overbright = v_overbrightbits.integer;
        batch = false;
        batchcount = 0;
        for (pos = 0;pos < r_refdef.drawqueuesize;pos += ((drawqueue_t *)(r_refdef.drawqueue + pos))->size)
        {
                dq = (drawqueue_t *)(r_refdef.drawqueue + pos);
                color = dq->color;
-               
+
                if(dq->flags & DRAWFLAG_ADDITIVE)
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
                else if(dq->flags & DRAWFLAG_MODULATE)
                        GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
                else
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-               
+
                GL_DepthMask(true);
                GL_DepthTest(false);
 
-               c[0] = (float) ((color >> 24) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
-               c[1] = (float) ((color >> 16) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
-               c[2] = (float) ((color >>  8) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
+               c[0] = (float) ((color >> 24) & 0xFF) * (1.0f / 255.0f);
+               c[1] = (float) ((color >> 16) & 0xFF) * (1.0f / 255.0f);
+               c[2] = (float) ((color >>  8) & 0xFF) * (1.0f / 255.0f);
                c[3] = (float) ( color        & 0xFF) * (1.0f / 255.0f);
                x = dq->x;
                y = dq->y;
@@ -524,7 +523,6 @@ void R_DrawQueue(void)
                }
                else
                        c[0] = c[1] = c[2] = v_contrast.value;
-               VectorScale(c, (float) (1 << v_overbrightbits.integer), c);
                if (c[0] >= 1.01f || c[1] >= 1.01f || c[2] >= 1.01f)
                {
                        GL_BlendFunc(GL_DST_COLOR, GL_ONE);
index 7d3a700..59f6ff0 100644 (file)
@@ -221,7 +221,7 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                GL_DepthTest(true);
                firstpass = false;
                expandaliasvert(mesh->num_vertices);
-               colorscale = r_colorscale;
+               colorscale = 1.0f;
 
                memset(&m, 0, sizeof(m));
                if (layer->texture != NULL)
@@ -800,7 +800,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
        GL_VertexPointer(varray_vertex3f);
 
        memset(&mstate, 0, sizeof(mstate));
-       colorscale = r_colorscale;
+       colorscale = 1.0f;
        if (gl_combine.integer)
        {
                mstate.texrgbscale[0] = 4;
@@ -837,7 +837,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                //mstate.pointer_texcoord = ent->model->alias.zymdata_texcoords;
                R_Mesh_State_Texture(&mstate);
 
-               GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, ent->alpha * fog);
+               GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha * fog);
                ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts);
                R_Mesh_Draw(numverts, numtriangles, elements);
                c_alias_polys += numtriangles;
index 4aa52d4..c30c0a9 100644 (file)
@@ -569,7 +569,7 @@ void R_ShadowVolumeLighting(int visiblevolumes)
                GL_DepthMask(false);
                GL_DepthTest(r_shadow_visiblevolumes.integer < 2);
                qglDisable(GL_CULL_FACE);
-               GL_Color(0.0 * r_colorscale, 0.0125 * r_colorscale, 0.1 * r_colorscale, 1);
+               GL_Color(0.0, 0.0125, 0.1, 1);
        }
        else
                R_Shadow_Stage_Begin();
@@ -993,7 +993,7 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
        vertex3f[18] = mins[0];vertex3f[19] = maxs[1];vertex3f[20] = maxs[2];
        vertex3f[21] = maxs[0];vertex3f[22] = maxs[1];vertex3f[23] = maxs[2];
        GL_ColorPointer(color);
-       R_FillColors(color, 8, cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
+       R_FillColors(color, 8, cr, cg, cb, ca);
        if (fogenabled)
        {
                for (i = 0, v = vertex, c = color;i < 8;i++, v += 4, c += 4)
@@ -1001,7 +1001,6 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
                        VectorSubtract(v, r_origin, diff);
                        f2 = exp(fogdensity/DotProduct(diff, diff));
                        f1 = 1 - f2;
-                       f2 *= r_colorscale;
                        c[0] = c[0] * f1 + fogcolor[0] * f2;
                        c[1] = c[1] * f1 + fogcolor[1] * f2;
                        c[2] = c[2] * f1 + fogcolor[2] * f2;
@@ -1081,23 +1080,18 @@ void R_DrawNoModelCallback(const void *calldata1, int calldata2)
                f1 = 1 - f2;
                for (i = 0, c = color4f;i < 6;i++, c += 4)
                {
-                       c[0] = (c[0] * f1 + fogcolor[0] * f2) * r_colorscale;
-                       c[1] = (c[1] * f1 + fogcolor[1] * f2) * r_colorscale;
-                       c[2] = (c[2] * f1 + fogcolor[2] * f2) * r_colorscale;
+                       c[0] = (c[0] * f1 + fogcolor[0] * f2);
+                       c[1] = (c[1] * f1 + fogcolor[1] * f2);
+                       c[2] = (c[2] * f1 + fogcolor[2] * f2);
                        c[3] *= ent->alpha;
                }
        }
-       else if (r_colorscale != 1 || ent->alpha != 1)
+       else if (ent->alpha != 1)
        {
                memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
                GL_ColorPointer(color4f);
                for (i = 0, c = color4f;i < 6;i++, c += 4)
-               {
-                       c[0] *= r_colorscale;
-                       c[1] *= r_colorscale;
-                       c[2] *= r_colorscale;
                        c[3] *= ent->alpha;
-               }
        }
        else
                GL_ColorPointer(nomodelcolor4f);
@@ -1157,7 +1151,7 @@ void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, int depth
        }
 
        R_Mesh_Matrix(&r_identitymatrix);
-       GL_Color(cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
+       GL_Color(cr, cg, cb, ca);
        GL_VertexPointer(varray_vertex3f);
        GL_BlendFunc(blendfunc1, blendfunc2);
        GL_DepthMask(false);
index 5d59e57..b0b286a 100644 (file)
@@ -742,7 +742,7 @@ static void RSurfShader_Sky(const entity_render_t *ent, const texture_t *texture
 
        R_Mesh_Matrix(&ent->matrix);
 
-       GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
+       GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
        if (skyrendermasked)
        {
                // depth-only (masking)
@@ -780,7 +780,7 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
 {
        const entity_render_t *ent = calldata1;
        const msurface_t *surf = ent->model->brushq1.surfaces + calldata2;
-       float f, colorscale;
+       float colorscale;
        const surfmesh_t *mesh;
        rmeshstate_t m;
        float alpha;
@@ -829,14 +829,28 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
        }
        else
                m.tex[0] = R_GetTexture(texture->skin.base);
-       colorscale = r_colorscale;
+       colorscale = 1;
        if (gl_combine.integer)
        {
                m.texrgbscale[0] = 4;
                colorscale *= 0.25f;
        }
        GL_DepthTest(true);
-       GL_ColorPointer(varray_color4f);
+       if (fogenabled)
+               GL_ColorPointer(varray_color4f);
+       else
+               GL_Color(1, 1, 1, alpha);
+       if (gl_textureshader && r_watershader.integer)
+       {
+               GL_ActiveTexture (0);
+               qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
+               GL_ActiveTexture (1);
+               qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
+               qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_OFFSET_TEXTURE_2D_NV);
+               qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);
+               qglTexEnvfv (GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, &args[0]);
+               qglEnable (GL_TEXTURE_SHADER_NV);
+       }
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                GL_VertexPointer(mesh->vertex3f);
@@ -844,33 +858,17 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                m.pointer_texcoord[1] = mesh->texcoordtexture2f;
                m.texcombinergb[1] = GL_REPLACE;
                R_Mesh_State_Texture(&m);
-               f = surf->flags & SURF_DRAWFULLBRIGHT ? 1.0f : ((surf->flags & SURF_LIGHTMAP) ? 0 : 0.5f);
-               R_FillColors(varray_color4f, mesh->numverts, f, f, f, alpha);
-               if (!(surf->flags & SURF_DRAWFULLBRIGHT || ent->effects & EF_FULLBRIGHT))
-               {
-                       if (surf->dlightframe == r_framecount)
-                               RSurf_LightSeparate_Vertex3f_Color4f(&ent->inversematrix, surf->dlightbits, mesh->numverts, mesh->vertex3f, varray_color4f, 1);
-                       if (surf->flags & SURF_LIGHTMAP)
-                               RSurf_AddLightmapToVertexColors_Color4f(mesh->lightmapoffsets, varray_color4f, mesh->numverts, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
-               }
-               RSurf_FogColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, colorscale, mesh->numverts, modelorg);
-               if (gl_textureshader && r_watershader.integer)
+               if (fogenabled)
                {
-                       GL_ActiveTexture (0);
-                       qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
-                       GL_ActiveTexture (1);
-                       qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
-                       qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_OFFSET_TEXTURE_2D_NV);
-                       qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);
-                       qglTexEnvfv (GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, &args[0]);
-                       qglEnable (GL_TEXTURE_SHADER_NV);
+                       R_FillColors(varray_color4f, mesh->numverts, 1, 1, 1, alpha);
+                       RSurf_FogColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, colorscale, mesh->numverts, modelorg);
                }
                R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
-               if (gl_textureshader && r_watershader.integer)
-               {
-                       qglDisable (GL_TEXTURE_SHADER_NV);
-                       GL_ActiveTexture (0);
-               }
+       }
+       if (gl_textureshader && r_watershader.integer)
+       {
+               qglDisable (GL_TEXTURE_SHADER_NV);
+               GL_ActiveTexture (0);
        }
 
        if (fogenabled)
@@ -886,7 +884,7 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                        m.pointer_texcoord[0] = mesh->texcoordtexture2f;
                        GL_ColorPointer(varray_color4f);
                        R_Mesh_State_Texture(&m);
-                       RSurf_FogPassColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], alpha, r_colorscale, mesh->numverts, modelorg);
+                       RSurf_FogPassColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], alpha, 1, mesh->numverts, modelorg);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
                }
        }
@@ -945,21 +943,29 @@ static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const m
                GL_DepthMask(true);
        }
        m.tex[0] = R_GetTexture(texture->skin.base);
+       colorscale = 1;
+       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);
        GL_DepthTest(true);
-       if (fogenabled)
-               GL_ColorPointer(varray_color4f);
-       else
-               GL_Color(r_colorscale, r_colorscale, r_colorscale, currentalpha);
+       GL_ColorPointer(varray_color4f);
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                GL_VertexPointer(mesh->vertex3f);
                m.pointer_texcoord[0] = mesh->texcoordtexture2f;
                R_Mesh_State_Texture(&m);
-               if (fogenabled)
+               R_FillColors(varray_color4f, mesh->numverts, base, base, base, currentalpha);
+               if (!(ent->effects & EF_FULLBRIGHT))
                {
-                       R_FillColors(varray_color4f, mesh->numverts, 1.0f, 1.0f, 1.0f, currentalpha);
-                       RSurf_FogColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, r_colorscale, mesh->numverts, modelorg);
+                       if (surf->dlightframe == r_framecount)
+                               RSurf_LightSeparate_Vertex3f_Color4f(&ent->inversematrix, surf->dlightbits, mesh->numverts, mesh->vertex3f, varray_color4f, 1);
+                       if (surf->flags & SURF_LIGHTMAP)
+                               RSurf_AddLightmapToVertexColors_Color4f(mesh->lightmapoffsets, varray_color4f, mesh->numverts, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
                }
+               RSurf_FogColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, colorscale, mesh->numverts, modelorg);
                R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
        }
 }
@@ -982,7 +988,7 @@ static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurfac
                if (m.tex[0])
                        m.pointer_texcoord[0] = mesh->texcoordtexture2f;
                R_Mesh_State_Texture(&m);
-               RSurf_FoggedColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, 1, 1, 1, currentalpha, r_colorscale, mesh->numverts, modelorg);
+               RSurf_FoggedColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, 1, 1, 1, currentalpha, 1, mesh->numverts, modelorg);
                R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
        }
 }
@@ -1005,7 +1011,7 @@ static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface
                if (m.tex[0])
                        m.pointer_texcoord[0] = mesh->texcoordtexture2f;
                R_Mesh_State_Texture(&m);
-               RSurf_FogPassColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], currentalpha, r_colorscale, mesh->numverts, modelorg);
+               RSurf_FogPassColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], currentalpha, 1, mesh->numverts, modelorg);
                R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
        }
 }
@@ -1027,7 +1033,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
        m.texrgbscale[0] = 1;
        m.texrgbscale[1] = 4;
        m.texrgbscale[2] = 2;
-       cl = (float) (1 << r_lightmapscalebit) * r_colorscale;
+       cl = (float) (1 << r_lightmapscalebit);
        GL_Color(cl, cl, cl, 1);
 
        while((surf = *surfchain++) != NULL)
@@ -1067,7 +1073,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseDoubleTex(const entity_render_t *ent
        m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
        if (gl_combine.integer)
                m.texrgbscale[1] = 4;
-       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+       GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
                if (surf->visframe == r_framecount)
@@ -1129,7 +1135,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
        m.tex[0] = R_GetTexture((**surfchain).lightmaptexture);
        if (gl_combine.integer)
                m.texrgbscale[0] = 4;
-       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+       GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
                if (surf->visframe == r_framecount)
@@ -1163,7 +1169,7 @@ static void RSurfShader_OpaqueWall_Pass_Light(const entity_render_t *ent, const
        GL_DepthMask(false);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(texture->skin.base);
-       colorscale = r_colorscale;
+       colorscale = 1;
        if (gl_combine.integer)
        {
                m.texrgbscale[0] = 4;
@@ -1212,7 +1218,7 @@ static void RSurfShader_OpaqueWall_Pass_Fog(const entity_render_t *ent, const te
                                if (m.tex[0])
                                        m.pointer_texcoord[0] = mesh->texcoordtexture2f;
                                R_Mesh_State_Texture(&m);
-                               RSurf_FogPassColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], 1, r_colorscale, mesh->numverts, modelorg);
+                               RSurf_FogPassColors_Vertex3f_Color4f(mesh->vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], 1, 1, mesh->numverts, modelorg);
                                R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
                        }
                }
@@ -1255,7 +1261,7 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
        GL_DepthMask(false);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(texture->skin.glow);
-       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+       GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
                if (surf->visframe == r_framecount)
@@ -1281,7 +1287,7 @@ static void RSurfShader_OpaqueWall_Pass_OpaqueGlow(const entity_render_t *ent, c
        GL_DepthMask(true);
        m.tex[0] = R_GetTexture(texture->skin.glow);
        if (m.tex[0])
-               GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+               GL_Color(1, 1, 1, 1);
        else
                GL_Color(0, 0, 0, 1);
        while((surf = *surfchain++) != NULL)
@@ -1313,8 +1319,6 @@ static void RSurfShader_Wall_Vertex_Callback(const void *calldata1, int calldata
                texture = texture->anim_frames[ent->frame != 0][(texture->anim_total[ent->frame != 0] >= 2) ? ((int) (cl.time * 5.0f) % texture->anim_total[ent->frame != 0]) : 0];
 
        currentalpha = ent->alpha;
-       if (texture->flags & SURF_WATERALPHA)
-               currentalpha *= r_wateralpha.value;
        if (ent->effects & EF_ADDITIVE)
                rendertype = SURFRENDER_ADD;
        else if (currentalpha < 1 || texture->skin.fog != NULL)
@@ -1534,9 +1538,9 @@ static void R_DrawPortal_Callback(const void *calldata1, int calldata2)
        R_Mesh_State_Texture(&m);
 
        i = portal - ent->model->brushq1.portals;
-       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,
+       GL_Color(((i & 0x0007) >> 0) * (1.0f / 7.0f),
+                        ((i & 0x0038) >> 3) * (1.0f / 7.0f),
+                        ((i & 0x01C0) >> 6) * (1.0f / 7.0f),
                         0.125f);
        if (PlaneDiff(r_origin, (&portal->plane)) < 0)
        {
@@ -1927,7 +1931,7 @@ void R_DrawCollisionBrush(colbrushf_t *brush)
 {
        int i;
        i = ((int)brush) / sizeof(colbrushf_t);
-       GL_Color((i & 31) * (1.0f / 32.0f) * r_colorscale, ((i >> 5) & 31) * (1.0f / 32.0f) * r_colorscale, ((i >> 10) & 31) * (1.0f / 32.0f) * r_colorscale, 0.2f);
+       GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
        GL_VertexPointer(brush->points->v);
        R_Mesh_Draw(brush->numpoints, brush->numtriangles, brush->elements);
 }
@@ -1950,7 +1954,7 @@ void R_Q3BSP_DrawFace(entity_render_t *ent, q3mface_t *face)
 
                        R_Mesh_Matrix(&ent->matrix);
 
-                       GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
+                       GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
                        if (skyrendermasked)
                        {
                                // depth-only (masking)
@@ -1991,7 +1995,7 @@ void R_Q3BSP_DrawFace(entity_render_t *ent, q3mface_t *face)
                m.tex[1] = R_GetTexture(face->lightmaptexture);
                m.pointer_texcoord[1] = face->data_texcoordlightmap2f;
                m.texrgbscale[1] = 2;
-               GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+               GL_Color(1, 1, 1, 1);
        }
        else
        {
diff --git a/menu.c b/menu.c
index 9e393c8..c618eb5 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -1111,7 +1111,7 @@ void M_DrawCheckbox (int x, int y, int on)
 }
 
 
-#define OPTIONS_ITEMS 33
+#define OPTIONS_ITEMS 32
 
 int options_cursor;
 
@@ -1150,8 +1150,6 @@ void M_Menu_Options_AdjustSliders (int dir)
        else if (options_cursor == optnum++)
                Cvar_SetValueQuick (&r_sky, !r_sky.integer);
        else if (options_cursor == optnum++)
-               Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
-       else if (options_cursor == optnum++)
                Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
        else if (options_cursor == optnum++)
                Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
@@ -1275,7 +1273,6 @@ void M_Options_Draw (void)
        M_Options_PrintSlider(  "       Screen size", true, scr_viewsize.value, 30, 120);
        M_Options_PrintCheckbox("  JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer);
        M_Options_PrintCheckbox("               Sky", true, r_sky.integer);
-       M_Options_PrintSlider(  "   Overbright Bits", true, v_overbrightbits.value, 0, 4);
        M_Options_PrintCheckbox("   Texture Combine", true, gl_combine.integer);
        M_Options_PrintCheckbox("         Dithering", true, gl_dither.integer);
        M_Options_PrintCheckbox("Delay gfx (faster)", true, gl_delayfinish.integer);
index de58633..45b7f5c 100644 (file)
@@ -187,7 +187,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
 
        numtriangles = EXPLOSIONTRIS;
        numverts = EXPLOSIONVERTS;
-       alpha = e->alpha * r_colorscale;
+       alpha = e->alpha;
        GL_Color(alpha, alpha, alpha, 1);
        GL_VertexPointer(e->vert[0]);
 
index 453d0a4..9782378 100644 (file)
@@ -1238,7 +1238,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        if (lightcubemap)
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltofilter);
-                       VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+                       VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
                        for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
                        {
                                color[0] = bound(0, color2[0], 1);
@@ -1288,7 +1288,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        if (lightcubemap)
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltofilter);
-                       VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+                       VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
                        for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
                        {
                                color[0] = bound(0, color2[0], 1);
@@ -1327,7 +1327,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        qglColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
-                       VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+                       VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
                        for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
                        {
                                color[0] = bound(0, color2[0], 1);
@@ -1373,7 +1373,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        if (lightcubemap)
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltofilter);
-                       VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+                       VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
                        for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
                        {
                                color[0] = bound(0, color2[0], 1);
@@ -1426,7 +1426,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        if (lightcubemap)
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltofilter);
-                       VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+                       VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
                        for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
                        {
                                color[0] = bound(0, color2[0], 1);
@@ -1445,7 +1445,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                GL_DepthMask(false);
                GL_DepthTest(true);
                GL_ColorPointer(varray_color4f);
-               VectorScale(lightcolor, r_colorscale * r_shadow_lightintensityscale.value, color2);
+               VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
                memset(&m, 0, sizeof(m));
                m.tex[0] = R_GetTexture(basetexture);
                m.pointer_texcoord[0] = texcoord2f;
@@ -1484,7 +1484,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                glosstexture = r_shadow_blankglosstexture;
        if (r_shadow_gloss.integer >= 2 || (r_shadow_gloss.integer >= 1 && glosstexture != r_shadow_blankglosstexture))
        {
-               colorscale = r_colorscale * r_shadow_glossintensity.value;
+               colorscale = r_shadow_glossintensity.value;
                if (!bumptexture)
                        bumptexture = r_shadow_blankbumptexture;
                if (glosstexture == r_shadow_blankglosstexture)
diff --git a/r_sky.c b/r_sky.c
index ae126cf..c216ed2 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -210,7 +210,7 @@ static void R_SkyBox(void)
 {
        int i;
        rmeshstate_t m;
-       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+       GL_Color(1, 1, 1, 1);
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);
@@ -306,7 +306,7 @@ static void R_SkySphere(void)
        Matrix4x4_CreateIdentity(&identitymatrix);
 
        GL_VertexPointer(skysphere_vertex3f);
-       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+       GL_Color(1, 1, 1, 1);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);
        GL_DepthTest(false); // don't modify or read zbuffer
@@ -314,7 +314,7 @@ static void R_SkySphere(void)
        m.tex[0] = R_GetTexture(solidskytexture);
        m.pointer_texcoord[0] = skysphere_texcoord2f;
        R_Mesh_TextureMatrix(0, &scroll1matrix);
-       if (r_colorscale == 1 && r_textureunits.integer >= 2)
+       if (r_textureunits.integer >= 2)
        {
                // one pass using GL_DECAL or GL_INTERPOLATE_ARB for alpha layer
                // LordHavoc: note that color is not set here because it does not
index b8c6b84..96c2c67 100644 (file)
--- a/render.h
+++ b/render.h
@@ -148,8 +148,6 @@ void R_Mesh_EnlargeFarClipBBox(vec3_t mins, vec3_t maxs);
 
 #include "meshqueue.h"
 
-extern float overbrightscale;
-
 #include "r_lerpanim.h"
 
 extern cvar_t r_render;
diff --git a/vid.h b/vid.h
index 602238c..2280e2b 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -67,7 +67,6 @@ extern cvar_t v_color_grey_b;
 extern cvar_t v_color_white_r;
 extern cvar_t v_color_white_g;
 extern cvar_t v_color_white_b;
-extern cvar_t v_overbrightbits;
 extern cvar_t v_hwgamma;
 
 extern int gl_stencil;
index 1a456d9..4bdc2e0 100644 (file)
@@ -78,7 +78,6 @@ cvar_t v_color_grey_b = {CVAR_SAVE, "v_color_grey_b", "0.5"};
 cvar_t v_color_white_r = {CVAR_SAVE, "v_color_white_r", "1"};
 cvar_t v_color_white_g = {CVAR_SAVE, "v_color_white_g", "1"};
 cvar_t v_color_white_b = {CVAR_SAVE, "v_color_white_b", "1"};
-cvar_t v_overbrightbits = {CVAR_SAVE, "v_overbrightbits", "0"};
 cvar_t v_hwgamma = {CVAR_SAVE, "v_hwgamma", "1"};
 
 // brand of graphics chip
@@ -560,7 +559,7 @@ void IN_Mouse(usercmd_t *cmd, float mx, float my)
 }
 
 static float cachegamma, cachebrightness, cachecontrast, cacheblack[3], cachegrey[3], cachewhite[3];
-static int cacheoverbrightbits = -1, cachecolorenable, cachehwgamma;
+static int cachecolorenable, cachehwgamma;
 #define BOUNDCVAR(cvar, m1, m2) c = &(cvar);f = bound(m1, c->value, m2);if (c->value != f) Cvar_SetValueQuick(c, f);
 void VID_UpdateGamma(qboolean force)
 {
@@ -573,7 +572,6 @@ void VID_UpdateGamma(qboolean force)
 
        if (!force
         && vid_usinghwgamma == (vid_allowhwgamma && v_hwgamma.integer)
-        && v_overbrightbits.integer == cacheoverbrightbits
         && v_gamma.value == cachegamma
         && v_contrast.value == cachecontrast
         && v_brightness.value == cachebrightness
@@ -610,20 +608,19 @@ void VID_UpdateGamma(qboolean force)
                BOUNDCVAR(v_color_white_g, 1, 5);cachewhite[1] = v_color_white_g.value;
                BOUNDCVAR(v_color_white_b, 1, 5);cachewhite[2] = v_color_white_b.value;
                cachecolorenable = v_color_enable.integer;
-               cacheoverbrightbits = v_overbrightbits.integer;
                cachehwgamma = v_hwgamma.integer;
 
                if (cachecolorenable)
                {
-                       BuildGammaTable16((float) (1 << cacheoverbrightbits), invpow(0.5, 1 - cachegrey[0]), cachewhite[0], cacheblack[0], vid_gammaramps);
-                       BuildGammaTable16((float) (1 << cacheoverbrightbits), invpow(0.5, 1 - cachegrey[1]), cachewhite[1], cacheblack[1], vid_gammaramps + 256);
-                       BuildGammaTable16((float) (1 << cacheoverbrightbits), invpow(0.5, 1 - cachegrey[2]), cachewhite[2], cacheblack[2], vid_gammaramps + 512);
+                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[0]), cachewhite[0], cacheblack[0], vid_gammaramps);
+                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[1]), cachewhite[1], cacheblack[1], vid_gammaramps + 256);
+                       BuildGammaTable16(1.0f, invpow(0.5, 1 - cachegrey[2]), cachewhite[2], cacheblack[2], vid_gammaramps + 512);
                }
                else
                {
-                       BuildGammaTable16((float) (1 << cacheoverbrightbits), cachegamma, cachecontrast, cachebrightness, vid_gammaramps);
-                       BuildGammaTable16((float) (1 << cacheoverbrightbits), cachegamma, cachecontrast, cachebrightness, vid_gammaramps + 256);
-                       BuildGammaTable16((float) (1 << cacheoverbrightbits), cachegamma, cachecontrast, cachebrightness, vid_gammaramps + 512);
+                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps);
+                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + 256);
+                       BuildGammaTable16(1.0f, cachegamma, cachecontrast, cachebrightness, vid_gammaramps + 512);
                }
 
                vid_hardwaregammasupported = VID_SetGamma(vid_gammaramps);
@@ -665,7 +662,6 @@ void VID_Shared_Init(void)
        Cvar_RegisterVariable(&v_color_white_b);
 
        Cvar_RegisterVariable(&v_hwgamma);
-       Cvar_RegisterVariable(&v_overbrightbits);
 
        Cvar_RegisterVariable(&vid_fullscreen);
        Cvar_RegisterVariable(&vid_width);