From 592b865ca5c98d1df2153ea5b77f67aa8a76db60 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 14:11:40 +0100 Subject: Add HDR tonemap brightness slider The engine applies mat_monitorgamma (SDL receives changing ramp midpoints), but Wayland/XWayland compositors discard the window gamma ramp, so the gamma slider has no visible effect there. Add an in-engine brightness control that does not depend on the window system: mat_force_tonemap_scale, exposed as "HDR brightness" (x10, 0 = automatic). Drop the temporary SDL gamma ramp diagnostic. --- src/menu.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/menu.cpp') diff --git a/src/menu.cpp b/src/menu.cpp index 248aa48..033c0f9 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -82,6 +82,7 @@ bool g_edge_jump = false; int g_fov_camera = 75; // HL2's stock camera FOV int g_fov_viewmodel = 54; // HL2's stock viewmodel FOV int g_gamma = 22; // mat_monitorgamma x10, stock 2.2 +int g_tonemap = 0; // mat_force_tonemap_scale x10, 0 = automatic int g_esp_col_hostile[3] = {255, 60, 60}; int g_esp_col_neutral[3] = {220, 220, 220}; int g_esp_col_friendly[3] = {60, 255, 60}; @@ -248,8 +249,8 @@ void config_save() { g_esp_col_neutral[0], g_esp_col_neutral[1], g_esp_col_neutral[2], g_esp_col_friendly[0], g_esp_col_friendly[1], g_esp_col_friendly[2]); - fprintf(f, "[view]\nfov=%d\nvmfov=%d\ngamma=%d\n", g_fov_camera, - g_fov_viewmodel, g_gamma); + fprintf(f, "[view]\nfov=%d\nvmfov=%d\ngamma=%d\ntonemap=%d\n", + g_fov_camera, g_fov_viewmodel, g_gamma, g_tonemap); fprintf(f, "[movement]\ncrouchjump=%d\nedgejump=%d\n", (int)g_auto_crouchjump, (int)g_edge_jump); gui_config_write(f); @@ -409,6 +410,11 @@ static bool config_load() { lo = 16; hi = 26; // the engine clamps mat_monitorgamma at 2.6 stock = 22; + } else if (strcmp(key, "tonemap") == 0) { + dst = &g_tonemap; + lo = 0; + hi = 30; + stock = 0; } if (dst) { int v = atoi(val); @@ -605,6 +611,7 @@ void config_reset_defaults() { g_fov_camera = 75; g_fov_viewmodel = 54; g_gamma = 22; + g_tonemap = 0; g_esp_col_hostile[0] = 255; g_esp_col_hostile[1] = 60; g_esp_col_hostile[2] = 60; -- cgit v1.2.3