diff options
author | x2048 <codeforsmile@gmail.com> | 2022-09-06 08:25:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 08:25:18 +0200 |
commit | ff6dcfea82974df6db5a557e31aaddb6bdb7a71f (patch) | |
tree | 18bafaedcfdff36a0c0719653b99370b7434b344 /src/client/render/factory.cpp | |
parent | 464043b8abdbd936640757604ecb21662592043b (diff) | |
download | minetest-ff6dcfea82974df6db5a557e31aaddb6bdb7a71f.tar.xz |
Implement rendering pipeline and post-processing (#12465)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: lhofhansl <lhofhansl@yahoo.com>
Diffstat (limited to 'src/client/render/factory.cpp')
-rw-r--r-- | src/client/render/factory.cpp | 71 |
1 files changed, 52 insertions, 19 deletions
diff --git a/src/client/render/factory.cpp b/src/client/render/factory.cpp index 7fcec40dd..4992e6192 100644 --- a/src/client/render/factory.cpp +++ b/src/client/render/factory.cpp @@ -23,30 +23,63 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "plain.h" #include "anaglyph.h" #include "interlaced.h" -#include "pageflip.h" #include "sidebyside.h" +#include "secondstage.h" +#include "client/shadows/dynamicshadowsrender.h" + +struct CreatePipelineResult +{ + v2f virtual_size_scale; + ShadowRenderer *shadow_renderer { nullptr }; + RenderPipeline *pipeline { nullptr }; +}; + +void createPipeline(const std::string &stereo_mode, IrrlichtDevice *device, Client *client, Hud *hud, CreatePipelineResult &result); RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device, Client *client, Hud *hud) { - if (stereo_mode == "none") - return new RenderingCorePlain(device, client, hud); - if (stereo_mode == "anaglyph") - return new RenderingCoreAnaglyph(device, client, hud); - if (stereo_mode == "interlaced") - return new RenderingCoreInterlaced(device, client, hud); -#ifdef STEREO_PAGEFLIP_SUPPORTED - if (stereo_mode == "pageflip") - return new RenderingCorePageflip(device, client, hud); -#endif - if (stereo_mode == "sidebyside") - return new RenderingCoreSideBySide(device, client, hud); - if (stereo_mode == "topbottom") - return new RenderingCoreSideBySide(device, client, hud, true); - if (stereo_mode == "crossview") - return new RenderingCoreSideBySide(device, client, hud, false, true); + CreatePipelineResult created_pipeline; + createPipeline(stereo_mode, device, client, hud, created_pipeline); + return new RenderingCore(device, client, hud, + created_pipeline.shadow_renderer, created_pipeline.pipeline, created_pipeline.virtual_size_scale); +} + +void createPipeline(const std::string &stereo_mode, IrrlichtDevice *device, Client *client, Hud *hud, CreatePipelineResult &result) +{ + result.shadow_renderer = createShadowRenderer(device, client); + result.virtual_size_scale = v2f(1.0f); + result.pipeline = new RenderPipeline(); + + if (result.shadow_renderer) + result.pipeline->addStep<RenderShadowMapStep>(); + + if (stereo_mode == "none") { + populatePlainPipeline(result.pipeline, client); + return; + } + if (stereo_mode == "anaglyph") { + populateAnaglyphPipeline(result.pipeline, client); + return; + } + if (stereo_mode == "interlaced") { + populateInterlacedPipeline(result.pipeline, client); + return; + } + if (stereo_mode == "sidebyside") { + populateSideBySidePipeline(result.pipeline, client, false, false, result.virtual_size_scale); + return; + } + if (stereo_mode == "topbottom") { + populateSideBySidePipeline(result.pipeline, client, true, false, result.virtual_size_scale); + return; + } + if (stereo_mode == "crossview") { + populateSideBySidePipeline(result.pipeline, client, false, true, result.virtual_size_scale); + return; + } // fallback to plain renderer errorstream << "Invalid rendering mode: " << stereo_mode << std::endl; - return new RenderingCorePlain(device, client, hud); -} + populatePlainPipeline(result.pipeline, client); +}
\ No newline at end of file |