mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 13:05:57 +00:00
Add colour profiles and brightness, contrast, saturation and gamma for the picture
Issue #136. With TOTK_COLOR_* away from their defaults, present_image runs one compute pass (vk_color.c, shaders/color_grade.comp) that writes the game picture's crop, adjusted, into an RGBA16F image, and FSR 1 or the blit scale that one; at the defaults nothing runs. The Screen tab gets a Colour group: a profile (Game's own, Vivid, Clarity, Custom) that sets the four values, and the four sliders. The adjustment, its order, ranges and presets are STS78721's patch from the issue, reworked onto dev: it now applies with FSR 1 scaling as well as the blit, its menu texts come from the catalog in English and Russian, and the patch's unused accessors and build_game.py change are left out. Co-authored-by: STS78721 <134802927+STS78721@users.noreply.github.com>
This commit is contained in:
1 parent
7d62cbfa85
commit
c0567191f0
10 files changed
+382
-7
No files matched your search
@@ -527,6 +527,35 @@ static const char *present_note(void) {
|
||||
}
|
||||
|
||||
// ---- the tabs
|
||||
// Colour adjustment (vk_color.c): a profile writes the four values (STS78721's presets, issue #136); moving one of them
|
||||
// makes the profile Custom.
|
||||
static void rows_color(void) {
|
||||
static const struct { const char *name, *b, *c, *s, *g; } presets[] = {
|
||||
{"default", "0", "100", "100", "1"}, {"vivid", "0", "115", "135", "0.95"}, {"clarity", "2", "110", "115", "1"}};
|
||||
static const UiTextId names[] = {UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY,
|
||||
UI_MENU_COLOR_CUSTOM};
|
||||
opt_group(UI_MENU_COLOR);
|
||||
if (opt_choice("TOTK_COLOR_PRESET", UI_MENU_COLOR_PRESET, names, 4, UI_MENU_COLOR_PRESET_DESC)) {
|
||||
const char *p = cfg_value("TOTK_COLOR_PRESET");
|
||||
for (const auto &e : presets)
|
||||
if (!strcmp(p, e.name)) {
|
||||
cfg_set("TOTK_COLOR_BRIGHTNESS", e.b), cfg_set("TOTK_COLOR_CONTRAST", e.c);
|
||||
cfg_set("TOTK_COLOR_SATURATION", e.s), cfg_set("TOTK_COLOR_GAMMA", e.g);
|
||||
cfg_save();
|
||||
}
|
||||
}
|
||||
bool moved = opt_slider("TOTK_COLOR_BRIGHTNESS", UI_MENU_COLOR_BRIGHTNESS, -30, 30, UI_MENU_COLOR_BRIGHTNESS_DESC, 1,
|
||||
"%+.0f %%");
|
||||
moved |= opt_slider("TOTK_COLOR_CONTRAST", UI_MENU_COLOR_CONTRAST, 70, 150, UI_MENU_COLOR_CONTRAST_DESC, 5, "%.0f %%");
|
||||
moved |= opt_slider("TOTK_COLOR_SATURATION", UI_MENU_COLOR_SATURATION, 50, 200, UI_MENU_COLOR_SATURATION_DESC, 5,
|
||||
"%.0f %%");
|
||||
moved |= opt_slider("TOTK_COLOR_GAMMA", UI_MENU_COLOR_GAMMA, 0.8f, 1.2f, UI_MENU_COLOR_GAMMA_DESC, 0.02f, "%.2f");
|
||||
if (moved && strcmp(cfg_value("TOTK_COLOR_PRESET"), "custom")) {
|
||||
cfg_set("TOTK_COLOR_PRESET", "custom");
|
||||
cfg_save();
|
||||
}
|
||||
}
|
||||
|
||||
static void tab_screen(float scale) {
|
||||
opt_begin("##screen", scale);
|
||||
opt_toggle("TOTK_FULLSCREEN", UI_MENU_FULLSCREEN, UI_MENU_FULLSCREEN_DESC);
|
||||
@@ -544,6 +573,7 @@ static void tab_screen(float scale) {
|
||||
opt_slider("TOTK_SHARPNESS", UI_MENU_SHARPNESS, 0, 100, UI_MENU_SHARPNESS_DESC, 5, "%.0f %%");
|
||||
static const UiTextId aspect[] = {UI_MENU_ASPECT_FIT, UI_MENU_ASPECT_STRETCH};
|
||||
opt_choice("TOTK_ASPECT", UI_MENU_ASPECT, aspect, 2, UI_MENU_ASPECT_DESC);
|
||||
rows_color();
|
||||
opt_end();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user