added downsampling option

This commit is contained in:
thecozies 2024-03-27 17:43:15 -05:00
parent 8853fc0d7b
commit 5f74dfa2ba
5 changed files with 45 additions and 16 deletions

View File

@ -17,12 +17,14 @@
</div>
</div>
<div class="config-option">
<label class="config-option__title">Window Mode</label>
<label class="config-option__title">Downsampling Quality</label>
<div class="config-option__list">
<input type="radio" name="windowmode" data-checked="wm_option" value="Windowed" id="wm_windowed" style="nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="wm_windowed">Windowed</label>
<input type="radio" name="windowmode" data-checked="wm_option" value="Fullscreen" id="wm_fullscreen" style="nav-right:none;nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="wm_fullscreen">Fullscreen</label>
<input type="radio" name="downsampling" data-checked="ds_option" value="1" id="ds_windowed" style="nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="ds_windowed">Off</label>
<input type="radio" name="downsampling" data-checked="ds_option" value="2" id="ds_2x" style="nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="ds_2x">2x</label>
<input type="radio" name="downsampling" data-checked="ds_option" value="4" id="ds_4x" style="nav-right:none;nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="ds_4x">4x</label>
</div>
</div>
</div>
@ -37,16 +39,12 @@
</div>
</div>
<div class="config-option">
<label class="config-option__title">MS Anti-Aliasing</label>
<label class="config-option__title">Window Mode</label>
<div class="config-option__list">
<input type="radio" name="antialiasing" data-checked="msaa_option" value="None" id="msaa_none" style="nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_none">None</label>
<input type="radio" name="antialiasing" data-checked="msaa_option" value="MSAA2X" id="msaa_2x" style="nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_2x">2x</label>
<input type="radio" name="antialiasing" data-checked="msaa_option" value="MSAA4X" id="msaa_4x" style="nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_4x">4x</label>
<!-- <input type="radio" name="antialiasing" data-checked="msaa_option" value="MSAA8X" id="msaa_8x" style="nav-right:none;nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_8x">8x</label> -->
<input type="radio" name="windowmode" data-checked="wm_option" value="Windowed" id="wm_windowed" />
<label class="config-option__tab-label" for="wm_windowed">Windowed</label>
<input type="radio" name="windowmode" data-checked="wm_option" value="Fullscreen" id="wm_fullscreen" style="nav-right:none"/>
<label class="config-option__tab-label" for="wm_fullscreen">Fullscreen</label>
</div>
</div>
</div>
@ -85,6 +83,19 @@
<input id="rr_manual_input" type="range" min="20" max="360" style="flex:1;margin: 0dp;nav-up:auto;nav-down:auto;" data-value="rr_manual_value"/>
</div>
</div>
<div class="config-option">
<label class="config-option__title">MS Anti-Aliasing</label>
<div class="config-option__list">
<input type="radio" name="antialiasing" data-checked="msaa_option" value="None" id="msaa_none" style="nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_none">None</label>
<input type="radio" name="antialiasing" data-checked="msaa_option" value="MSAA2X" id="msaa_2x" style="nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_2x">2x</label>
<input type="radio" name="antialiasing" data-checked="msaa_option" value="MSAA4X" id="msaa_4x" style="nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_4x">4x</label>
<!-- <input type="radio" name="antialiasing" data-checked="msaa_option" value="MSAA8X" id="msaa_8x" style="nav-right:none;nav-down:#apply_button"/>
<label class="config-option__tab-label" for="msaa_8x">8x</label> -->
</div>
</div>
</div>
</div>
<div class="config__footer">

View File

@ -23,6 +23,7 @@ constexpr auto wm_default = ultramodern::WindowMode::Windowed;
constexpr auto ar_default = RT64::UserConfiguration::AspectRatio::Expand;
constexpr auto msaa_default = RT64::UserConfiguration::Antialiasing::MSAA2X;
constexpr auto rr_default = RT64::UserConfiguration::RefreshRate::Display;
constexpr int ds_default = 1;
constexpr int rr_manual_default = 60;
constexpr bool developer_mode_default = false;
@ -55,6 +56,7 @@ namespace ultramodern {
j = json{
{"res_option", config.res_option},
{"wm_option", config.wm_option},
{"ds_option", config.ds_option},
{"ar_option", config.ar_option},
{"msaa_option", config.msaa_option},
{"rr_option", config.rr_option},
@ -66,6 +68,7 @@ namespace ultramodern {
void from_json(const json& j, GraphicsConfig& config) {
config.res_option = from_or_default(j, "res_option", res_default);
config.wm_option = from_or_default(j, "wm_option", wm_default);
config.ds_option = from_or_default(j, "ds_option", ds_default);
config.ar_option = from_or_default(j, "ar_option", ar_default);
config.msaa_option = from_or_default(j, "msaa_option", msaa_default);
config.rr_option = from_or_default(j, "rr_option", rr_default);
@ -171,6 +174,7 @@ void recomp::reset_graphics_options() {
ultramodern::GraphicsConfig new_config{};
new_config.res_option = res_default;
new_config.wm_option = wm_default;
new_config.ds_option = ds_default;
new_config.ar_option = ar_default;
new_config.msaa_option = msaa_default;
new_config.rr_option = rr_default;

View File

@ -234,13 +234,17 @@ void RT64UpdateConfig(RT64::Application* application, const ultramodern::Graphic
default:
case ultramodern::Resolution::Auto:
application->userConfig.resolution = RT64::UserConfiguration::Resolution::WindowIntegerScale;
application->userConfig.downsampleMultiplier = 1;
break;
case ultramodern::Resolution::Original:
application->userConfig.resolution = RT64::UserConfiguration::Resolution::Original;
application->userConfig.resolution = RT64::UserConfiguration::Resolution::Manual;
application->userConfig.resolutionMultiplier = new_config.ds_option;
application->userConfig.downsampleMultiplier = new_config.ds_option;
break;
case ultramodern::Resolution::Original2x:
application->userConfig.resolution = RT64::UserConfiguration::Resolution::Manual;
application->userConfig.resolutionMultiplier = 2.0;
application->userConfig.resolutionMultiplier = 2.0 * new_config.ds_option;
application->userConfig.downsampleMultiplier = new_config.ds_option;
break;
}

View File

@ -65,6 +65,7 @@ void bind_atomic(Rml::DataModelConstructor& constructor, Rml::DataModelHandle ha
static int scanned_binding_index = -1;
static int scanned_input_index = -1;
static int focused_input_index = -1;
static bool cont_active = true;
static recomp::InputDevice cur_device = recomp::InputDevice::Controller;
@ -305,6 +306,14 @@ public:
new_options.rr_manual_value = in.Get<int>();
graphics_model_handle.DirtyVariable("options_changed");
});
constructor.BindFunc("ds_option",
[](Rml::Variant& out) {
out = new_options.ds_option;
},
[](const Rml::Variant& in) {
new_options.ds_option = in.Get<int>();
graphics_model_handle.DirtyVariable("options_changed");
});
constructor.BindFunc("options_changed",
[](Rml::Variant& out) {

View File

@ -23,6 +23,7 @@ namespace ultramodern {
RT64::UserConfiguration::Antialiasing msaa_option;
RT64::UserConfiguration::RefreshRate rr_option;
int rr_manual_value;
int ds_option;
bool developer_mode;
auto operator<=>(const GraphicsConfig& rhs) const = default;