Allow mixing lit and unlit textures in the same map

This commit is contained in:
temx 2022-11-01 19:12:05 +01:00 committed by Ozkan Sezer
parent 58bf9dff65
commit 616e77dc61

View file

@ -573,10 +573,15 @@ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain
qboolean bound;
float entalpha;
int lastlightmap;
qboolean has_lit_water;
qboolean has_unlit_water;
if (r_drawflat_cheatsafe || r_lightmap_cheatsafe) // ericw -- !r_drawworld_cheatsafe check moved to R_DrawWorld_Water ()
return;
has_lit_water = false;
has_unlit_water = false;
if (r_oldwater.value)
{
for (i=0 ; i<model->numtextures ; i++)
@ -606,6 +611,8 @@ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain
}
else if (cl.worldmodel->haslitwater && r_litwater.value && r_world_program != 0)
{
has_lit_water = true;
GL_UseProgramFunc (r_world_program);
// Bind the buffers
@ -635,6 +642,12 @@ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain
if (!t || !t->texturechains[chain] || !(t->texturechains[chain]->flags & SURF_DRAWTURB))
continue;
if (t->texturechains[chain]->texinfo->flags & TEX_SPECIAL)
{
has_unlit_water = true;
continue;
}
bound = false;
entalpha = 1.0f;
lastlightmap = 0;
@ -686,6 +699,9 @@ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain
GL_SelectTexture (GL_TEXTURE0);
}
else
has_unlit_water = true;
if (has_unlit_water)
{
// Unlit water
for (i=0 ; i<model->numtextures ; i++)
@ -693,6 +709,8 @@ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain
t = model->textures[i];
if (!t || !t->texturechains[chain] || !(t->texturechains[chain]->flags & SURF_DRAWTURB))
continue;
if (has_lit_water && !(t->texturechains[chain]->texinfo->flags & TEX_SPECIAL))
continue;
bound = false;
entalpha = 1.0f;
for (s = t->texturechains[chain]; s; s = s->texturechain)