Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
DeferredLight.hpp
1#pragma once
2
3#include "scene/Scene.hpp"
4
5#include "renderers/LightRenderer.hpp"
6#include "renderers/shadowmaps/ShadowMap.hpp"
7#include "scene/lights/Light.hpp"
8#include "scene/lights/PointLight.hpp"
9#include "scene/lights/DirectionalLight.hpp"
10#include "scene/lights/SpotLight.hpp"
11
12#include "Common.hpp"
13
14
20class DeferredLight final : public LightRenderer {
21
22public:
29 explicit DeferredLight(const Texture * texAlbedo, const Texture * texNormals, const Texture * texDepth, const Texture * texEffects);
30
35 void updateCameraInfos(const glm::mat4 & viewMatrix, const glm::mat4 & projMatrix);
36
40 void draw(const SpotLight * light) override;
41
45 void draw(const PointLight * light) override;
46
50 void draw(const DirectionalLight * light) override;
51
52private:
53
54 std::vector<const Texture *> _textures;
55 const Mesh * _sphere;
56 const Mesh * _cone;
57
61
62 glm::mat4 _view = glm::mat4(1.0f);
63 glm::mat4 _proj = glm::mat4(1.0f);
64
65};
66
67
74
75public:
76
84 explicit DeferredProbe(const Texture * texAlbedo, const Texture * texNormals, const Texture * texEffects, const Texture * texDepth, const Texture * texSSAO);
85
90 void updateCameraInfos(const glm::mat4 & viewMatrix, const glm::mat4 & projMatrix);
91
95 void draw(const LightProbe & probe);
96
97private:
98
99 std::vector<const Texture *> _textures;
100 const Mesh * _box;
102
103 glm::mat4 _viewProj = glm::mat4(1.0f);
104 glm::mat4 _invView = glm::mat4(1.0f);
105 glm::vec4 _projectionVector = glm::vec4(0.0f);
106};
Apply a light onto the lighting buffer using a geometric proxy (cone, sphere, screenquad)....
Definition: DeferredLight.hpp:20
const Mesh * _sphere
Point light supporting geometry.
Definition: DeferredLight.hpp:55
std::vector< const Texture * > _textures
G-buffer input textures.
Definition: DeferredLight.hpp:54
Program * _pointProgram
Point light shader.
Definition: DeferredLight.hpp:59
Program * _dirProgram
Directional light shader.
Definition: DeferredLight.hpp:58
glm::mat4 _view
Cached camera view matrix.
Definition: DeferredLight.hpp:62
const Mesh * _cone
Spot light supporting geometry.
Definition: DeferredLight.hpp:56
glm::mat4 _proj
Cached camera projection matrix.
Definition: DeferredLight.hpp:63
void draw(const SpotLight *light) override
Definition: DeferredLight.cpp:20
Program * _spotProgram
Spot light shader.
Definition: DeferredLight.hpp:60
void updateCameraInfos(const glm::mat4 &viewMatrix, const glm::mat4 &projMatrix)
Definition: DeferredLight.cpp:15
Apply a probe onto the lighting buffer by rendering a box. The probe contribution weight is accumulat...
Definition: DeferredLight.hpp:73
glm::vec4 _projectionVector
Cached camera projection parameters.
Definition: DeferredLight.hpp:105
void updateCameraInfos(const glm::mat4 &viewMatrix, const glm::mat4 &projMatrix)
Definition: DeferredLight.cpp:148
std::vector< const Texture * > _textures
G-buffer input textures.
Definition: DeferredLight.hpp:99
void draw(const LightProbe &probe)
Definition: DeferredLight.cpp:155
glm::mat4 _invView
Cached camera inverse view matrix.
Definition: DeferredLight.hpp:104
const Mesh * _box
Probe supporting geometry.
Definition: DeferredLight.hpp:100
Program * _program
Probe application shader.
Definition: DeferredLight.hpp:101
glm::mat4 _viewProj
Cached camera view projection matrix.
Definition: DeferredLight.hpp:103
A directional light, where all light rays have the same direction.
Definition: DirectionalLight.hpp:13
Store environment lighting for reflections.
Definition: LightProbe.hpp:12
Base structure of a per-light specialized renderer.
Definition: LightRenderer.hpp:13
Represents a geometric mesh composed of vertices, other attributes and triangles.
Definition: Mesh.hpp:15
An omnidirectional punctual light, where light is radiating in all directions from a single point in ...
Definition: PointLight.hpp:15
Represents a group of shaders used for rendering.
Definition: Program.hpp:31
A spotlight, where light rays in a given cone are radiating from a single point in space....
Definition: SpotLight.hpp:13
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12