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);
}
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];
}
// 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
{
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++)
{
else
texturergbscale[i] = 1;
}
- if (overbright)
- {
- for (i = backendunits - 1;i >= 0;i--)
- {
- if (m->tex[i])
- {
- texturergbscale[i] = 4;
- break;
- }
- }
- }
if (backendunits > 1)
{
}
}
+void R_Mesh_State(const rmeshstate_t *m)
+{
+ R_Mesh_MainState(m);
+ R_Mesh_TextureState(m);
+}
+
/*
==============================================================================
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");
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];
// 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);
extern int gl_maxdrawrangeelementsvertices;
extern int gl_maxdrawrangeelementsindices;
+#if 0
void R_DrawQueue(void)
{
int pos, num, chartexnum, overbright;
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);
qglColor4ub (255, 255, 255, 255);
CHECKGLERROR
}
+#endif
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;
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);
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);
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);
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);
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);
{
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);
}
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);
}
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);
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);
void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
{
- float fog;
+ float fog, colorscale;
vec3_t diff;
int i, *renderlist, *elements;
zymtype1header_t *m;
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;
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...
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);
}
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);
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);
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)
{
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;
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = false;
R_Mesh_Matrix(&ent->matrix);
R_Mesh_State(&m);
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);
// update cached lighting info
surf->cached_dlight = 0;
- surf->cached_lightscalebit = lightscalebit;
+ surf->cached_lightmapscalebit = r_lightmapscalebit;
surf->cached_ambient = r_ambient.value;
surf->cached_light[0] = d_lightstylevalue[surf->styles[0]];
surf->cached_light[1] = d_lightstylevalue[surf->styles[1]];
bl = intblocklights;
out = templight;
// deal with lightmap brightness scale
- shift = 7 + lightscalebit + 8;
+ shift = 7 + r_lightmapscalebit + 8;
if (ent->model->lightmaprgba)
{
stride = (surf->lightmaptexturestride - smax) * 4;
// update cached lighting info
surf->cached_dlight = 0;
- surf->cached_lightscalebit = lightscalebit;
+ surf->cached_lightmapscalebit = r_lightmapscalebit;
surf->cached_ambient = r_ambient.value;
surf->cached_light[0] = d_lightstylevalue[surf->styles[0]];
surf->cached_light[1] = d_lightstylevalue[surf->styles[1]];
bl = floatblocklights;
out = templight;
// deal with lightmap brightness scale
- scale = 1.0f / (1 << (7 + lightscalebit + 8));
+ scale = 1.0f / (1 << (7 + r_lightmapscalebit + 8));
if (ent->model->lightmaprgba)
{
stride = (surf->lightmaptexturestride - smax) * 4;
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)
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);
}
}
{
const entity_render_t *ent = calldata1;
const msurface_t *surf = ent->model->surfaces + calldata2;
- float f;
+ float f, colorscale;
const surfmesh_t *mesh;
rmeshstate_t m;
float alpha = ent->alpha * (surf->flags & SURF_DRAWNOALPHA ? 1 : r_wateralpha.value);
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(surf->currenttexture->texture);
+ colorscale = r_colorscale;
+ if (gl_combine.integer)
+ {
+ m.texrgbscale[0] = 4;
+ colorscale *= 0.25f;
+ }
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
if (surf->flags & SURF_LIGHTMAP)
RSurf_AddLightmapToVertexColors(mesh->lightmapoffsets, varray_color, mesh->numverts, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
}
- RSurf_FogColors(varray_vertex, varray_color, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogColors(varray_vertex, varray_color, colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->fogtexture);
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
if (m.tex[0])
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const msurface_t *surf)
{
- float base;
+ float base, colorscale;
const surfmesh_t *mesh;
rmeshstate_t m;
float modelorg[3];
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = true;
m.tex[0] = R_GetTexture(surf->currenttexture->texture);
+ colorscale = r_colorscale;
+ if (gl_combine.integer)
+ {
+ m.texrgbscale[0] = 4;
+ colorscale *= 0.25f;
+ }
base = ent->effects & EF_FULLBRIGHT ? 2.0f : r_ambient.value * (1.0f / 64.0f);
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
if (surf->flags & SURF_LIGHTMAP)
RSurf_AddLightmapToVertexColors(mesh->lightmapoffsets, varray_color, mesh->numverts, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
}
- RSurf_FogColors(varray_vertex, varray_color, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogColors(varray_vertex, varray_color, colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
}
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->texture);
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->glowtexture);
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
R_Mesh_ResizeCheck(mesh->numverts);
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FoggedColors(varray_vertex, varray_color, 1, 1, 1, ent->alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.tex[0] = R_GetTexture(surf->currenttexture->fogtexture);
R_Mesh_State(&m);
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
if (m.tex[0])
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ZERO;
- //m.wantoverbright = false;
m.tex[0] = R_GetTexture(texture->texture);
m.tex[1] = R_GetTexture(texture->surfacechain->lightmaptexture);
m.tex[2] = R_GetTexture(texture->detailtexture);
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);
}
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)
{
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);
}
}
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)
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)
{
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);
}
}
{
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)
{
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
R_FillColors(varray_color, mesh->numverts, 0, 0, 0, 1);
RSurf_LightSeparate(&ent->inversematrix, surf->dlightbits, mesh->numverts, varray_vertex, varray_color);
- RSurf_ScaleColors(varray_color, mesh_colorscale, mesh->numverts);
+ RSurf_ScaleColors(varray_color, colorscale, mesh->numverts);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
- //m.wantoverbright = false;
- //m.tex[0] = 0;
R_Mesh_State(&m);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
{
memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
if (m.tex[0])
memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
- RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], 1, mesh_colorscale, mesh->numverts, modelorg);
+ RSurf_FogPassColors(varray_vertex, varray_color, fogcolor[0], fogcolor[1], fogcolor[2], 1, r_colorscale, mesh->numverts, modelorg);
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
}
}
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_DST_COLOR;
m.blendfunc2 = GL_SRC_COLOR;
- //m.wantoverbright = false;
m.tex[0] = R_GetTexture(texture->detailtexture);
R_Mesh_State(&m);
for (surf = texture->surfacechain;surf;surf = surf->texturechain)
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)
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);
}
}
{
if (surf->cached_dlight
|| surf->cached_ambient != r_ambient.value
- || surf->cached_lightscalebit != lightscalebit)
+ || surf->cached_lightmapscalebit != r_lightmapscalebit)
R_BuildLightMap(ent, surf, false); // base lighting changed
else if (r_dynamic.integer)
{
memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_SRC_ALPHA;
m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
- //m.wantoverbright = false;
R_Mesh_Matrix(&ent->matrix);
R_Mesh_State(&m);
R_Mesh_ResizeCheck(portal->numpoints);
i = portal - ent->model->portals;
R_FillColors(varray_color, portal->numpoints,
- ((i & 0x0007) >> 0) * (1.0f / 7.0f) * mesh_colorscale,
- ((i & 0x0038) >> 3) * (1.0f / 7.0f) * mesh_colorscale,
- ((i & 0x01C0) >> 6) * (1.0f / 7.0f) * mesh_colorscale,
+ ((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)
{
// force lightmap upload on first time seeing the surface
out->cached_dlight = true;
- out->cached_ambient = -1000;
- out->cached_lightscalebit = -1000;
CalcSurfaceExtents (out);
// 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;
}
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;
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);
if (dist < 0)
dist = 0;
else
- dist *= mesh_colorscale;
+ dist *= r_colorscale;
}
else
dist = 0;
if (dist < 0)
dist = 0;
else
- dist *= mesh_colorscale;
+ dist *= r_colorscale;
c[0] = c[1] = c[2] = dist;
c[3] = 1;
}
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);
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)
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);
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);
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);
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);
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);
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);
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;
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);
}
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));
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;
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;
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)
{
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
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
}
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;