Skip to content

Commit

Permalink
ref: gl: support lightmapped water on transparent brushes
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Aug 22, 2024
1 parent d23968b commit 83194ca
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions ref/gl/gl_rsurf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 83194ca

Please sign in to comment.