Browse Source

engine: added feature flag ENGINE_LINEAR_GAMMA_SPACE

pull/2/head
SNMetamorph 3 years ago committed by a1batross
parent
commit
aa07dab8ab
  1. 1
      common/enginefeatures.h
  2. 11
      engine/common/gamma.c

1
common/enginefeatures.h

@ -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_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_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_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 #endif//FEATURES_H

11
engine/common/gamma.c

@ -15,6 +15,7 @@ GNU General Public License for more details.
#include "common.h" #include "common.h"
#include "xash3d_mathlib.h" #include "xash3d_mathlib.h"
#include "enginefeatures.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Gamma conversion support // Gamma conversion support
@ -78,10 +79,16 @@ void BuildGammaTable( float lightgamma, float brightness )
byte LightToTexGamma( byte b ) byte LightToTexGamma( byte b )
{ {
return lightgammatable[b]; if( host.features & ENGINE_LINEAR_GAMMA_SPACE )
return b;
else
return lightgammatable[b];
} }
byte TextureToGamma( byte b ) byte TextureToGamma( byte b )
{ {
return texgammatable[b]; if( host.features & ENGINE_LINEAR_GAMMA_SPACE )
return b;
else
return texgammatable[b];
} }

Loading…
Cancel
Save