Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: gl: added gl_fog cvar for better GoldSrc compatibility #1889

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ref/gl/gl_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ extern convar_t gl_test; // cvar to testify new effects
extern convar_t gl_msaa;
extern convar_t gl_stencilbits;
extern convar_t gl_overbright;
extern convar_t gl_fog;

extern convar_t r_lighting_extended;
extern convar_t r_lighting_ambient;
Expand Down
2 changes: 2 additions & 0 deletions ref/gl/gl_opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CVAR_DEFINE_AUTO( gl_test, "0", 0, "engine developer cvar for quick testing new
CVAR_DEFINE_AUTO( gl_msaa, "1", FCVAR_GLCONFIG, "enable or disable multisample anti-aliasing" );
CVAR_DEFINE_AUTO( gl_stencilbits, "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" );
CVAR_DEFINE_AUTO( gl_overbright, "1", FCVAR_GLCONFIG, "overbrights" );
CVAR_DEFINE_AUTO( gl_fog, "1", FCVAR_GLCONFIG, "allow for rendering fog using built-in OpenGL fog implementation" );
CVAR_DEFINE_AUTO( r_lighting_extended, "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" );
CVAR_DEFINE_AUTO( r_lighting_ambient, "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" );
CVAR_DEFINE_AUTO( r_detailtextures, "1", FCVAR_GLCONFIG, "enable detail textures support" );
Expand Down Expand Up @@ -1208,6 +1209,7 @@ static void GL_InitCommands( void )
gEngfuncs.Cvar_RegisterVariable( &gl_stencilbits );
gEngfuncs.Cvar_RegisterVariable( &gl_round_down );
gEngfuncs.Cvar_RegisterVariable( &gl_overbright );
gEngfuncs.Cvar_RegisterVariable( &gl_fog );

// these cvar not used by engine but some mods requires this
gEngfuncs.Cvar_RegisterVariable( &gl_polyoffset );
Expand Down
5 changes: 3 additions & 2 deletions ref/gl/gl_rmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void R_AllowFog( qboolean allowed )
{
if( allowed )
{
if( glState.isFogEnabled )
if( glState.isFogEnabled && gl_fog.value )
pglEnable( GL_FOG );
}
else
Expand Down Expand Up @@ -800,7 +800,8 @@ R_DrawFog
*/
void R_DrawFog( void )
{
if( !RI.fogEnabled ) return;
if( !RI.fogEnabled || !gl_fog.value )
return;

pglEnable( GL_FOG );
if( ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
Expand Down
2 changes: 1 addition & 1 deletion ref/gl/gl_triapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ enables global fog on the level
void TriFog( float flFogColor[3], float flStart, float flEnd, int bOn )
{
// overrided by internal fog
if( RI.fogEnabled ) return;
if( RI.fogEnabled || !gl_fog.value ) return;
RI.fogCustom = bOn;

// check for invalid parms
Expand Down