- Since tonemap tweaks are on the menu now, make their changes affect instantly.

This commit is contained in:
Rachael Alexanderson 2017-01-24 11:33:42 -05:00 committed by Christoph Oelckers
parent 6263704741
commit eb3f83f908

View file

@ -81,9 +81,6 @@ CVAR(Float, gl_exposure_min, 0.35f, CVAR_ARCHIVE)
CVAR(Float, gl_exposure_base, 0.35f, CVAR_ARCHIVE) CVAR(Float, gl_exposure_base, 0.35f, CVAR_ARCHIVE)
CVAR(Float, gl_exposure_speed, 0.05f, CVAR_ARCHIVE) CVAR(Float, gl_exposure_speed, 0.05f, CVAR_ARCHIVE)
CVAR(Float, gl_paltonemap_powtable, 2.0f, CVAR_ARCHIVE)
CVAR(Bool, gl_paltonemap_reverselookup, true, CVAR_ARCHIVE)
CUSTOM_CVAR(Int, gl_tonemap, 0, CVAR_ARCHIVE) CUSTOM_CVAR(Int, gl_tonemap, 0, CVAR_ARCHIVE)
{ {
if (self < 0 || self > 5) if (self < 0 || self > 5)
@ -136,6 +133,17 @@ CUSTOM_CVAR(Float, gl_ssao_exponent, 1.8f, 0)
if (self < 0.1f) self = 0.1f; if (self < 0.1f) self = 0.1f;
} }
CUSTOM_CVAR(Float, gl_paltonemap_powtable, 2.0f, CVAR_ARCHIVE | CVAR_NOINITCALL)
{
GLRenderer->ClearTonemapPalette();
}
CUSTOM_CVAR(Bool, gl_paltonemap_reverselookup, true, CVAR_ARCHIVE | CVAR_NOINITCALL)
{
GLRenderer->ClearTonemapPalette();
}
EXTERN_CVAR(Float, vid_brightness) EXTERN_CVAR(Float, vid_brightness)
EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_contrast)
@ -536,8 +544,11 @@ void FGLRenderer::CreateTonemapPalette()
void FGLRenderer::ClearTonemapPalette() void FGLRenderer::ClearTonemapPalette()
{ {
if (mTonemapPalette)
{
delete mTonemapPalette; delete mTonemapPalette;
mTonemapPalette = nullptr; mTonemapPalette = nullptr;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -824,12 +835,14 @@ int FGLRenderer::PTM_BestColor (const uint32 *pal_in, int r, int g, int b, int f
const PalEntry *pal = (const PalEntry *)pal_in; const PalEntry *pal = (const PalEntry *)pal_in;
static double powtable[256]; static double powtable[256];
static bool firstTime = true; static bool firstTime = true;
static float trackpowtable = 0.;
double fbestdist, fdist; double fbestdist, fdist;
int bestcolor; int bestcolor;
if (firstTime) if (firstTime || trackpowtable != gl_paltonemap_powtable)
{ {
trackpowtable = gl_paltonemap_powtable;
firstTime = false; firstTime = false;
for (int x = 0; x < 256; x++) powtable[x] = pow((double)x/255, (double)gl_paltonemap_powtable); for (int x = 0; x < 256; x++) powtable[x] = pow((double)x/255, (double)gl_paltonemap_powtable);
} }