Update StarClientApplication.cpp

This commit is contained in:
Bottinator22 2024-08-21 19:22:25 -07:00 committed by GitHub
parent 8937f0d816
commit b0d3c88834
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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_painter", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - paintStart));
LogMap::set("client_render_world_total", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - totalStart)); 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"); renderer->switchEffectConfig("interface");
auto start = Time::monotonicMicroseconds(); auto start = Time::monotonicMicroseconds();
@ -451,6 +462,18 @@ void ClientApplication::renderReload() {
renderer->loadConfig(assets->json("/rendering/opengl.config")); renderer->loadConfig(assets->json("/rendering/opengl.config"));
loadEffectConfig("world"); 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"); loadEffectConfig("interface");
} }