1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

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>
This commit is contained in:
x2048 2022-09-06 08:25:18 +02:00 committed by GitHub
parent 464043b8ab
commit ff6dcfea82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 1476 additions and 565 deletions

View file

@ -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;
void initTextures() override;
void clearTextures() override;
void beforeDraw() override;
void upscale();
public:
RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud);
void drawAll() override;
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;
};
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:
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);