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/plain.h | |
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/plain.h')
-rw-r--r-- | src/client/render/plain.h | 71 |
1 files changed, 61 insertions, 10 deletions
diff --git a/src/client/render/plain.h b/src/client/render/plain.h index 80c17ed9f..5180304a4 100644 --- a/src/client/render/plain.h +++ b/src/client/render/plain.h @@ -20,19 +20,70 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "core.h" +#include "pipeline.h" -class RenderingCorePlain : public RenderingCore +/** + * Implements a pipeline step that renders the 3D scene + */ +class Draw3D : public RenderStep { -protected: - int scale = 0; - video::ITexture *lowres = nullptr; +public: + virtual void setRenderSource(RenderSource *) override {} + virtual void setRenderTarget(RenderTarget *target) override { m_target = target; } + + virtual void reset(PipelineContext &context) override {} + virtual void run(PipelineContext &context) override; + +private: + RenderTarget *m_target {nullptr}; +}; + +/** + * Implements a pipeline step that renders the game HUD + */ +class DrawHUD : public RenderStep +{ +public: + virtual void setRenderSource(RenderSource *) override {} + virtual void setRenderTarget(RenderTarget *) override {} + + virtual void reset(PipelineContext &context) override {} + virtual void run(PipelineContext &context) override; +}; + +class MapPostFxStep : public TrivialRenderStep +{ +public: + virtual void setRenderTarget(RenderTarget *) override; + virtual void run(PipelineContext &context) override; +private: + RenderTarget *target; +}; - void initTextures() override; - void clearTextures() override; - void beforeDraw() override; - void upscale(); +class RenderShadowMapStep : public TrivialRenderStep +{ +public: + virtual void run(PipelineContext &context) override; +}; +/** + * UpscaleStep step performs rescaling of the image + * in the source texture 0 to the size of the target. + */ +class UpscaleStep : public RenderStep +{ public: - RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud); - void drawAll() override; + + virtual void setRenderSource(RenderSource *source) override { m_source = source; } + virtual void setRenderTarget(RenderTarget *target) override { m_target = target; } + virtual void reset(PipelineContext &context) override {}; + virtual void run(PipelineContext &context) override; +private: + RenderSource *m_source; + RenderTarget *m_target; }; + +std::unique_ptr<RenderStep> create3DStage(Client *client, v2f scale); +RenderStep* addUpscaling(RenderPipeline *pipeline, RenderStep *previousStep, v2f downscale_factor); + +void populatePlainPipeline(RenderPipeline *pipeline, Client *client); |