Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/client/StarClientApplication.cpp
diff options
context:
space:
mode:
authorBottinator22 <bottinator22@gmail.com>2025-04-01 09:54:35 -0700
committerBottinator22 <bottinator22@gmail.com>2025-04-01 09:54:35 -0700
commit1354fa689ab0e8cde06b75789ab53b5f4edd532b (patch)
tree0232a0d0d27391eb75cb9b1a7ceffc3373a1a14d /source/client/StarClientApplication.cpp
parent941f4f9a20eedd20b32ffd817bb6a5ecb2e80b55 (diff)
configurable number of post-process shader passes
Diffstat (limited to 'source/client/StarClientApplication.cpp')
-rw-r--r--source/client/StarClientApplication.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index 3c7ec8d..7c1af16 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -492,6 +492,7 @@ void ClientApplication::renderReload() {
// define post process layers and optionally assign them to groups
m_postProcessLayers.clear();
+ m_labelledPostProcessLayers.clear();
auto postProcessLayers = assets->json("/client.config:postProcessLayers").toArray();
for (auto& layer : postProcessLayers) {
auto effects = jsonToStringList(layer.getArray("effects"));
@@ -502,18 +503,28 @@ void ClientApplication::renderReload() {
if (gname) {
group = &m_postProcessGroups.get(gname.value());
}
+ // I'd think a string map for all of these would be better, but the order does matter here, and does make sense to depend on mod priority, so...
+ // guess a string map of indices works
+ // I tried pointers but for whatever reason the behaviour was highly inconsistent and only worked after reload...
+ auto label = layer.optString("name");
+ if (label) {
+ m_labelledPostProcessLayers.add(label.value(),m_postProcessLayers.count());
+ }
m_postProcessLayers.append(PostProcessLayer{ std::move(effects), (unsigned)layer.getUInt("passes", 1), group });
}
loadEffectConfig("interface");
}
-void ClientApplication::setPostProcessGroupEnabled(String group, bool enabled, Maybe<bool> save) {
+void ClientApplication::setPostProcessLayerPasses(String const& layer, unsigned const& passes) {
+ m_postProcessLayers.at(m_labelledPostProcessLayers.get(layer)).passes = passes;
+}
+void ClientApplication::setPostProcessGroupEnabled(String const& group, bool const& enabled, Maybe<bool> const& save) {
m_postProcessGroups.get(group).enabled = enabled;
if (save && save.value())
m_root->configuration()->setPath(strf("{}.{}.enabled", postProcessGroupsRoot, group),enabled);
}
-bool ClientApplication::postProcessGroupEnabled(String group) {
+bool ClientApplication::postProcessGroupEnabled(String const& group) {
return m_postProcessGroups.get(group).enabled;
}