ref: gl: support lightmapped water on transparent brushes

This commit is contained in:
Alibek Omarov
2024-08-22 23:13:34 +03:00
parent d23968b12e
commit 83194ca0f5
+19 -9
View File
@@ -971,6 +971,8 @@ static qboolean R_HasLightmap( void )
switch( RI.currententity->curstate.rendermode )
{
case kRenderTransTexture:
return FBitSet( RI.currentmodel->flags, MODEL_LIQUID ) ? true : false;
case kRenderTransColor:
case kRenderTransAdd:
case kRenderGlow:
@@ -1000,21 +1002,29 @@ static void R_BlendLightmaps( void )
pglEnable( GL_BLEND );
else pglDisable( GL_BLEND );
// lightmapped solid surfaces
pglDepthMask( GL_FALSE );
pglDepthFunc( GL_EQUAL );
pglDisable( GL_ALPHA_TEST );
if( gl_overbright.value )
if( RI.currententity->curstate.rendermode == kRenderTransTexture )
{
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
if(!( r_vbo.value && !r_vbo_overbrightmode.value ))
pglColor4f( 128.0f / 192.0f, 128.0f / 192.0f, 128.0f / 192.0f, 1.0f );
pglBlendFunc( GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA );
}
else
{
pglBlendFunc( GL_ZERO, GL_SRC_COLOR );
// lightmapped solid surfaces
pglDepthMask( GL_FALSE );
pglDepthFunc( GL_EQUAL );
if( gl_overbright.value )
{
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
if(!( r_vbo.value && !r_vbo_overbrightmode.value ))
pglColor4f( 128.0f / 192.0f, 128.0f / 192.0f, 128.0f / 192.0f, 1.0f );
}
else
{
pglBlendFunc( GL_ZERO, GL_SRC_COLOR );
}
}
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
// render static lightmaps first