16 :
light(
light),
camera(
camera),
face(
face),
shadowViewport(0, 0, 1, 1),
shadowScissor(0, 0, 1, 1) {
21 : _device(graphicsDevice), _clusteredLighting(clusteredLighting)
50 value = std::clamp(value, 1, 4);
51 if (_numCascades == value) {
61 static const std::array<std::array<Vector4, 4>, 4> layouts = {{
62 {{
Vector4(0,0,1,1),
Vector4(0,0,0,0),
Vector4(0,0,0,0),
Vector4(0,0,0,0) }},
63 {{
Vector4(0,0,0.5f,0.5f),
Vector4(0,0.5f,0.5f,0.5f),
Vector4(0,0,0,0),
Vector4(0,0,0,0) }},
64 {{
Vector4(0,0,0.5f,0.5f),
Vector4(0,0.5f,0.5f,0.5f),
Vector4(0.5f,0,0.5f,0.5f),
Vector4(0,0,0,0) }},
65 {{
Vector4(0,0,0.5f,0.5f),
Vector4(0,0.5f,0.5f,0.5f),
Vector4(0.5f,0,0.5f,0.5f),
Vector4(0.5f,0.5f,0.5f,0.5f) }}
67 _cascadeViewports = layouts[value - 1];
70 _shadowMatrixPalette.fill(0.0f);
71 _shadowCascadeDistances.fill(0.0f);
80 for (
auto* rd : _renderData) {
81 if (rd->camera == camera && rd->face == face) {
88 _renderData.push_back(rd);
Perspective or orthographic camera with projection matrix, jitter (TAA), and render target binding.
Abstract GPU interface for resource creation, state management, and draw submission.
Directional, point, spot, or area light with shadow mapping and cookie projection.
void setNumCascades(int value)
int numShadowFaces() const
LightRenderData * getRenderData(Camera *camera, int face)
Light(GraphicsDevice *graphicsDevice, bool clusteredLighting)
Per-face shadow rendering data: shadow camera, viewport, and scissor.
LightRenderData(Camera *camera, int face, Light *light)
static Camera * createShadowCamera(ShadowType shadowType, LightType type, int face)
4D vector for homogeneous coordinates, color values, and SIMD operations.