Skip to content

Commit

Permalink
ref: gl: Goldsrc compatible fog implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Velaron committed May 20, 2023
1 parent 7333ddc commit 838ad3a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ref/gl/gl_triapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,22 @@ void TriFog( float flFogColor[3], float flStart, float flEnd, int bOn )
RI.fogColor[0] = flFogColor[0] / 255.0f;
RI.fogColor[1] = flFogColor[1] / 255.0f;
RI.fogColor[2] = flFogColor[2] / 255.0f;
RI.fogStart = flStart;
RI.fogColor[3] = 1.0f;
RI.fogDensity = 0.0f;
RI.fogSkybox = true;

RI.fogStart = flStart;
RI.fogEnd = flEnd;

pglFogi( GL_FOG_MODE, GL_LINEAR );
if( RI.fogDensity > 0.0f )
{
pglFogi( GL_FOG_MODE, GL_EXP2 );
pglFogf( GL_FOG_DENSITY, RI.fogDensity );
}
else
{
pglFogi( GL_FOG_MODE, GL_LINEAR );
RI.fogSkybox = true;
}

pglFogfv( GL_FOG_COLOR, RI.fogColor );
pglFogf( GL_FOG_START, RI.fogStart );
pglFogf( GL_FOG_END, RI.fogEnd );
Expand Down

0 comments on commit 838ad3a

Please sign in to comment.