diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-08-22 12:43:12 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 12:43:12 +1000 |
commit | 4496cc17afdd24593259b446cf83bd4f9bebecec (patch) | |
tree | dc85dbf48a2f0dc6d82e1b14c2f6fda0a79006a4 /source/client/StarClientApplication.cpp | |
parent | 483908abef0b9af2bc3494ec50bfe12be8f505c5 (diff) | |
parent | 474fad6534873d5f6b48b6f8fcc96cb2554ad1c9 (diff) |
Merge pull request #101 from Bottinator22/main
Post-processing layer support for mods
Diffstat (limited to 'source/client/StarClientApplication.cpp')
-rw-r--r-- | source/client/StarClientApplication.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 5f3d119..80f0e01 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -400,6 +400,17 @@ void ClientApplication::render() { }); LogMap::set("client_render_world_painter", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - paintStart)); LogMap::set("client_render_world_total", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - totalStart)); + + auto size = Vec2F(renderer->screenSize()); + auto quad = renderFlatRect(RectF::withSize(size/-2, size), Vec4B(0.0f,0.0f,0.0f,0.0f), 0.0f); + for (auto& layer : m_postProcessLayers) { + for(unsigned i = 0; i < layer.passes; i++) { + for (auto& effect : layer.effects) { + renderer->switchEffectConfig(effect); + renderer->render(quad); + } + } + } } renderer->switchEffectConfig("interface"); auto start = Time::monotonicMicroseconds(); @@ -449,8 +460,20 @@ void ClientApplication::renderReload() { }; renderer->loadConfig(assets->json("/rendering/opengl.config")); - + loadEffectConfig("world"); + + m_postProcessLayers.clear(); + auto postProcessLayers = assets->json("/client.config:postProcessLayers").toArray(); + for (auto& layer : postProcessLayers) { + List<String> effects; + for (auto& effect : layer.getArray("effects")) { + auto effectStr = effect.toString(); + loadEffectConfig(effectStr); + effects.append(effectStr); + } + m_postProcessLayers.append(PostProcessLayer{effects,layer.getUInt("passes",1)}); + } loadEffectConfig("interface"); } |