Skip to content

Commit

Permalink
engine: added feature flag ENGINE_LINEAR_GAMMA_SPACE
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph authored and a1batross committed Dec 8, 2021
1 parent ac213c2 commit aa07dab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions common/enginefeatures.h
Expand Up @@ -25,5 +25,6 @@ GNU General Public License for more details.
#define ENGINE_COMPENSATE_QUAKE_BUG (1<<5) // compensate stupid quake bug (inverse pitch) for mods where this bug is fixed
#define ENGINE_IMPROVED_LINETRACE (1<<6) // new traceline that tracing through alphatextures
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer

#endif//FEATURES_H
11 changes: 9 additions & 2 deletions engine/common/gamma.c
Expand Up @@ -15,6 +15,7 @@ GNU General Public License for more details.

#include "common.h"
#include "xash3d_mathlib.h"
#include "enginefeatures.h"

//-----------------------------------------------------------------------------
// Gamma conversion support
Expand Down Expand Up @@ -78,10 +79,16 @@ void BuildGammaTable( float lightgamma, float brightness )

byte LightToTexGamma( byte b )
{
return lightgammatable[b];
if( host.features & ENGINE_LINEAR_GAMMA_SPACE )
return b;
else
return lightgammatable[b];
}

byte TextureToGamma( byte b )
{
return texgammatable[b];
if( host.features & ENGINE_LINEAR_GAMMA_SPACE )
return b;
else
return texgammatable[b];
}

0 comments on commit aa07dab

Please sign in to comment.