From 35bbdf5ee97961ecca7cda2c3ad98aed558ace60 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 14:15:49 +0100 Subject: Remove gamma slider; keep HDR brightness Wayland/XWayland discards window gamma ramps, so mat_monitorgamma could not work on the development setup. Drop the slider, config key and readback. Keep the in-engine HDR tonemap brightness and document that Fullbright turns tonemapping off. --- src/hl2h.cpp | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'src/hl2h.cpp') diff --git a/src/hl2h.cpp b/src/hl2h.cpp index a037bac..ca7ee85 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -655,13 +655,13 @@ static void install_uniform_random_hook() { } // --------------------------------------------------------------------------- -// camera / viewmodel FOV and gamma +// camera / viewmodel FOV and HDR brightness // --------------------------------------------------------------------------- // // The rendered camera FOV is derived from C_BasePlayer::m_iDefaultFOV every // frame (CViewRender::OnRenderStart copies it into default_fov), so writing // the client netvar is enough and needs no server command. The viewmodel FOV -// and monitor gamma are plain client cvars. +// is a plain client cvar. static void view_settings_apply(void *ent) { if (g_net.default_fov >= 0 && ent) @@ -673,33 +673,9 @@ static void view_settings_apply(void *ent) { console_cmd(cmd); last_vm = g_fov_viewmodel; } - static int last_gamma = 22; - static int pending_gamma = -1; - if (g_gamma != last_gamma) { - char cmd[48]; - snprintf(cmd, sizeof(cmd), "mat_monitorgamma %d.%d", g_gamma / 10, - g_gamma % 10); - console_cmd(cmd); - pending_gamma = g_gamma; - last_gamma = g_gamma; - } - if (pending_gamma >= 0) { - // ClientCmd is queued, so read the cvar on the next tick to see the value - // the engine actually accepted (it clamps mat_monitorgamma at 2.6). - float got = -1.0f; - if (g_iface.cvar) { - using FindFn = void *(*)(void *, const char *); - void *v = vfunc(g_iface.cvar, 12)(g_iface.cvar, - "mat_monitorgamma"); - if (v) - got = *(float *)((uintptr_t)v + 0x2c); // ConVar m_Value.f - } - logf("view: gamma request %d.%d, cvar reports %.2f", pending_gamma / 10, - pending_gamma % 10, got); - pending_gamma = -1; - } // In-engine brightness for HDR maps. Unlike mat_monitorgamma this does not - // depend on the window system applying a gamma ramp. + // depend on the window system applying a gamma ramp. Fullbright bypasses + // tonemapping, so the slider only has a visible effect while it is off. static int last_tonemap = 0; static int pending_tonemap = -1; if (g_tonemap != last_tonemap) { -- cgit v1.2.3