mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Fix a bunch of state leaks that made multitextured fullbrights smear the world.
Now just have one (known) issue with bmodels with fullbright textures not rendering their base texture. Floating fullbrights are nifty! Also a number of optimizations, which need wider performance testing.
This commit is contained in:
parent
6e6df349e4
commit
5157f668ad
5 changed files with 141 additions and 96 deletions
|
@ -37,7 +37,7 @@ void GL_BuildLightmaps (struct model_s **models, int num_models);
|
||||||
|
|
||||||
void R_DrawBrushModel (struct entity_s *e);
|
void R_DrawBrushModel (struct entity_s *e);
|
||||||
void R_DrawWorld (void);
|
void R_DrawWorld (void);
|
||||||
void R_RenderBrushPoly (msurface_t *fa);
|
inline void R_RenderBrushPoly (msurface_t *fa, texture_t *tex);
|
||||||
|
|
||||||
void EmitWaterPolys (msurface_t *fa);
|
void EmitWaterPolys (msurface_t *fa);
|
||||||
|
|
||||||
|
|
|
@ -729,14 +729,14 @@ R_DrawAliasModel (entity_t *e)
|
||||||
qfglBindTexture (GL_TEXTURE_2D, texture);
|
qfglBindTexture (GL_TEXTURE_2D, texture);
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, fb_texture);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, fb_texture);
|
||||||
|
|
||||||
// do the heavy lifting
|
// do the heavy lifting
|
||||||
if (vo->tex_coord)
|
if (vo->tex_coord)
|
||||||
GL_DrawAliasFrameTriMulti (vo);
|
GL_DrawAliasFrameTriMulti (vo);
|
||||||
else
|
else
|
||||||
GL_DrawAliasFrameMulti (vo);
|
GL_DrawAliasFrameMulti (vo);
|
||||||
|
|
||||||
// restore the settings
|
// restore the settings
|
||||||
|
@ -775,8 +775,9 @@ R_DrawAliasModel (entity_t *e)
|
||||||
qfglDepthMask (GL_TRUE);
|
qfglDepthMask (GL_TRUE);
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglPopMatrix ();
|
qfglPopMatrix ();
|
||||||
} else if (modelalpha < 1.0)
|
} else if (modelalpha < 1.0) {
|
||||||
qfglDepthMask (GL_TRUE);
|
qfglDepthMask (GL_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
Cache_Release (&e->model->cache);
|
Cache_Release (&e->model->cache);
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,12 +271,28 @@ R_DrawEntitiesOnList (void)
|
||||||
|
|
||||||
R_DrawAliasModel (currententity);
|
R_DrawAliasModel (currententity);
|
||||||
}
|
}
|
||||||
|
qfglColor3ubv (color_white);
|
||||||
if (tess)
|
if (tess)
|
||||||
qfglDisable (GL_PN_TRIANGLES_ATI);
|
qfglDisable (GL_PN_TRIANGLES_ATI);
|
||||||
if (gl_affinemodels->int_val)
|
if (gl_affinemodels->int_val)
|
||||||
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
||||||
|
if (gl_mtex_active) { // FIXME: Ugly, but faster than cleaning up in every
|
||||||
|
// R_DrawAliasModel()!
|
||||||
|
qfglColor4ubv (color_white);
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
if (gl_combine_capable && gl_doublebright->int_val) {
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0);
|
||||||
|
} else {
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
}
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
}
|
||||||
|
|
||||||
qfglColor3ubv (color_white);
|
|
||||||
qfglEnable (GL_ALPHA_TEST);
|
qfglEnable (GL_ALPHA_TEST);
|
||||||
if (gl_va_capable)
|
if (gl_va_capable)
|
||||||
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, spriteVertexArray);
|
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, spriteVertexArray);
|
||||||
|
@ -305,11 +321,28 @@ R_DrawViewModel (void)
|
||||||
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
||||||
if (gl_affinemodels->int_val)
|
if (gl_affinemodels->int_val)
|
||||||
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
|
|
||||||
R_DrawAliasModel (currententity);
|
R_DrawAliasModel (currententity);
|
||||||
|
qfglColor3ubv (color_white);
|
||||||
|
if (gl_mtex_active) { // FIXME: Ugly, but faster than cleaning up in every
|
||||||
|
// R_DrawAliasModel()!
|
||||||
|
qfglColor4ubv (color_white);
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
if (gl_combine_capable && gl_doublebright->int_val) {
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0);
|
||||||
|
} else {
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
}
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
}
|
||||||
if (gl_affinemodels->int_val)
|
if (gl_affinemodels->int_val)
|
||||||
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
||||||
qfglDepthRange (gldepthmin, gldepthmax);
|
qfglDepthRange (gldepthmin, gldepthmax);
|
||||||
qfglColor3ubv (color_white);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -556,19 +589,22 @@ R_Mirror (void)
|
||||||
s = r_worldentity.model->textures[mirrortexturenum]->texturechain;
|
s = r_worldentity.model->textures[mirrortexturenum]->texturechain;
|
||||||
for (; s; s = s->texturechain) {
|
for (; s; s = s->texturechain) {
|
||||||
texture_t *tex;
|
texture_t *tex;
|
||||||
|
|
||||||
if (!s->texinfo->texture->anim_total)
|
if (!s->texinfo->texture->anim_total)
|
||||||
tex = s->texinfo->texture;
|
tex = s->texinfo->texture;
|
||||||
else
|
else
|
||||||
tex = R_TextureAnimation (s);
|
tex = R_TextureAnimation (s);
|
||||||
|
|
||||||
// FIXME: if this is needed, then include header for fullbright_polys
|
// FIXME: Needs to set the texture, the tmu, and include the header, and then
|
||||||
// if ( tex->gl_fb_texturenum > 0) {
|
// clean up afterwards.
|
||||||
|
// if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
||||||
|
// && gl_fb_models->int_val) {
|
||||||
// s->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
// s->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
||||||
// fullbright_polys[tex->gl_fb_texturenum] = s->polys;
|
// fullbright_polys[tex->gl_fb_texturenum] = s->polys;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
R_RenderBrushPoly (s);
|
R_RenderBrushPoly (s, tex);
|
||||||
}
|
}
|
||||||
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
|
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
|
||||||
qfglColor3ubv (color_white);
|
qfglColor3ubv (color_white);
|
||||||
|
|
|
@ -145,10 +145,10 @@ R_RenderFullbrights (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
R_RenderBrushPoly (msurface_t *fa)
|
R_RenderBrushPoly (msurface_t *fa, texture_t *tex)
|
||||||
{
|
{
|
||||||
float *v;
|
float *v;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
c_brush_polys++;
|
c_brush_polys++;
|
||||||
|
|
||||||
|
@ -156,14 +156,20 @@ R_RenderBrushPoly (msurface_t *fa)
|
||||||
v = fa->polys->verts[0];
|
v = fa->polys->verts[0];
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
&& gl_fb_bmodels->int_val) {
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
||||||
|
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
||||||
if (gl_mtex_fullbright)
|
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 2, &v[3]);
|
qglMultiTexCoord2fv (gl_mtex_enum + 2, &v[3]);
|
||||||
|
qfglVertex3fv (v);
|
||||||
qfglVertex3fv (v);
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
||||||
|
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
||||||
|
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
||||||
|
qfglVertex3fv (v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
||||||
|
@ -260,25 +266,12 @@ DrawTextureChains (void)
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
texture_t *tex;
|
texture_t *tex;
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
// Fullbrights
|
|
||||||
if (gl_mtex_fullbright) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lightmaps
|
// Lightmaps
|
||||||
qglActiveTexture (gl_mtex_enum +1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
if (gl_combine_capable && gl_doublebright->int_val) {
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0);
|
|
||||||
} else {
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
}
|
|
||||||
qfglEnable (GL_TEXTURE_2D); // I hope this can go here...
|
|
||||||
|
|
||||||
// Base texture
|
// Base Texture
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -290,36 +283,36 @@ DrawTextureChains (void)
|
||||||
if (!tex)
|
if (!tex)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (gl_mtex_active)
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
|
||||||
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
|
||||||
|
|
||||||
if (gl_mtex_fullbright && gl_fb_bmodels->int_val
|
|
||||||
&& tex->gl_fb_texturenum) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
|
||||||
|
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
||||||
|
&& gl_fb_bmodels->int_val) {
|
||||||
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
||||||
|
}
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
|
||||||
for (s = tex->texturechain; s; s = s->texturechain) {
|
for (s = tex->texturechain; s; s = s->texturechain) {
|
||||||
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
||||||
s->lightmaptexturenum);
|
s->lightmaptexturenum);
|
||||||
|
|
||||||
R_RenderBrushPoly (s);
|
R_RenderBrushPoly (s, tex);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (s = tex->texturechain; s; s = s->texturechain)
|
|
||||||
R_RenderBrushPoly (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gl_mtex_fullbright && gl_fb_bmodels->int_val
|
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
||||||
&& tex->gl_fb_texturenum) {
|
&& gl_fb_bmodels->int_val) {
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
} else {
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
|
||||||
|
for (s = tex->texturechain; s; s = s->texturechain)
|
||||||
|
R_RenderBrushPoly (s, tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
tex->texturechain = NULL;
|
tex->texturechain = NULL;
|
||||||
|
@ -336,7 +329,7 @@ DrawTextureChains (void)
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
// Rest mode for default TMU
|
// Reset mode for default TMU
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
}
|
}
|
||||||
|
@ -429,24 +422,6 @@ R_DrawBrushModel (entity_t *e)
|
||||||
R_CalcLightmaps ();
|
R_CalcLightmaps ();
|
||||||
psurf = &model->surfaces[model->firstmodelsurface];
|
psurf = &model->surfaces[model->firstmodelsurface];
|
||||||
|
|
||||||
// Fullbrights
|
|
||||||
if (gl_mtex_fullbright) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lightmaps
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
|
||||||
if (gl_doublebright->int_val && gl_combine_capable) {
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0);
|
|
||||||
} else {
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
}
|
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
// Regular texture (DON'T GL_REPLACE!)
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
} else {
|
} else {
|
||||||
psurf = &model->surfaces[model->firstmodelsurface];
|
psurf = &model->surfaces[model->firstmodelsurface];
|
||||||
|
@ -488,38 +463,45 @@ R_DrawBrushModel (entity_t *e)
|
||||||
else
|
else
|
||||||
tex = R_TextureAnimation (psurf);
|
tex = R_TextureAnimation (psurf);
|
||||||
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
|
||||||
|
|
||||||
qfglColor4fv (color);
|
qfglColor4fv (color);
|
||||||
|
|
||||||
if (gl_fb_bmodels->int_val && gl_mtex_fullbright
|
|
||||||
&& tex->gl_fb_texturenum > 0) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
|
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
||||||
|
&& gl_mtex_fullbright) {
|
||||||
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
||||||
|
}
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
||||||
psurf->lightmaptexturenum);
|
psurf->lightmaptexturenum);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
} else {
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_RenderBrushPoly (psurf);
|
R_RenderBrushPoly (psurf, tex);
|
||||||
|
|
||||||
if (gl_fb_bmodels->int_val && gl_mtex_fullbright
|
|
||||||
&& tex->gl_fb_texturenum > 0) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
|
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
||||||
|
&& gl_mtex_fullbright) {
|
||||||
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
qfglColor3ubv (color_white);
|
qfglColor3ubv (color_white);
|
||||||
|
|
||||||
if (tex->gl_fb_texturenum > 0 && gl_fb_bmodels->int_val
|
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
||||||
&& !gl_mtex_fullbright) {
|
&& !gl_mtex_fullbright) {
|
||||||
psurf->polys->fb_chain =
|
psurf->polys->fb_chain =
|
||||||
fullbright_polys[tex->gl_fb_texturenum];
|
fullbright_polys[tex->gl_fb_texturenum];
|
||||||
|
@ -533,7 +515,9 @@ R_DrawBrushModel (entity_t *e)
|
||||||
// Go away, lightmap
|
// Go away, lightmap
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
} else {
|
} else {
|
||||||
R_CalcAndBlendLightmaps ();
|
R_CalcAndBlendLightmaps ();
|
||||||
}
|
}
|
||||||
|
@ -597,7 +581,7 @@ visit_node (mnode_t *node, int side)
|
||||||
tex = surf->texinfo->texture;
|
tex = surf->texinfo->texture;
|
||||||
else
|
else
|
||||||
tex = R_TextureAnimation (surf);
|
tex = R_TextureAnimation (surf);
|
||||||
if (tex->gl_fb_texturenum > 0) {
|
if (tex->gl_fb_texturenum) {
|
||||||
surf->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
surf->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
||||||
fullbright_polys[tex->gl_fb_texturenum] = surf->polys;
|
fullbright_polys[tex->gl_fb_texturenum] = surf->polys;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,6 @@ GL_Init_Common (void)
|
||||||
|
|
||||||
qfglEnable (GL_BLEND);
|
qfglEnable (GL_BLEND);
|
||||||
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
CheckMultiTextureExtensions ();
|
CheckMultiTextureExtensions ();
|
||||||
|
@ -424,6 +423,31 @@ GL_Init_Common (void)
|
||||||
CheckTruFormExtensions ();
|
CheckTruFormExtensions ();
|
||||||
GL_Common_Init_Cvars ();
|
GL_Common_Init_Cvars ();
|
||||||
CheckVertexArraySize ();
|
CheckVertexArraySize ();
|
||||||
|
|
||||||
|
if (gl_mtex_active) {
|
||||||
|
// Fullbrights
|
||||||
|
if (gl_mtex_fullbright) {
|
||||||
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lightmaps
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
if (gl_combine_capable && gl_doublebright->int_val) {
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0);
|
||||||
|
} else {
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
}
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
// Base Texture
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue