mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +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:
parent
464043b8ab
commit
ff6dcfea82
32 changed files with 1476 additions and 565 deletions
|
@ -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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue