|
SleakEngine 1.0.0
C++23 multi-backend game engine
|
#include <LightManager.hpp>
Public Member Functions | |
| LightManager () | |
| ~LightManager () | |
| float | GetAmbientIntensity () const |
| float | GetFogEnd () const |
| float | GetFogStart () const |
| float | GetHeightFogDensity () const |
| float | GetHeightFogFalloff () const |
| float | GetHeightFogTop () const |
| size_t | GetLightCount () const |
| void | Initialize () |
| Allocates the GPU light buffer; call once before the first UpdateAndBind. | |
| bool | IsFogEnabled () const |
| bool | IsHeightFogEnabled () const |
| void | RegisterLight (Light *light) |
| void | SetAmbientColor (float r, float g, float b) |
| void | SetAmbientIntensity (float intensity) |
| void | SetFogColor (float r, float g, float b) |
| void | SetFogDistances (float start, float end) |
| void | SetFogEnabled (bool enabled) |
| void | SetFogZenithColor (float r, float g, float b) |
| void | SetHeightFogDensity (float d) |
| void | SetHeightFogEnabled (bool enabled) |
| void | SetHeightFogFalloff (float f) |
| void | SetHeightFogTop (float worldY) |
| void | UnregisterLight (Light *light) |
| void | UpdateAndBind () |
| Packs every registered light and the fog/ambient parameters into the light buffer and binds it. | |
| void | UpdateDeferredCB () |
| Refreshes the deferred-pass constant buffer (fog, ambient) independent of the per-light data. | |
| void | UpdateShadowData () |
| Picks the active shadow-casting light and refreshes its shadow-space matrices. | |
Owns the registered light list and the GPU-side light/fog constant buffers; one instance per scene.
Each Scene owns one, reachable through SceneBase::GetLightManager(). Lights register themselves when their GameObject is added to the scene, so you almost never call RegisterLight() directly. What you do use it for is the scene-wide atmosphere that is not attached to any single light: ambient color and intensity, distance fog, and height fog.
Ambient light is the floor value that keeps shadow-side surfaces from going flat black. Tinting it toward the sky color, then keeping the intensity low, reads as sky bounce without washing out the directional lights doing the real work.
Fog has two layers that stack. Distance fog blends between a horizon color and a zenith color as the view tilts upward, fading in between the start and end distances. Height fog adds exponential density below a world height, which is what grounds figures on a floor plane and pools haze in valleys.
Definition at line 57 of file LightManager.hpp.
|
default |
|
default |
|
inline |
Definition at line 80 of file LightManager.hpp.
|
inline |
Definition at line 97 of file LightManager.hpp.
|
inline |
Definition at line 96 of file LightManager.hpp.
|
inline |
Definition at line 114 of file LightManager.hpp.
|
inline |
Definition at line 115 of file LightManager.hpp.
|
inline |
Definition at line 113 of file LightManager.hpp.
|
inline |
Definition at line 84 of file LightManager.hpp.
| void Sleak::LightManager::Initialize | ( | ) |
Allocates the GPU light buffer; call once before the first UpdateAndBind.
Definition at line 62 of file LightManager.cpp.
|
inline |
Definition at line 95 of file LightManager.hpp.
|
inline |
Definition at line 112 of file LightManager.hpp.
| void Sleak::LightManager::RegisterLight | ( | Light * | light | ) |
Definition at line 73 of file LightManager.cpp.
| void Sleak::LightManager::SetAmbientColor | ( | float | r, |
| float | g, | ||
| float | b ) |
Definition at line 428 of file LightManager.cpp.
|
inline |
Definition at line 76 of file LightManager.hpp.
|
inline |
Definition at line 88 of file LightManager.hpp.
|
inline |
Definition at line 91 of file LightManager.hpp.
|
inline |
Definition at line 94 of file LightManager.hpp.
|
inline |
Two-color sky-matched fog gradient. SetFogColor(r,g,b) above sets the horizon color; the zenith color blends in as the view direction tilts upward.
Definition at line 102 of file LightManager.hpp.
|
inline |
Definition at line 110 of file LightManager.hpp.
|
inline |
Height fog: exponential density that thickens below HeightFogTop. density(y) = HeightFogDensity * exp(-max(0, y - HeightFogTop) * HeightFogFalloff)
Definition at line 108 of file LightManager.hpp.
|
inline |
Definition at line 111 of file LightManager.hpp.
|
inline |
Definition at line 109 of file LightManager.hpp.
| void Sleak::LightManager::UnregisterLight | ( | Light * | light | ) |
Definition at line 88 of file LightManager.cpp.
| void Sleak::LightManager::UpdateAndBind | ( | ) |
Packs every registered light and the fog/ambient parameters into the light buffer and binds it.
Definition at line 96 of file LightManager.cpp.
| void Sleak::LightManager::UpdateDeferredCB | ( | ) |
Refreshes the deferred-pass constant buffer (fog, ambient) independent of the per-light data.
Definition at line 434 of file LightManager.cpp.
| void Sleak::LightManager::UpdateShadowData | ( | ) |
Picks the active shadow-casting light and refreshes its shadow-space matrices.
Definition at line 164 of file LightManager.cpp.