Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
LightPlan.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
15#pragma once
16
17#include "../../core/Types.hpp"
18#include "../../math/Math.hpp"
19
20#include <vector>
21
22namespace esengine {
23
32
34inline const char* lightRefusalName(LightRefusal why) {
35 switch (why) {
36 case LightRefusal::Capacity: return "light capacity";
37 case LightRefusal::NoEnvironmentSun: return "no environment sun";
38 case LightRefusal::None: break;
39 }
40 return "none";
41}
42
55
66 std::vector<LightGrant> refused;
70 bool environmentSun = false;
71 glm::vec3 environmentSunAim{0.0f};
72
73 void clear() {
74 requested = 0;
75 accepted = 0;
76 refused.clear();
77 environmentSun = false;
78 environmentSunAim = glm::vec3(0.0f);
79 }
80
83 for (const LightGrant& g : refused) {
84 if (g.light.raw == entity.raw) return g.refusal;
85 }
86 return LightRefusal::None;
87 }
88};
89
90} // namespace esengine
Math utilities and GLM configuration for ESEngine.
Core type definitions and utilities for ESEngine.
LightRefusal
Why a light did not reach the frame.
Definition LightPlan.hpp:25
@ Capacity
More lights in view than the shader's arrays hold; the dimmest gave way.
Definition LightPlan.hpp:28
@ NoEnvironmentSun
Follows the environment's sun, and the frame's environment has none.
Definition LightPlan.hpp:30
std::uint32_t u32
Unsigned 32-bit integer.
Definition Types.hpp:45
const char * lightRefusalName(LightRefusal why)
The refusal as a word, for a log line and for a reader.
Definition LightPlan.hpp:34
std::uint8_t u8
Unsigned 8-bit integer.
Definition Types.hpp:41
float f32
32-bit floating point
Definition Types.hpp:59
Entity identifier with packed index + generation.
Definition Types.hpp:135
What the frame's light cap came to.
Definition LightPlan.hpp:57
LightRefusal refusalFor(Entity entity) const
What entity was told, or None when it was not refused.
Definition LightPlan.hpp:82
u32 requested
Lights that asked. Equal to accepted when nothing was turned away.
Definition LightPlan.hpp:61
std::vector< LightGrant > refused
Definition LightPlan.hpp:66
u32 limit
The shader's array bound — what accepted can never exceed.
Definition LightPlan.hpp:59
One light that asked to be in the frame, and what it was told.
Definition LightPlan.hpp:44
LightRefusal refusal
Definition LightPlan.hpp:53