]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
m.wantoverbright is gone
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Sep 2002 01:40:59 +0000 (01:40 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Sep 2002 01:40:59 +0000 (01:40 +0000)
done manually by the few things that wanted it (tweaking the texrgbscale in other words, and their own local colorscale variables)
mesh_colorscale renamed to r_colorscale, and now available throughout rendering (no need to wait for the results of R_Mesh_State before scaling your colors)
lightscalebit renamed to r_lightmapscalebit
lightscale is gone (wasn't used)
msurface_t cached_lightscalebit renamed accordingly to cached_lightmapscalebit
starting work on converting the 2D system to use R_Mesh calls

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2383 d7cf8633-e32d-0410-b094-e92efae38249

15 files changed:
cl_particles.c
gl_backend.c
gl_backend.h
gl_draw.c
gl_models.c
gl_rmain.c
gl_rsurf.c
model_brush.c
model_brush.h
r_crosshairs.c
r_explosion.c
r_light.c
r_sky.c
r_sprites.c
render.h

index 6b275a1a58d8ea64d33ea531d8bebbce732a6818..9342d8edc6b19dcc4430fa2563145ed8e67d5f74 100644 (file)
@@ -1273,9 +1273,9 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
                        cb += fogcolor[2] * fog;
                }
        }
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = cr * mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = cg * mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = cb * mesh_colorscale;
+       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = cr * r_colorscale;
+       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = cg * r_colorscale;
+       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = cb * r_colorscale;
        varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = ca;
        R_Mesh_Draw(4, 2, polygonelements);
 }
index fc9ae38d54a67723c109872c3041fdf7197f0532..620633336f9fad77f4fbcaef628dc044e3391416 100644 (file)
@@ -65,14 +65,11 @@ void GL_PrintError(int errornumber, char *filename, int linenumber)
 
 int c_meshs, c_meshelements;
 
-int lightscalebit;
-float lightscale;
-float overbrightscale;
-
 void SCR_ScreenShot_f (void);
 
 // these are externally accessible
-float mesh_colorscale;
+int r_lightmapscalebit;
+float r_colorscale;
 float *varray_vertex;
 float *varray_color;
 float *varray_texcoord[MAX_TEXTUREUNITS];
@@ -608,40 +605,10 @@ void R_Mesh_Matrix(const matrix4x4_t *matrix)
 }
 
 // sets up the requested state
-void R_Mesh_State(const rmeshstate_t *m)
+void R_Mesh_MainState(const rmeshstate_t *m)
 {
-       int i, overbright;
-       int texturergbscale[MAX_TEXTUREUNITS];
-       float scaler;
-
        BACKENDACTIVECHECK
 
-       if (gl_backend_rebindtextures)
-       {
-               gl_backend_rebindtextures = false;
-               GL_SetupTextureState();
-       }
-
-       overbright = false;
-       scaler = 1;
-       if (m->blendfunc1 == GL_DST_COLOR)
-       {
-               // check if it is a 2x modulate with framebuffer
-               if (m->blendfunc2 == GL_SRC_COLOR)
-                       scaler *= 0.5f;
-       }
-       else if (m->blendfunc2 != GL_SRC_COLOR)
-       {
-               if (m->tex[0])
-               {
-                       overbright = m->wantoverbright && gl_combine.integer;
-                       if (overbright)
-                               scaler *= 0.25f;
-               }
-               scaler *= overbrightscale;
-       }
-       mesh_colorscale = scaler;
-
        if (gl_state.blendfunc1 != m->blendfunc1 || gl_state.blendfunc2 != m->blendfunc2)
        {
                qglBlendFunc(gl_state.blendfunc1 = m->blendfunc1, gl_state.blendfunc2 = m->blendfunc2);CHECKGLERROR
@@ -685,6 +652,20 @@ void R_Mesh_State(const rmeshstate_t *m)
        {
                qglDepthMask(gl_state.depthmask = (m->blendfunc2 == GL_ZERO || m->depthwrite));CHECKGLERROR
        }
+}
+
+void R_Mesh_TextureState(const rmeshstate_t *m)
+{
+       int i;
+       int texturergbscale[MAX_TEXTUREUNITS];
+
+       BACKENDACTIVECHECK
+
+       if (gl_backend_rebindtextures)
+       {
+               gl_backend_rebindtextures = false;
+               GL_SetupTextureState();
+       }
 
        for (i = 0;i < backendunits;i++)
        {
@@ -693,17 +674,6 @@ void R_Mesh_State(const rmeshstate_t *m)
                else
                        texturergbscale[i] = 1;
        }
-       if (overbright)
-       {
-               for (i = backendunits - 1;i >= 0;i--)
-               {
-                       if (m->tex[i])
-                       {
-                               texturergbscale[i] = 4;
-                               break;
-                       }
-               }
-       }
 
        if (backendunits > 1)
        {
@@ -764,6 +734,12 @@ void R_Mesh_State(const rmeshstate_t *m)
        }
 }
 
+void R_Mesh_State(const rmeshstate_t *m)
+{
+       R_Mesh_MainState(m);
+       R_Mesh_TextureState(m);
+}
+
 /*
 ==============================================================================
 
@@ -841,13 +817,12 @@ void SCR_UpdateScreen (void)
                Cvar_SetValueQuick(&gl_combine, 0);
 
        // lighting scale
-       overbrightscale = 1.0f / (float) (1 << v_overbrightbits.integer);
+       r_colorscale = 1.0f / (float) (1 << v_overbrightbits.integer);
 
        // lightmaps only
-       lightscalebit = v_overbrightbits.integer;
+       r_lightmapscalebit = v_overbrightbits.integer;
        if (gl_combine.integer && r_textureunits.integer > 1)
-               lightscalebit += 2;
-       lightscale = 1.0f / (float) (1 << lightscalebit);
+               r_lightmapscalebit += 2;
 
        R_TimeReport("setup");
 
index 3e1a17c29a4de031159a38dc5ee7caa47e689753..624df46a1c0510996f334c527949f1abb98a1e0e 100644 (file)
@@ -28,14 +28,15 @@ typedef struct
        int depthdisable; // disable depth read/write entirely
        int blendfunc1;
        int blendfunc2;
-       int wantoverbright;
+       //int wantoverbright;
        int tex[MAX_TEXTUREUNITS];
        int texrgbscale[MAX_TEXTUREUNITS]; // used only if COMBINE is present
 }
 rmeshstate_t;
 
 // overbright rendering scale for the current state
-extern float mesh_colorscale;
+extern int r_lightmapscalebit;
+extern float r_colorscale;
 extern float *varray_vertex;
 extern float *varray_color;
 extern float *varray_texcoord[MAX_TEXTUREUNITS];
@@ -57,6 +58,12 @@ void R_Mesh_Matrix(const matrix4x4_t *matrix);
 // sets up the requested state
 void R_Mesh_State(const rmeshstate_t *m);
 
+// sets up the requested main state
+void R_Mesh_MainState(const rmeshstate_t *m);
+
+// sets up the requested texture state
+void R_Mesh_TextureState(const rmeshstate_t *m);
+
 // enlarges vertex arrays if they are too small
 #define R_Mesh_ResizeCheck(numverts) if ((numverts) > mesh_maxverts) _R_Mesh_ResizeCheck(numverts);
 void _R_Mesh_ResizeCheck(int numverts);
index 429f473df3f1f4680bfc2efa8ecb7aedf2c6d0e6..132674f920379a8857f9c03de3cde675f6eb904d 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -361,6 +361,7 @@ extern cvar_t gl_mesh_drawrangeelements;
 extern int gl_maxdrawrangeelementsvertices;
 extern int gl_maxdrawrangeelementsindices;
 
+#if 0
 void R_DrawQueue(void)
 {
        int pos, num, chartexnum, overbright;
@@ -375,15 +376,263 @@ void R_DrawQueue(void)
        if (!r_render.integer)
                return;
 
-       qglViewport(vid.realx, vid.realy, vid.realwidth, vid.realheight);
+       GL_SetupView_ViewPort(vid.realx, vid.realy, vid.realwidth, vid.realheight);
+       GL_SetupView_Mode_Ortho(0, 0, vid.conwidth, vid.conheight, -10, 100);
+       GL_SetupView_Orientation_Identity();
+       GL_DepthFunc(GL_LEQUAL);
+       R_Mesh_Start();
+
+       chartexnum = R_GetTexture(char_texture);
+
+       additive = false;
+       qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       currentpic = "";
+       pic = NULL;
+       qglBindTexture(GL_TEXTURE_2D, 0);
+       color = 0;
+       qglColor4ub(0,0,0,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);
+               additive = (dq->flags & DRAWFLAG_ADDITIVE) != 0;
+               color = dq->color;
+               m.blendfunc1 = GL_SRC_ALPHA;
+               if (additive)
+                       m.blendfunc2 = GL_ONE;
+               else
+                       m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+               m.depthdisable = true;
+               R_Mesh_MainState(&m);
+               cr = (float) ((color >> 24) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
+               cg = (float) ((color >> 16) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
+               cb = (float) ((color >>  8) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
+               ca = (float) ( color        & 0xFF) * (1.0f / 255.0f);
+               x = dq->x;
+               y = dq->y;
+               w = dq->scalex;
+               h = dq->scaley;
+               switch(dq->command)
+               {
+               case DRAWQUEUE_PIC:
+                       str = (char *)(dq + 1);
+                       if (*str)
+                       {
+                               if (strcmp(str, currentpic))
+                               {
+                                       if (batch)
+                                       {
+                                               batch = false;
+                                               qglEnd();
+                                       }
+                                       currentpic = str;
+                                       pic = Draw_CachePic(str);
+                                       qglBindTexture(GL_TEXTURE_2D, R_GetTexture(pic->tex));
+                               }
+                               if (w == 0)
+                                       w = pic->width;
+                               if (h == 0)
+                                       h = pic->height;
+                               if (!batch)
+                               {
+                                       batch = true;
+                                       qglBegin(GL_TRIANGLES);
+                                       batchcount = 0;
+                               }
+                               qglTexCoord2f (0, 0);qglVertex2f (x  , y  );
+                               qglTexCoord2f (1, 0);qglVertex2f (x+w, y  );
+                               qglTexCoord2f (1, 1);qglVertex2f (x+w, y+h);
+                               qglTexCoord2f (0, 0);qglVertex2f (x  , y  );
+                               qglTexCoord2f (1, 1);qglVertex2f (x+w, y+h);
+                               qglTexCoord2f (0, 1);qglVertex2f (x  , y+h);
+                               batchcount++;
+                       }
+                       else
+                       {
+                               if (currentpic[0])
+                               {
+                                       if (batch)
+                                       {
+                                               batch = false;
+                                               qglEnd();
+                                       }
+                                       currentpic = "";
+                                       qglBindTexture(GL_TEXTURE_2D, 0);
+                               }
+                               if (!batch)
+                               {
+                                       batch = true;
+                                       qglBegin(GL_TRIANGLES);
+                                       batchcount = 0;
+                               }
+                               qglTexCoord2f (0, 0);qglVertex2f (x  , y  );
+                               qglTexCoord2f (1, 0);qglVertex2f (x+w, y  );
+                               qglTexCoord2f (1, 1);qglVertex2f (x+w, y+h);
+                               qglTexCoord2f (0, 0);qglVertex2f (x  , y  );
+                               qglTexCoord2f (1, 1);qglVertex2f (x+w, y+h);
+                               qglTexCoord2f (0, 1);qglVertex2f (x  , y+h);
+                               batchcount++;
+                       }
+                       break;
+               case DRAWQUEUE_STRING:
+                       str = (char *)(dq + 1);
+                       if (strcmp("conchars", currentpic))
+                       {
+                               if (batch)
+                               {
+                                       batch = false;
+                                       qglEnd();
+                               }
+                               currentpic = "conchars";
+                               qglBindTexture(GL_TEXTURE_2D, chartexnum);
+                       }
+                       if (!batch)
+                       {
+                               batch = true;
+                               qglBegin(GL_TRIANGLES);
+                               batchcount = 0;
+                       }
+                       while ((num = *str++) && x < vid.conwidth)
+                       {
+                               if (num != ' ')
+                               {
+                                       s = (num & 15)*0.0625f + (0.5f / 256.0f);
+                                       t = (num >> 4)*0.0625f + (0.5f / 256.0f);
+                                       u = 0.0625f - (1.0f / 256.0f);
+                                       v = 0.0625f - (1.0f / 256.0f);
+                                       qglTexCoord2f (s  , t  );qglVertex2f (x  , y  );
+                                       qglTexCoord2f (s+u, t  );qglVertex2f (x+w, y  );
+                                       qglTexCoord2f (s+u, t+v);qglVertex2f (x+w, y+h);
+                                       qglTexCoord2f (s  , t  );qglVertex2f (x  , y  );
+                                       qglTexCoord2f (s+u, t+v);qglVertex2f (x+w, y+h);
+                                       qglTexCoord2f (s  , t+v);qglVertex2f (x  , y+h);
+                                       batchcount++;
+                               }
+                               x += w;
+                       }
+                       break;
+               case DRAWQUEUE_MESH:
+                       if (batch)
+                       {
+                               batch = false;
+                               qglEnd();
+                       }
+                       
+                       mesh = (void *)(dq + 1);
+                       qglBindTexture(GL_TEXTURE_2D, R_GetTexture(mesh->texture));
+                       qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), mesh->vertices);CHECKGLERROR
+                       qglTexCoordPointer(2, GL_FLOAT, sizeof(float[2]), mesh->texcoords);CHECKGLERROR
+                       qglColorPointer(4, GL_UNSIGNED_BYTE, sizeof(qbyte[4]), mesh->colors);CHECKGLERROR
+                       qglEnableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
+                       qglEnableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
+                       qglEnableClientState(GL_COLOR_ARRAY);CHECKGLERROR
+                       GL_DrawRangeElements(0, mesh->numvertices, mesh->numindices, mesh->indices);
+                       qglDisableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
+                       qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
+                       qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR
+
+                       // restore color, since it got trashed by using color array
+                       qglColor4ub((qbyte)(((color >> 24) & 0xFF) >> overbright), (qbyte)(((color >> 16) & 0xFF) >> overbright), (qbyte)(((color >> 8) & 0xFF) >> overbright), (qbyte)(color & 0xFF));
+                       CHECKGLERROR
+                       currentpic = "\0";
+                       break;
+               }
+       }
+       if (batch)
+               qglEnd();
+       CHECKGLERROR
+
+       if (!v_hwgamma.integer)
+       {
+               qglDisable(GL_TEXTURE_2D);
+               CHECKGLERROR
+               t = v_contrast.value * (float) (1 << v_overbrightbits.integer);
+               if (t >= 1.01f)
+               {
+                       qglBlendFunc (GL_DST_COLOR, GL_ONE);
+                       CHECKGLERROR
+                       qglBegin (GL_TRIANGLES);
+                       while (t >= 1.01f)
+                       {
+                               num = (int) ((t - 1.0f) * 255.0f);
+                               if (num > 255)
+                                       num = 255;
+                               qglColor4ub ((qbyte) num, (qbyte) num, (qbyte) num, 255);
+                               qglVertex2f (-5000, -5000);
+                               qglVertex2f (10000, -5000);
+                               qglVertex2f (-5000, 10000);
+                               t *= 0.5;
+                       }
+                       qglEnd ();
+                       CHECKGLERROR
+               }
+               else if (t <= 0.99f)
+               {
+                       qglBlendFunc(GL_ZERO, GL_SRC_COLOR);
+                       CHECKGLERROR
+                       qglBegin(GL_TRIANGLES);
+                       num = (int) (t * 255.0f);
+                       qglColor4ub ((qbyte) num, (qbyte) num, (qbyte) num, 255);
+                       qglVertex2f (-5000, -5000);
+                       qglVertex2f (10000, -5000);
+                       qglVertex2f (-5000, 10000);
+                       qglEnd();
+                       CHECKGLERROR
+               }
+               if (v_brightness.value >= 0.01f)
+               {
+                       qglBlendFunc (GL_ONE, GL_ONE);
+                       CHECKGLERROR
+                       num = (int) (v_brightness.value * 255.0f);
+                       qglColor4ub ((qbyte) num, (qbyte) num, (qbyte) num, 255);
+                       CHECKGLERROR
+                       qglBegin (GL_TRIANGLES);
+                       qglVertex2f (-5000, -5000);
+                       qglVertex2f (10000, -5000);
+                       qglVertex2f (-5000, 10000);
+                       qglEnd ();
+                       CHECKGLERROR
+               }
+               qglEnable(GL_TEXTURE_2D);
+               CHECKGLERROR
+       }
+
+       qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       CHECKGLERROR
+       qglEnable (GL_CULL_FACE);
+       CHECKGLERROR
+       qglEnable (GL_DEPTH_TEST);
+       CHECKGLERROR
+       qglDisable (GL_BLEND);
+       CHECKGLERROR
+       qglColor4ub (255, 255, 255, 255);
+       CHECKGLERROR
+}
+#else
+void R_DrawQueue(void)
+{
+       int pos, num, chartexnum, overbright;
+       float x, y, w, h, s, t, u, v;
+       cachepic_t *pic;
+       drawqueue_t *dq;
+       char *str, *currentpic;
+       int batch, batchcount, additive;
+       unsigned int color;
+       drawqueuemesh_t *mesh;
+
+       if (!r_render.integer)
+               return;
 
        qglMatrixMode(GL_PROJECTION);
-    qglLoadIdentity();
+       qglLoadIdentity();
        qglOrtho(0, vid.conwidth, vid.conheight, 0, -99999, 99999);
 
        qglMatrixMode(GL_MODELVIEW);
     qglLoadIdentity();
-
+       
        qglDisable(GL_DEPTH_TEST);
        qglDisable(GL_CULL_FACE);
        qglEnable(GL_BLEND);
@@ -642,4 +891,5 @@ void R_DrawQueue(void)
        qglColor4ub (255, 255, 255, 255);
        CHECKGLERROR
 }
+#endif
 
index 9d495ab3c600fedba777bea5ebf174cd40ea27f5..ca149f51a97bb6bf625dda1770d6c5f22d8a5c5c 100644 (file)
@@ -239,9 +239,9 @@ void R_SetupMDLMD2Frames(const entity_render_t *ent, float colorr, float colorg,
 
 void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
 {
-       int i, c, pantsfullbright, shirtfullbright, colormapped;
+       int i, c, pantsfullbright, shirtfullbright, colormapped, tex;
        float pantscolor[3], shirtcolor[3];
-       float fog;
+       float fog, colorscale;
        vec3_t diff;
        qbyte *bcolor;
        rmeshstate_t m;
@@ -291,13 +291,18 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                blendfunc2 = GL_ZERO;
        }
 
+       colorscale = r_colorscale;
+       if (gl_combine.integer)
+               colorscale *= 0.25f;
+       
        if (!skinframe->base && !skinframe->pants && !skinframe->shirt && !skinframe->glow)
        {
                // untextured
                memset(&m, 0, sizeof(m));
                m.blendfunc1 = blendfunc1;
                m.blendfunc2 = blendfunc2;
-               m.wantoverbright = true;
+               if (gl_combine.integer)
+                       m.texrgbscale[0] = 4;
                m.tex[0] = R_GetTexture(r_notexture);
                R_Mesh_State(&m);
 
@@ -306,7 +311,7 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                        varray_texcoord[0][i] = model->mdlmd2data_texcoords[i] * 8.0f;
                aliasvert = varray_vertex;
                aliasvertcolor = varray_color;
-               R_SetupMDLMD2Frames(ent, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+               R_SetupMDLMD2Frames(ent, colorscale, colorscale, colorscale);
                aliasvert = aliasvertbuf;
                aliasvertcolor = aliasvertcolorbuf;
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -321,7 +326,8 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                memset(&m, 0, sizeof(m));
                m.blendfunc1 = blendfunc1;
                m.blendfunc2 = blendfunc2;
-               m.wantoverbright = true;
+               if (gl_combine.integer)
+                       m.texrgbscale[0] = 4;
                m.tex[0] = R_GetTexture(skinframe->merged);
                R_Mesh_State(&m);
 
@@ -329,7 +335,7 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                aliasvert = varray_vertex;
                aliasvertcolor = varray_color;
-               R_SetupMDLMD2Frames(ent, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+               R_SetupMDLMD2Frames(ent, colorscale, colorscale, colorscale);
                aliasvert = aliasvertbuf;
                aliasvertcolor = aliasvertcolorbuf;
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -356,19 +362,21 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                pantsfullbright = shirtfullbright = false;
        }
 
-       memset(&m, 0, sizeof(m));
-       m.blendfunc1 = blendfunc1;
-       m.blendfunc2 = blendfunc2;
-       m.wantoverbright = true;
-       m.tex[0] = colormapped ? R_GetTexture(skinframe->base) : R_GetTexture(skinframe->merged);
-       if (m.tex[0])
+       tex = colormapped ? R_GetTexture(skinframe->base) : R_GetTexture(skinframe->merged);
+       if (tex)
        {
+               memset(&m, 0, sizeof(m));
+               m.blendfunc1 = blendfunc1;
+               m.blendfunc2 = blendfunc2;
+               if (gl_combine.integer)
+                       m.texrgbscale[0] = 4;
+               m.tex[0] = tex;
                R_Mesh_State(&m);
 
                blendfunc1 = GL_SRC_ALPHA;
                blendfunc2 = GL_ONE;
                c_alias_polys += model->numtris;
-               R_ModulateColors(aliasvertcolor, varray_color, model->numverts, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+               R_ModulateColors(aliasvertcolor, varray_color, model->numverts, colorscale, colorscale, colorscale);
                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -378,22 +386,24 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
        {
                if (skinframe->pants)
                {
-                       memset(&m, 0, sizeof(m));
-                       m.blendfunc1 = blendfunc1;
-                       m.blendfunc2 = blendfunc2;
-                       m.wantoverbright = true;
-                       m.tex[0] = R_GetTexture(skinframe->pants);
-                       if (m.tex[0])
+                       tex = R_GetTexture(skinframe->pants);
+                       if (tex)
                        {
+                               memset(&m, 0, sizeof(m));
+                               m.blendfunc1 = blendfunc1;
+                               m.blendfunc2 = blendfunc2;
+                               if (gl_combine.integer)
+                                       m.texrgbscale[0] = 4;
+                               m.tex[0] = tex;
                                R_Mesh_State(&m);
 
                                blendfunc1 = GL_SRC_ALPHA;
                                blendfunc2 = GL_ONE;
                                c_alias_polys += model->numtris;
                                if (pantsfullbright)
-                                       R_FillColors(varray_color, model->numverts, pantscolor[0] * mesh_colorscale, pantscolor[1] * mesh_colorscale, pantscolor[2] * mesh_colorscale, ent->alpha);
+                                       R_FillColors(varray_color, model->numverts, pantscolor[0] * colorscale, pantscolor[1] * colorscale, pantscolor[2] * colorscale, ent->alpha);
                                else
-                                       R_ModulateColors(aliasvertcolor, varray_color, model->numverts, pantscolor[0] * mesh_colorscale, pantscolor[1] * mesh_colorscale, pantscolor[2] * mesh_colorscale);
+                                       R_ModulateColors(aliasvertcolor, varray_color, model->numverts, pantscolor[0] * colorscale, pantscolor[1] * colorscale, pantscolor[2] * colorscale);
                                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -401,22 +411,24 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                }
                if (skinframe->shirt)
                {
-                       memset(&m, 0, sizeof(m));
-                       m.blendfunc1 = blendfunc1;
-                       m.blendfunc2 = blendfunc2;
-                       m.wantoverbright = true;
-                       m.tex[0] = R_GetTexture(skinframe->shirt);
-                       if (m.tex[0])
+                       tex = R_GetTexture(skinframe->shirt);
+                       if (tex)
                        {
+                               memset(&m, 0, sizeof(m));
+                               m.blendfunc1 = blendfunc1;
+                               m.blendfunc2 = blendfunc2;
+                               if (gl_combine.integer)
+                                       m.texrgbscale[0] = 4;
+                               m.tex[0] = tex;
                                R_Mesh_State(&m);
 
                                blendfunc1 = GL_SRC_ALPHA;
                                blendfunc2 = GL_ONE;
                                c_alias_polys += model->numtris;
                                if (shirtfullbright)
-                                       R_FillColors(varray_color, model->numverts, shirtcolor[0] * mesh_colorscale, shirtcolor[1] * mesh_colorscale, shirtcolor[2] * mesh_colorscale, ent->alpha);
+                                       R_FillColors(varray_color, model->numverts, shirtcolor[0] * colorscale, shirtcolor[1] * colorscale, shirtcolor[2] * colorscale, ent->alpha);
                                else
-                                       R_ModulateColors(aliasvertcolor, varray_color, model->numverts, shirtcolor[0] * mesh_colorscale, shirtcolor[1] * mesh_colorscale, shirtcolor[2] * mesh_colorscale);
+                                       R_ModulateColors(aliasvertcolor, varray_color, model->numverts, shirtcolor[0] * colorscale, shirtcolor[1] * colorscale, shirtcolor[2] * colorscale);
                                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -425,19 +437,19 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
        }
        if (skinframe->glow)
        {
-               memset(&m, 0, sizeof(m));
-               m.blendfunc1 = blendfunc1;
-               m.blendfunc2 = blendfunc2;
-               m.wantoverbright = true;
-               m.tex[0] = R_GetTexture(skinframe->glow);
-               if (m.tex[0])
+               tex = R_GetTexture(skinframe->glow);
+               if (tex)
                {
+                       memset(&m, 0, sizeof(m));
+                       m.blendfunc1 = blendfunc1;
+                       m.blendfunc2 = blendfunc2;
+                       m.tex[0] = tex;
                        R_Mesh_State(&m);
 
                        blendfunc1 = GL_SRC_ALPHA;
                        blendfunc2 = GL_ONE;
                        c_alias_polys += model->numtris;
-                       R_FillColors(varray_color, model->numverts, (1 - fog) * mesh_colorscale, (1 - fog) * mesh_colorscale, (1 - fog) * mesh_colorscale, ent->alpha);
+                       R_FillColors(varray_color, model->numverts, (1 - fog) * r_colorscale, (1 - fog) * r_colorscale, (1 - fog) * r_colorscale, ent->alpha);
                        memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                        R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -448,12 +460,11 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                memset(&m, 0, sizeof(m));
                m.blendfunc1 = GL_SRC_ALPHA;
                m.blendfunc2 = GL_ONE;
-               m.wantoverbright = false;
                m.tex[0] = R_GetTexture(skinframe->fog);
                R_Mesh_State(&m);
 
                c_alias_polys += model->numtris;
-               R_FillColors(varray_color, model->numverts, fogcolor[0] * fog * mesh_colorscale, fogcolor[1] * fog * mesh_colorscale, fogcolor[2] * fog * mesh_colorscale, ent->alpha);
+               R_FillColors(varray_color, model->numverts, fogcolor[0] * fog * r_colorscale, fogcolor[1] * fog * r_colorscale, fogcolor[2] * fog * r_colorscale, ent->alpha);
                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -737,7 +748,7 @@ void ZymoticCalcNormals(int vertcount, int shadercount, int *renderlist)
 
 void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
 {
-       float fog;
+       float fog, colorscale;
        vec3_t diff;
        int i, *renderlist, *elements;
        zymtype1header_t *m;
@@ -785,7 +796,6 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
        R_LightModel(ent, numverts, 1 - fog, 1 - fog, 1 - fog, false);
 
        memset(&mstate, 0, sizeof(mstate));
-       mstate.wantoverbright = true;
        if (ent->effects & EF_ADDITIVE)
        {
                mstate.blendfunc1 = GL_SRC_ALPHA;
@@ -801,19 +811,24 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                mstate.blendfunc1 = GL_ONE;
                mstate.blendfunc2 = GL_ZERO;
        }
+       colorscale = r_colorscale;
+       if (gl_combine.integer)
+       {
+               mstate.texrgbscale[0] = 4;
+               colorscale *= 0.25f;
+       }
        mstate.tex[0] = R_GetTexture(texture);
        R_Mesh_State(&mstate);
 
        c_alias_polys += numtriangles;
        memcpy(varray_vertex, aliasvert, numverts * sizeof(float[4]));
-       R_ModulateColors(aliasvertcolor, varray_color, numverts, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+       R_ModulateColors(aliasvertcolor, varray_color, numverts, colorscale, colorscale, colorscale);
        memcpy(varray_texcoord[0], (float *)(m->lump_texcoords.start + (int) m), numverts * sizeof(float[2]));
        R_Mesh_Draw(numverts, numtriangles, elements);
 
        if (fog)
        {
                memset(&mstate, 0, sizeof(mstate));
-               mstate.wantoverbright = false;
                mstate.blendfunc1 = GL_SRC_ALPHA;
                mstate.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
                // FIXME: need alpha mask for fogging...
@@ -822,7 +837,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
 
                c_alias_polys += numtriangles;
                memcpy(varray_vertex, aliasvert, numverts * sizeof(float[4]));
-               R_FillColors(varray_color, numverts, fogcolor[0] * mesh_colorscale, fogcolor[1] * mesh_colorscale, fogcolor[2] * mesh_colorscale, ent->alpha * fog);
+               R_FillColors(varray_color, numverts, fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, ent->alpha * fog);
                //memcpy(mesh_texcoord[0], (float *)(m->lump_texcoords.start + (int) m), numverts * sizeof(float[2]));
                R_Mesh_Draw(numverts, numtriangles, elements);
        }
index 679096f37075bcddbb6deaa609c3fc3117dfe1d3..0b21178968aac487bc607e33519b039d29a1e428 100644 (file)
@@ -606,7 +606,6 @@ static void R_BlendView(void)
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       m.wantoverbright = false;
        m.depthdisable = true; // magic
        R_Mesh_Matrix(&r_identitymatrix);
        R_Mesh_State(&m);
@@ -715,7 +714,6 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
        rmeshstate_t m;
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       m.wantoverbright = false;
        R_Mesh_Matrix(&r_identitymatrix);
        R_Mesh_State(&m);
 
@@ -727,9 +725,9 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
        varray_vertex[20] = maxs[0];varray_vertex[21] = mins[1];varray_vertex[22] = maxs[2];
        varray_vertex[24] = mins[0];varray_vertex[25] = maxs[1];varray_vertex[26] = maxs[2];
        varray_vertex[28] = maxs[0];varray_vertex[29] = maxs[1];varray_vertex[30] = maxs[2];
-       varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = varray_color[16] = varray_color[20] = varray_color[24] = varray_color[28] = cr * mesh_colorscale;
-       varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = varray_color[17] = varray_color[21] = varray_color[25] = varray_color[29] = cg * mesh_colorscale;
-       varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = varray_color[18] = varray_color[22] = varray_color[26] = varray_color[30] = cb * mesh_colorscale;
+       varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = varray_color[16] = varray_color[20] = varray_color[24] = varray_color[28] = cr * r_colorscale;
+       varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = varray_color[17] = varray_color[21] = varray_color[25] = varray_color[29] = cg * r_colorscale;
+       varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = varray_color[18] = varray_color[22] = varray_color[26] = varray_color[30] = cb * r_colorscale;
        varray_color[ 3] = varray_color[ 7] = varray_color[11] = varray_color[15] = varray_color[19] = varray_color[23] = varray_color[27] = varray_color[31] = ca;
        if (fogenabled)
        {
@@ -738,7 +736,7 @@ 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 *= mesh_colorscale;
+                       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;
@@ -770,7 +768,6 @@ void R_DrawNoModelCallback(const void *calldata1, int calldata2)
                m.blendfunc1 = GL_ONE;
                m.blendfunc2 = GL_ZERO;
        }
-       m.wantoverbright = false;
        R_Mesh_Matrix(&ent->matrix);
        R_Mesh_State(&m);
 
@@ -801,18 +798,18 @@ void R_DrawNoModelCallback(const void *calldata1, int calldata2)
                f1 = 1 - f2;
                for (i = 0, c = varray_color;i < 6;i++, c += 4)
                {
-                       c[0] = (c[0] * f1 + fogcolor[0] * f2) * mesh_colorscale;
-                       c[1] = (c[1] * f1 + fogcolor[1] * f2) * mesh_colorscale;
-                       c[2] = (c[2] * f1 + fogcolor[2] * f2) * mesh_colorscale;
+                       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;
                }
        }
        else
        {
                for (i = 0, c = varray_color;i < 6;i++, c += 4)
                {
-                       c[0] *= mesh_colorscale;
-                       c[1] *= mesh_colorscale;
-                       c[2] *= mesh_colorscale;
+                       c[0] *= r_colorscale;
+                       c[1] *= r_colorscale;
+                       c[2] *= r_colorscale;
                }
        }
        R_Mesh_Draw(6, 8, element);
index 864d4d3b65c481a0d0d08d8312802d59436c5609..b827c2edb8795f31042d09ad73962a4f4073b30d 100644 (file)
@@ -245,7 +245,7 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
 
                // 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]];
@@ -300,7 +300,7 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
                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;
@@ -339,7 +339,7 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
 
                // 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]];
@@ -390,7 +390,7 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
                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;
@@ -783,7 +783,6 @@ static void RSurfShader_Sky(const entity_render_t *ent, const texture_t *texture
                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)
@@ -795,7 +794,7 @@ static void RSurfShader_Sky(const entity_render_t *ent, const texture_t *texture
                        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);
+                               R_FillColors(varray_color, mesh->numverts, fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -805,7 +804,7 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
 {
        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);
@@ -830,8 +829,13 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                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);
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
@@ -847,7 +851,7 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                        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);
        }
 
@@ -856,7 +860,6 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                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)
@@ -865,7 +868,7 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                        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);
                }
        }
@@ -890,7 +893,7 @@ static void RSurfShader_Water(const entity_render_t *ent, const texture_t *textu
 
 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];
@@ -911,8 +914,13 @@ static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const m
                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);
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -928,7 +936,7 @@ static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const m
                        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);
        }
 }
@@ -955,7 +963,6 @@ static void RSurfShader_Wall_Pass_BaseFullbright(const entity_render_t *ent, con
                m.blendfunc1 = GL_ONE;
                m.blendfunc2 = GL_ZERO;
        }
-       m.wantoverbright = false;
        m.tex[0] = R_GetTexture(surf->currenttexture->texture);
        R_Mesh_State(&m);
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -963,7 +970,7 @@ static void RSurfShader_Wall_Pass_BaseFullbright(const entity_render_t *ent, con
                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);
        }
 }
@@ -977,7 +984,6 @@ static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurfac
        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);
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -985,7 +991,7 @@ static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurfac
                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);
        }
 }
@@ -999,7 +1005,6 @@ static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface
        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)
@@ -1008,7 +1013,7 @@ static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface
                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);
        }
 }
@@ -1023,7 +1028,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
        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);
@@ -1046,7 +1050,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
                        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;
+                       cl = (float) (1 << r_lightmapscalebit) * r_colorscale;
                        R_FillColors(varray_color, mesh->numverts, cl, cl, cl, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
@@ -1059,13 +1063,13 @@ static void RSurfShader_OpaqueWall_Pass_BaseDoubleTex(const entity_render_t *ent
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
@@ -1081,8 +1085,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseDoubleTex(const entity_render_t *ent
                        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_FillColors(varray_color, mesh->numverts, r_colorscale, r_colorscale, r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1096,7 +1099,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent,
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
@@ -1118,12 +1120,12 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
@@ -1138,8 +1140,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
                        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_FillColors(varray_color, mesh->numverts, r_colorscale, r_colorscale, r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1149,13 +1150,19 @@ static void RSurfShader_OpaqueWall_Pass_Light(const entity_render_t *ent, const
 {
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
@@ -1170,7 +1177,7 @@ static void RSurfShader_OpaqueWall_Pass_Light(const entity_render_t *ent, const
                                        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);
                                }
                        }
@@ -1188,8 +1195,6 @@ static void RSurfShader_OpaqueWall_Pass_Fog(const entity_render_t *ent, const te
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
@@ -1199,7 +1204,7 @@ static void RSurfShader_OpaqueWall_Pass_Fog(const entity_render_t *ent, const te
                        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);
                }
        }
@@ -1213,7 +1218,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseDetail(const entity_render_t *ent, c
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
@@ -1237,7 +1241,6 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
        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);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
@@ -1247,7 +1250,7 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
                        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_FillColors(varray_color, mesh->numverts, r_colorscale, r_colorscale, r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1439,7 +1442,7 @@ void R_DrawSurfaces(entity_render_t *ent, int sky, int normal)
                                {
                                        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)
                                        {
@@ -1477,15 +1480,14 @@ static void R_DrawPortal_Callback(const void *calldata1, int calldata2)
        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,
+               ((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)
        {
index a3f4a314747395f7e2292626675cbaadee687997..9c0cf4e8328752cb6d43b27a51e2a3aac80cc065 100644 (file)
@@ -1316,8 +1316,6 @@ static void Mod_LoadFaces (lump_t *l)
 
                // force lightmap upload on first time seeing the surface
                out->cached_dlight = true;
-               out->cached_ambient = -1000;
-               out->cached_lightscalebit = -1000;
 
                CalcSurfaceExtents (out);
 
index ede0144e0732068f417befe78fb9f9654a589112..80756e39dbe76a30782eb1ae9525f490bd6a032c 100644 (file)
@@ -216,7 +216,7 @@ typedef struct msurface_s
        // if lightmap was lit by dynamic lights, force update on next frame
        short cached_dlight;
        // to cause lightmap to be rerendered when v_overbrightbits changes
-       short cached_lightscalebit;
+       short cached_lightmapscalebit;
        // rerender lightmaps when r_ambient changes
        float cached_ambient;
 }
index 40ac2bc5c15bba84fb383d02141c5692e21f0c45..113fbc9ecac3c21e076343b7e42e9c14f8941623 100644 (file)
@@ -168,15 +168,14 @@ void R_DrawCrosshairSprite(rtexture_t *texture, vec3_t origin, vec_t scale, floa
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE;
-       m.wantoverbright = false;
        m.depthdisable = true;
        m.tex[0] = R_GetTexture(texture);
        R_Mesh_Matrix(&r_identitymatrix);
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = cr * mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = cg * mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = cb * mesh_colorscale;
+       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = cr * r_colorscale;
+       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = cg * r_colorscale;
+       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = cb * r_colorscale;
        varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = ca;
        varray_texcoord[0][0] = 0;
        varray_texcoord[0][1] = 0;
index 26eb2cdaeee4d58d3a13bdbf74b0e448717d8a85..0d5fdf46728ef607e2371bffc335a50d00489c1b 100644 (file)
@@ -184,7 +184,6 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE;
-       m.wantoverbright = false;
        m.tex[0] = R_GetTexture(explosiontexture);
        R_Mesh_Matrix(&r_identitymatrix);
        R_Mesh_State(&m);
@@ -219,7 +218,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
                                if (dist < 0)
                                        dist = 0;
                                else
-                                       dist *= mesh_colorscale;
+                                       dist *= r_colorscale;
                        }
                        else
                                dist = 0;
@@ -237,7 +236,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
                        if (dist < 0)
                                dist = 0;
                        else
-                               dist *= mesh_colorscale;
+                               dist *= r_colorscale;
                        c[0] = c[1] = c[2] = dist;
                        c[3] = 1;
                }
index 56d040fccc13e90ee1a6ed7de63b920bd9fbf18d..74334c502d53f18b7a1d3a941693d39254becc1f 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -148,7 +148,6 @@ void R_DrawCoronas(void)
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_ONE;
        m.blendfunc2 = GL_ONE;
-       m.wantoverbright = false;
        m.depthdisable = true; // magic
        m.tex[0] = R_GetTexture(lightcorona);
        R_Mesh_Matrix(&r_identitymatrix);
@@ -160,7 +159,7 @@ void R_DrawCoronas(void)
                dist = (DotProduct(rd->origin, vpn) - viewdist);
                if (dist >= 24.0f && CL_TraceLine(rd->origin, r_origin, NULL, NULL, 0, true) == 1)
                {
-                       scale = mesh_colorscale * (1.0f / 131072.0f);
+                       scale = r_colorscale * (1.0f / 131072.0f);
                        if (gl_flashblend.integer)
                                scale *= 4.0f;
                        if (fogenabled)
diff --git a/r_sky.c b/r_sky.c
index ca799a9d79db580f02ef29e1c5004b6241a0a02a..25fa9fd5ea73a8e9b5b8fe2fad054bbd31f207c5 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -128,15 +128,15 @@ static void R_SkyBox(void)
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_ONE;
        m.blendfunc2 = GL_ZERO;
-       m.wantoverbright = false;
        m.depthdisable = true; // don't modify or read zbuffer
        m.tex[0] = R_GetTexture(skyboxside[3]); // front
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = mesh_colorscale;
+       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = r_colorscale;
+       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = r_colorscale;
+       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = r_colorscale;
        varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
+       
        R_SkyBoxPolyVec(0, 1, 0,  1, -1,  1);
        R_SkyBoxPolyVec(1, 1, 1,  1, -1, -1);
        R_SkyBoxPolyVec(2, 0, 1,  1,  1, -1);
@@ -144,10 +144,6 @@ static void R_SkyBox(void)
        R_Mesh_Draw(4, 2, polygonelements);
        m.tex[0] = R_GetTexture(skyboxside[1]); // back
        R_Mesh_State(&m);
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = mesh_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
        R_SkyBoxPolyVec(0, 1, 0, -1,  1,  1);
        R_SkyBoxPolyVec(1, 1, 1, -1,  1, -1);
        R_SkyBoxPolyVec(2, 0, 1, -1, -1, -1);
@@ -155,10 +151,6 @@ static void R_SkyBox(void)
        R_Mesh_Draw(4, 2, polygonelements);
        m.tex[0] = R_GetTexture(skyboxside[0]); // right
        R_Mesh_State(&m);
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = mesh_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
        R_SkyBoxPolyVec(0, 1, 0,  1,  1,  1);
        R_SkyBoxPolyVec(1, 1, 1,  1,  1, -1);
        R_SkyBoxPolyVec(2, 0, 1, -1,  1, -1);
@@ -166,10 +158,6 @@ static void R_SkyBox(void)
        R_Mesh_Draw(4, 2, polygonelements);
        m.tex[0] = R_GetTexture(skyboxside[2]); // left
        R_Mesh_State(&m);
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = mesh_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
        R_SkyBoxPolyVec(0, 1, 0, -1, -1,  1);
        R_SkyBoxPolyVec(1, 1, 1, -1, -1, -1);
        R_SkyBoxPolyVec(2, 0, 1,  1, -1, -1);
@@ -177,10 +165,6 @@ static void R_SkyBox(void)
        R_Mesh_Draw(4, 2, polygonelements);
        m.tex[0] = R_GetTexture(skyboxside[4]); // up
        R_Mesh_State(&m);
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = mesh_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
        R_SkyBoxPolyVec(0, 1, 0,  1, -1,  1);
        R_SkyBoxPolyVec(1, 1, 1,  1,  1,  1);
        R_SkyBoxPolyVec(2, 0, 1, -1,  1,  1);
@@ -188,10 +172,6 @@ static void R_SkyBox(void)
        R_Mesh_Draw(4, 2, polygonelements);
        m.tex[0] = R_GetTexture(skyboxside[5]); // down
        R_Mesh_State(&m);
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = mesh_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
        R_SkyBoxPolyVec(0, 1, 0,  1,  1, -1);
        R_SkyBoxPolyVec(1, 1, 1,  1, -1, -1);
        R_SkyBoxPolyVec(2, 0, 1, -1, -1, -1);
@@ -291,12 +271,11 @@ static void R_SkySphere(void)
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_ONE;
        m.blendfunc2 = GL_ZERO;
-       m.wantoverbright = false;
        m.depthdisable = true; // don't modify or read zbuffer
        m.tex[0] = R_GetTexture(solidskytexture);
        R_Mesh_State(&m);
 
-       skyspherearrays(varray_vertex, varray_texcoord[0], varray_color, skysphere, speedscale, mesh_colorscale);
+       skyspherearrays(varray_vertex, varray_texcoord[0], varray_color, skysphere, speedscale, r_colorscale);
        R_Mesh_Draw(numverts, numtriangles, skysphereindices);
 
        m.blendfunc1 = GL_SRC_ALPHA;
@@ -304,7 +283,7 @@ static void R_SkySphere(void)
        m.tex[0] = R_GetTexture(alphaskytexture);
        R_Mesh_State(&m);
 
-       skyspherearrays(varray_vertex, varray_texcoord[0], varray_color, skysphere, speedscale2, mesh_colorscale);
+       skyspherearrays(varray_vertex, varray_texcoord[0], varray_color, skysphere, speedscale2, r_colorscale);
        R_Mesh_Draw(numverts, numtriangles, skysphereindices);
 }
 
index 5408962c49ab7699da4675157938d326052445d3..a565400728053bd11311a9da11973237f67f9190 100644 (file)
@@ -78,7 +78,7 @@ static int R_SpriteSetup (const entity_render_t *ent, int type, float org[3], fl
        return false;
 }
 
-static void R_DrawSpriteImage (int wantoverbright, int additive, mspriteframe_t *frame, int texture, vec3_t origin, vec3_t up, vec3_t left, float red, float green, float blue, float alpha)
+static void R_DrawSpriteImage (int additive, mspriteframe_t *frame, int texture, vec3_t origin, vec3_t up, vec3_t left, float red, float green, float blue, float alpha)
 {
        rmeshstate_t m;
        memset(&m, 0, sizeof(m));
@@ -86,13 +86,12 @@ static void R_DrawSpriteImage (int wantoverbright, int additive, mspriteframe_t
        m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
        if (additive)
                m.blendfunc2 = GL_ONE;
-       m.wantoverbright = wantoverbright;
        m.tex[0] = texture;
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = red * mesh_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = green * mesh_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = blue * mesh_colorscale;
+       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = red * r_colorscale;
+       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = green * r_colorscale;
+       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = blue * r_colorscale;
        varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = alpha;
        varray_texcoord[0][0] = 0;
        varray_texcoord[0][1] = 1;
@@ -121,7 +120,7 @@ static void R_DrawSpriteImage (int wantoverbright, int additive, mspriteframe_t
 void R_DrawSpriteModelCallback(const void *calldata1, int calldata2)
 {
        const entity_render_t *ent = calldata1;
-       int i, wantoverbright;
+       int i;
        vec3_t left, up, org, color;
        mspriteframe_t *frame;
        vec3_t diff;
@@ -133,15 +132,9 @@ void R_DrawSpriteModelCallback(const void *calldata1, int calldata2)
        R_Mesh_Matrix(&r_identitymatrix);
 
        if ((ent->model->flags & EF_FULLBRIGHT) || (ent->effects & EF_FULLBRIGHT))
-       {
                color[0] = color[1] = color[2] = 1;
-               wantoverbright = false;
-       }
        else
-       {
                R_CompleteLightPoint(color, ent->origin, true, NULL);
-               wantoverbright = color[0] > 1 || color[1] > 1 || color[2] > 1;
-       }
 
        if (fogenabled)
        {
@@ -161,9 +154,9 @@ void R_DrawSpriteModelCallback(const void *calldata1, int calldata2)
                if (ent->frameblend[i].lerp >= 0.01f)
                {
                        frame = ent->model->sprdata_frames + ent->frameblend[i].frame;
-                       R_DrawSpriteImage(wantoverbright, (ent->effects & EF_ADDITIVE) || (ent->model->flags & EF_ADDITIVE), frame, R_GetTexture(frame->texture), org, up, left, color[0] * ifog, color[1] * ifog, color[2] * ifog, ent->alpha * ent->frameblend[i].lerp);
+                       R_DrawSpriteImage((ent->effects & EF_ADDITIVE) || (ent->model->flags & EF_ADDITIVE), frame, R_GetTexture(frame->texture), org, up, left, color[0] * ifog, color[1] * ifog, color[2] * ifog, ent->alpha * ent->frameblend[i].lerp);
                        if (fog * ent->frameblend[i].lerp >= 0.01f)
-                               R_DrawSpriteImage(false, true, frame, R_GetTexture(frame->fogtexture), org, up, left, fogcolor[0],fogcolor[1],fogcolor[2], fog * ent->alpha * ent->frameblend[i].lerp);
+                               R_DrawSpriteImage(true, frame, R_GetTexture(frame->fogtexture), org, up, left, fogcolor[0],fogcolor[1],fogcolor[2], fog * ent->alpha * ent->frameblend[i].lerp);
                }
        }
 #else
@@ -172,9 +165,9 @@ void R_DrawSpriteModelCallback(const void *calldata1, int calldata2)
        for (i = 0;i < 4 && ent->frameblend[i].lerp;i++)
                frame = ent->model->sprdata_frames + ent->frameblend[i].frame;
 
-       R_DrawSpriteImage(wantoverbright, (ent->effects & EF_ADDITIVE) || (ent->model->flags & EF_ADDITIVE), frame, R_GetTexture(frame->texture), org, up, left, color[0] * ifog, color[1] * ifog, color[2] * ifog, ent->alpha);
+       R_DrawSpriteImage((ent->effects & EF_ADDITIVE) || (ent->model->flags & EF_ADDITIVE), frame, R_GetTexture(frame->texture), org, up, left, color[0] * ifog, color[1] * ifog, color[2] * ifog, ent->alpha);
        if (fog * ent->frameblend[i].lerp >= 0.01f)
-               R_DrawSpriteImage(false, true, frame, R_GetTexture(frame->fogtexture), org, up, left, fogcolor[0],fogcolor[1],fogcolor[2], fog * ent->alpha);
+               R_DrawSpriteImage(true, frame, R_GetTexture(frame->fogtexture), org, up, left, fogcolor[0],fogcolor[1],fogcolor[2], fog * ent->alpha);
 #endif
 }
 
index 426893c84eedda9732a99837eda107abd2bf999f..720a45644fab30d59cad9c72029140170279b503 100644 (file)
--- a/render.h
+++ b/render.h
@@ -53,10 +53,7 @@ extern qboolean intimerefresh;
 extern char r_speeds_string[1024];
 
 // lighting stuff
-extern vec3_t lightspot;
 extern cvar_t r_ambient;
-extern int lightscalebit;
-extern float lightscale;
 
 // model rendering stuff
 extern float *aliasvert;