2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2025-01-05 15:45:42 +01:00

ref: gl: added gl_fog cvar for better GoldSrc compatibility

This commit is contained in:
SNMetamorph 2024-11-21 23:17:30 +04:00 committed by Alibek Omarov
parent 0db2597d1e
commit 9244bdc7db
4 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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" );
@ -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 );

View File

@ -44,7 +44,7 @@ void R_AllowFog( qboolean allowed )
{
if( allowed )
{
if( glState.isFogEnabled )
if( glState.isFogEnabled && gl_fog.value )
pglEnable( GL_FOG );
}
else
@ -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 ))

View File

@ -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