Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Light Component


This EntityComponent is a wrapper around a light.

Programming in C++


#include <components/light.h>
API documentation page.

It's very simple, just pick the position of the light and its color. If you want to increase the brightness of the light, multiply the

Component<LightComponent> component;

const float brightness = 2.0f;
const vec3 color = {0.38f, 0.25f, 0.31f};

component.make();
component->SetLocation({0.0f, 0.0f, 0.0f});
component->SetColor(brightness * color);
component->Init();

If you want to turn the light from a point light into a spotlight, you can set its direction and exponent. The direction is a direction normal vector. The exponent starts at 1.0 and increasing it narrows the spotlight's width.

component->SetDirection(DIRECTION_FORWARD);
component->SetExponent(16.0f);


Scripting in Lua


Still working on it...