Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
LightComponent.cpp
Go to the documentation of this file.
1#include "scene/components/LightComponent.h"
2
3namespace mnd
4{
5void LightComponent::Update(f32 deltaTime) {}
6
7void LightComponent::SetColor(const vec3 &color)
8{
9 m_color = color;
10}
11
12void LightComponent::LoadProperties(const nlohmann::json &json)
13{
14 if (json.contains("color"))
15 {
16 auto c = json["color"];
17 glm::vec3 color(c.value("r", 1.0f), c.value("g", 1.0f), c.value("b", 1.0f));
18 SetColor(color);
19 }
20}
21
23{
24 return m_color;
25}
26
27} // namespace mnd
void LoadProperties(const nlohmann::json &json) override
void SetColor(const vec3 &color)
Set the light's emission colour.
void Update(f32 deltaTime) override
No per-frame computation needed; position is queried from owner on demand.
const vec3 & GetColor() const
Returns the linear RGB colour of this light (default: white {1,1,1}).
glm::vec3 vec3
3-component float vector (e.g. world position, RGB colour, normals).
Definition Types.h:51
float f32
32-bit IEEE float — the standard GL scalar type.
Definition Types.h:40