SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
DirectionalLight.cpp
Go to the documentation of this file.
3
4namespace Sleak {
5
6DirectionalLight::DirectionalLight(const std::string& name)
7 : Light(name) {}
8
11
12 // Directional lights have no position
13 entry.PositionX = 0.0f;
14 entry.PositionY = 0.0f;
15 entry.PositionZ = 0.0f;
16 entry.Type = 0; // Directional
17
18 entry.DirectionX = m_direction.GetX();
19 entry.DirectionY = m_direction.GetY();
20 entry.DirectionZ = m_direction.GetZ();
21 entry.Intensity = m_intensity;
22
23 entry.ColorR = m_color.GetX();
24 entry.ColorG = m_color.GetY();
25 entry.ColorB = m_color.GetZ();
26 entry.Range = 0.0f; // Not used for directional
27
28 entry.SpotInnerCos = 0.0f;
29 entry.SpotOuterCos = 0.0f;
30 entry.AreaWidth = 0.0f;
31 entry.AreaHeight = 0.0f;
32
33 return entry;
34}
35
36} // namespace Sleak
RenderEngine::LightGPUEntry BuildGPUData() const override
Packs this light's parameters into the GPU-side entry used by the lighting constant buffer.
DirectionalLight(const std::string &name="DirectionalLight")
Math::Vector3D m_color
Definition Light.hpp:57
Light(const std::string &name="Light")
Definition Light.cpp:5
float m_intensity
Definition Light.hpp:58
Root namespace for everything the engine exposes.
Definition Camera.hpp:10
One light's packed GPU representation, laid out for std140/cbuffer alignment.