Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
LightComponent.h File Reference

Tags a GameObject as a point light source in the scene. More...

#include "scene/Component.h"
+ Include dependency graph for LightComponent.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mnd::LightComponent
 Point light that contributes position + colour to the render pass. More...
 

Namespaces

namespace  mnd
 

Detailed Description

Tags a GameObject as a point light source in the scene.

When a GameObject has a LightComponent, Scene::CollectLight() picks it up during the per-frame traversal and adds a LightData entry (world position

  • RGB colour) to the list forwarded to RenderQueue::Draw(). The queue then uploads the light data as uniforms to every material that is drawn.

Usage

auto *lightObj = scene->CreateObject("SunLight");
lightObj->SetPosition(vec3(10, 20, 5));
auto *light = new LightComponent();
light->SetColor(vec3(1.0f, 0.95f, 0.8f)); // warm white
lightObj->AddComponent(light);
Note
Only the owner's world position is used — there is no direction, radius, or attenuation yet (point light model).
See also
LightData, Scene::CollectLight, RenderQueue::Draw

Definition in file LightComponent.h.