blob: f774ac7ca1854540322cf46ace951760181aa46a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#pragma once
#include "gfx/gl/program.h"
#include "gfx/models/mesh.h"
#include "gfx/models/texture.h"
#include "glArrays.h"
class LightDirection;
class ShadowStenciller {
public:
template<typename T> static constexpr T STENCIL_ANGLES = 8;
ShadowStenciller();
[[nodiscard]]
static glTexture createStencilTexture(GLsizei width, GLsizei height);
void setLightDirection(const LightDirection & lightDir);
void renderStencil(const glTexture &, const MeshBase &, Texture::AnyPtr texture) const;
private:
glFrameBuffer fbo;
Program shadowCaster;
Program::RequiredUniformLocation viewProjectionLoc {shadowCaster, "viewProjection"};
std::array<glm::mat4, STENCIL_ANGLES<size_t>> viewProjections;
};
|