Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
DeferredRenderer.hpp
1#pragma once
2
3#include "DeferredLight.hpp"
4#include "ForwardLight.hpp"
5
6#include "renderers/DebugLightRenderer.hpp"
7
8#include "scene/Scene.hpp"
9#include "renderers/Renderer.hpp"
10#include "renderers/Culler.hpp"
11
12#include "resources/Texture.hpp"
13#include "input/ControllableCamera.hpp"
14
15#include "processing/SSAO.hpp"
16
17#include "Common.hpp"
18
90class DeferredRenderer final : public Renderer {
91
92public:
98 explicit DeferredRenderer(const glm::vec2 & resolution, bool ssao, const std::string & name);
99
103 void setScene(const std::shared_ptr<Scene> & scene);
104
106 void draw(const Camera & camera, Texture* dstColor, Texture* dstDepth, uint layer = 0) override;
107
110 void resize(uint width, uint height) override;
111
113 void interface() override;
114
117
118private:
119
125 void renderOpaque(const Culler::List & visibles, const glm::mat4 & view, const glm::mat4 & proj);
126
132 void renderTransparent(const Culler::List & visibles, const glm::mat4 & view, const glm::mat4 & proj);
133
139 void renderBackground(const glm::mat4 & view, const glm::mat4 & proj, const glm::vec3 & pos);
140
148 std::unique_ptr<SSAO> _ssaoPass;
149 std::unique_ptr<DeferredLight> _lightRenderer;
150 std::unique_ptr<DeferredProbe> _probeRenderer;
151 std::unique_ptr<ForwardLight> _fwdLightsGPU;
152 std::unique_ptr<ForwardProbe> _fwdProbesGPU;
153
165
169
171
172 std::shared_ptr<Scene> _scene;
173 std::unique_ptr<Culler> _culler;
174
175 bool _applySSAO = true;
176};
This class represents a camera as used in real-time rendering APIs. It provides a view and projection...
Definition: Camera.hpp:11
std::vector< long > List
Indices of selected objects.
Definition: Culler.hpp:15
Performs deferred rendering of a scene.
Definition: DeferredRenderer.hpp:90
std::unique_ptr< DeferredLight > _lightRenderer
The lights renderer.
Definition: DeferredRenderer.hpp:149
Program * _transparentProgram
Transparent PBR program.
Definition: DeferredRenderer.hpp:162
Texture _indirectLighting
Indirect lighting accumulation.
Definition: DeferredRenderer.hpp:146
Program * _objectProgram
Basic PBR program.
Definition: DeferredRenderer.hpp:154
std::unique_ptr< ForwardProbe > _fwdProbesGPU
The probes forward renderer for transparent objects.
Definition: DeferredRenderer.hpp:152
Program * _emissiveProgram
Emissive program.
Definition: DeferredRenderer.hpp:161
Texture _depthCopy
Lighting detph copy.
Definition: DeferredRenderer.hpp:147
void setScene(const std::shared_ptr< Scene > &scene)
Definition: DeferredRenderer.cpp:55
Program * _atmoProgram
Atmospheric scattering program.
Definition: DeferredRenderer.hpp:168
Texture _sceneAlbedo
Scene albedo.
Definition: DeferredRenderer.hpp:141
Program * _skyboxProgram
Skybox program.
Definition: DeferredRenderer.hpp:166
const Texture * _textureBrdf
The BRDF lookup table.
Definition: DeferredRenderer.hpp:170
bool _applySSAO
Screen space ambient occlusion.
Definition: DeferredRenderer.hpp:175
Texture _lighting
Lighting accumulation.
Definition: DeferredRenderer.hpp:145
Texture & sceneDepth()
Definition: DeferredRenderer.cpp:470
std::shared_ptr< Scene > _scene
The scene to render.
Definition: DeferredRenderer.hpp:172
std::unique_ptr< DeferredProbe > _probeRenderer
The probes renderer.
Definition: DeferredRenderer.hpp:150
Texture _sceneEffects
Scene material parameters.
Definition: DeferredRenderer.hpp:143
void draw(const Camera &camera, Texture *dstColor, Texture *dstDepth, uint layer=0) override
Definition: DeferredRenderer.cpp:337
void renderTransparent(const Culler::List &visibles, const glm::mat4 &view, const glm::mat4 &proj)
Definition: DeferredRenderer.cpp:186
Program * _parallaxProgram
Parallax mapping PBR program.
Definition: DeferredRenderer.hpp:155
std::unique_ptr< ForwardLight > _fwdLightsGPU
The lights forward renderer for transparent objects.
Definition: DeferredRenderer.hpp:151
std::unique_ptr< SSAO > _ssaoPass
SSAO processing.
Definition: DeferredRenderer.hpp:148
void renderOpaque(const Culler::List &visibles, const glm::mat4 &view, const glm::mat4 &proj)
Definition: DeferredRenderer.cpp:66
void interface() override
Definition: DeferredRenderer.cpp:456
Texture _sceneNormal
Scene normals.
Definition: DeferredRenderer.hpp:142
Program * _subsurfaceProgram
PBR with subsurface scattering.
Definition: DeferredRenderer.hpp:160
void renderBackground(const glm::mat4 &view, const glm::mat4 &proj, const glm::vec3 &pos)
Definition: DeferredRenderer.cpp:283
Program * _bgProgram
Planar background program.
Definition: DeferredRenderer.hpp:167
Program * _clearCoatProgram
Basic PBR program with an additional clear coat specular layer.
Definition: DeferredRenderer.hpp:156
Program * _iridescentProgram
PBR with iridescent Fresnel.
Definition: DeferredRenderer.hpp:159
Program * _transpIridProgram
Transparent PBR with iridescent Fresnel program.
Definition: DeferredRenderer.hpp:163
void resize(uint width, uint height) override
Definition: DeferredRenderer.cpp:442
Program * _probeNormalization
Indirect lighting normalization program.
Definition: DeferredRenderer.hpp:164
std::unique_ptr< Culler > _culler
Objects culler.
Definition: DeferredRenderer.hpp:173
Texture _sceneDepth
Scene depth.
Definition: DeferredRenderer.hpp:144
Program * _anisotropicProgram
Basic PBR with anisotropic roughness.
Definition: DeferredRenderer.hpp:157
Program * _sheenProgram
PBR with sheen BRDF.
Definition: DeferredRenderer.hpp:158
Represents a group of shaders used for rendering.
Definition: Program.hpp:31
Base structure of a renderer.
Definition: Renderer.hpp:10
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12