Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
ForwardRenderer.hpp
1#pragma once
2
3#include "ForwardLight.hpp"
4
5#include "renderers/DebugLightRenderer.hpp"
6
7#include "scene/Scene.hpp"
8#include "renderers/Renderer.hpp"
9#include "renderers/Culler.hpp"
10
11#include "resources/Texture.hpp"
12#include "input/ControllableCamera.hpp"
13
14#include "processing/SSAO.hpp"
15
16#include "Common.hpp"
17
18
31class ForwardRenderer final : public Renderer {
32
33public:
39 explicit ForwardRenderer(const glm::vec2 & resolution, bool ssao, const std::string & name);
40
44 void setScene(const std::shared_ptr<Scene> & scene);
45
47 void draw(const Camera & camera, Texture* dstColor, Texture* dstDepth, uint layer = 0) override;
48
51 void resize(uint width, uint height) override;
52
54 void interface() override;
55
58
59private:
60
67 void renderDepth(const Culler::List & visibles, const glm::mat4 & view, const glm::mat4 & proj);
68
74 void renderOpaque(const Culler::List & visibles, const glm::mat4 & view, const glm::mat4 & proj);
75
81 void renderTransparent(const Culler::List & visibles, const glm::mat4 & view, const glm::mat4 & proj);
82
88 void renderBackground(const glm::mat4 & view, const glm::mat4 & proj, const glm::vec3 & pos);
89
92 std::unique_ptr<SSAO> _ssaoPass;
93 std::unique_ptr<ForwardLight> _lightsGPU;
94 std::unique_ptr<ForwardProbe> _probesGPU;
95
107
111
113
114 std::shared_ptr<Scene> _scene;
115 std::unique_ptr<Culler> _culler;
116
117 bool _applySSAO = true;
118
119
120};
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
A renderer that shade each object as it is drawn in the scene directly.
Definition: ForwardRenderer.hpp:31
std::unique_ptr< ForwardLight > _lightsGPU
The lights renderer.
Definition: ForwardRenderer.hpp:93
Texture _sceneColor
Scene color texture.
Definition: ForwardRenderer.hpp:90
void draw(const Camera &camera, Texture *dstColor, Texture *dstDepth, uint layer=0) override
Definition: ForwardRenderer.cpp:327
void interface() override
Definition: ForwardRenderer.cpp:410
void renderTransparent(const Culler::List &visibles, const glm::mat4 &view, const glm::mat4 &proj)
Definition: ForwardRenderer.cpp:197
Program * _skyboxProgram
Skybox program.
Definition: ForwardRenderer.hpp:108
std::unique_ptr< Culler > _culler
Objects culler.
Definition: ForwardRenderer.hpp:115
bool _applySSAO
Screen space ambient occlusion.
Definition: ForwardRenderer.hpp:117
Texture & sceneDepth()
Definition: ForwardRenderer.cpp:423
Program * _atmoProgram
Atmospheric scattering program.
Definition: ForwardRenderer.hpp:110
std::unique_ptr< ForwardProbe > _probesGPU
The probes renderer.
Definition: ForwardRenderer.hpp:94
void resize(uint width, uint height) override
Definition: ForwardRenderer.cpp:403
Texture _sceneDepth
Scene depth texture.
Definition: ForwardRenderer.hpp:91
Program * _subsurfaceProgram
PBR with subsurface scattering.
Definition: ForwardRenderer.hpp:105
Program * _bgProgram
Planar background program.
Definition: ForwardRenderer.hpp:109
std::shared_ptr< Scene > _scene
The scene to render.
Definition: ForwardRenderer.hpp:114
Program * _transpIridProgram
Transparent PBR with iridescent Fresnel.
Definition: ForwardRenderer.hpp:100
Program * _clearCoatProgram
Basic PBR program with an additional clear coat specular layer.
Definition: ForwardRenderer.hpp:101
void renderOpaque(const Culler::List &visibles, const glm::mat4 &view, const glm::mat4 &proj)
Definition: ForwardRenderer.cpp:103
Program * _objectProgram
Basic PBR program.
Definition: ForwardRenderer.hpp:96
const Texture * _textureBrdf
The BRDF lookup table.
Definition: ForwardRenderer.hpp:112
Program * _parallaxProgram
Parallax mapping PBR program.
Definition: ForwardRenderer.hpp:97
Program * _sheenProgram
PBR with sheen BRDF.
Definition: ForwardRenderer.hpp:103
void renderBackground(const glm::mat4 &view, const glm::mat4 &proj, const glm::vec3 &pos)
Definition: ForwardRenderer.cpp:275
Program * _depthPrepass
Depth prepass program.
Definition: ForwardRenderer.hpp:106
void renderDepth(const Culler::List &visibles, const glm::mat4 &view, const glm::mat4 &proj)
Definition: ForwardRenderer.cpp:50
std::unique_ptr< SSAO > _ssaoPass
SSAO processing.
Definition: ForwardRenderer.hpp:92
Program * _iridescentProgram
PBR with iridescent Fresnel.
Definition: ForwardRenderer.hpp:104
void setScene(const std::shared_ptr< Scene > &scene)
Definition: ForwardRenderer.cpp:39
Program * _emissiveProgram
Parallax mapping PBR program.
Definition: ForwardRenderer.hpp:98
Program * _transparentProgram
Transparent PBR program.
Definition: ForwardRenderer.hpp:99
Program * _anisotropicProgram
Basic PBR with anisotropic roughness.
Definition: ForwardRenderer.hpp:102
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