Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
ShadowMap.hpp
1#pragma once
2
3#include "processing/BoxBlur.hpp"
4#include "resources/Texture.hpp"
5
6#include "Common.hpp"
7
8class Scene;
9
14enum class ShadowMode : int {
15 NONE = 0,
16 BASIC = 1,
17 PCF = 2,
18 VARIANCE = 3
19};
20
25class ShadowMap {
26public:
28 ShadowMap() = default;
29
33 virtual void draw(const Scene & scene) = 0;
34
36 virtual ~ShadowMap() = default;
37
39 ShadowMap(const ShadowMap &) = delete;
40
44 ShadowMap & operator=(const ShadowMap &) = delete;
45
47 ShadowMap(ShadowMap &&) = default;
48
53
55 struct Region {
56 const Texture * map = nullptr;
57 ShadowMode mode = ShadowMode::NONE;
58 glm::vec2 minUV = glm::vec2(0.0f);
59 glm::vec2 maxUV = glm::vec2(0.0f);
60 size_t layer = 0;
61 float bias = 0.002f;
62 };
63
64};
Represents a 3D environment composed of objects, a background and additional environment lighting inf...
Definition: Scene.hpp:18
Store shadowing information as a map generated from the light viewpoint.
Definition: ShadowMap.hpp:25
virtual void draw(const Scene &scene)=0
ShadowMap(ShadowMap &&)=default
ShadowMap & operator=(const ShadowMap &)=delete
virtual ~ShadowMap()=default
ShadowMap & operator=(ShadowMap &&)=delete
ShadowMap()=default
ShadowMap(const ShadowMap &)=delete
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
ShadowMode
Available shadow mapping techniques.
Definition: ShadowMap.hpp:14
@ PCF
Basic depth test mode.
@ NONE
No shadows.
@ VARIANCE
Variance shadow map.
@ BASIC
Basic depth test mode.
Definition: ShadowMap.hpp:55
size_t layer
The layer containing the shadow map.
Definition: ShadowMap.hpp:60
const Texture * map
The texture reference.
Definition: ShadowMap.hpp:56
glm::vec2 minUV
The bottom-left corner of the texture region.
Definition: ShadowMap.hpp:58
glm::vec2 maxUV
The upper-right corner of the texture region.
Definition: ShadowMap.hpp:59
float bias
The depth bias to use.
Definition: ShadowMap.hpp:61
ShadowMode mode
The shadow mode to use.
Definition: ShadowMap.hpp:57