3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "interlaced.h"
26 #include "sidebyside.h"
27 #include "secondstage.h"
28 #include "client/shadows/dynamicshadowsrender.h"
30 struct CreatePipelineResult
32 v2f virtual_size_scale;
33 ShadowRenderer *shadow_renderer { nullptr };
34 RenderPipeline *pipeline { nullptr };
37 void createPipeline(const std::string &stereo_mode, IrrlichtDevice *device, Client *client, Hud *hud, CreatePipelineResult &result);
39 RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device,
40 Client *client, Hud *hud)
42 CreatePipelineResult created_pipeline;
43 createPipeline(stereo_mode, device, client, hud, created_pipeline);
44 return new RenderingCore(device, client, hud,
45 created_pipeline.shadow_renderer, created_pipeline.pipeline, created_pipeline.virtual_size_scale);
48 void createPipeline(const std::string &stereo_mode, IrrlichtDevice *device, Client *client, Hud *hud, CreatePipelineResult &result)
50 result.shadow_renderer = createShadowRenderer(device, client);
51 result.virtual_size_scale = v2f(1.0f);
52 result.pipeline = new RenderPipeline();
54 if (result.shadow_renderer)
55 result.pipeline->addStep<RenderShadowMapStep>();
57 if (stereo_mode == "none") {
58 populatePlainPipeline(result.pipeline, client);
61 if (stereo_mode == "anaglyph") {
62 populateAnaglyphPipeline(result.pipeline, client);
65 if (stereo_mode == "interlaced") {
66 populateInterlacedPipeline(result.pipeline, client);
69 if (stereo_mode == "sidebyside") {
70 populateSideBySidePipeline(result.pipeline, client, false, false, result.virtual_size_scale);
73 if (stereo_mode == "topbottom") {
74 populateSideBySidePipeline(result.pipeline, client, true, false, result.virtual_size_scale);
77 if (stereo_mode == "crossview") {
78 populateSideBySidePipeline(result.pipeline, client, false, true, result.virtual_size_scale);
82 // fallback to plain renderer
83 errorstream << "Invalid rendering mode: " << stereo_mode << std::endl;
84 populatePlainPipeline(result.pipeline, client);