SpotLightComponent struct in Thread

A cone (spot) light. Position and direction come from the entity's TransformComponent — translate/rotate the entity to aim it. Intensity falls off inside the cone between the inner and outer angles.

Properties

ColorVec3Light colour (linear RGB).
IntensityfloatBrightness multiplier.
RangefloatMaximum reach in world units.
InnerAnglefloatDegrees — full intensity inside this cone.
OuterAnglefloatDegrees — falls to zero by this edge (soft cone rim).
EnabledboolMaster switch.

Shadows

The scene shadows the first shadow-casting spot light using a single perspective depth map from the spot's point of view.

CastShadowsboolEnable the perspective shadow map (default off).
ShadowBiasfloatDepth bias to fight shadow acne.
ShadowSoftnessfloatPenumbra radius in shadow-map texels (0 = hard).

Example

auto e = scene.CreateEntity("Flashlight");
auto& t = e.GetComponent<Thread::TransformComponent>();
t.Translation = { 0, 3, 0 };
t.Rotation    = { -1.2f, 0, 0 };   // aim downward (radians)

auto& s = e.AddComponent<Thread::SpotLightComponent>();
s.Range       = 20.0f;
s.InnerAngle  = 15.0f;
s.OuterAngle  = 28.0f;
s.CastShadows = true;

See also DirectionalLightComponent, PointLightComponent, and the Render Pipeline shadows section.

SpotLightComponent struct w Thread

Światło stożkowe (reflektor). Pozycja i kierunek pochodzą z TransformComponent encji — przesuń/obróć encję, żeby je wycelować. Jasność opada wewnątrz stożka między kątem wewnętrznym a zewnętrznym.

Właściwości

ColorVec3Kolor światła (liniowe RGB).
IntensityfloatMnożnik jasności.
RangefloatMaksymalny zasięg w jednostkach świata.
InnerAnglefloatStopnie — pełna jasność wewnątrz tego stożka.
OuterAnglefloatStopnie — spada do zera na tej krawędzi (miękki brzeg stożka).
EnabledboolGłówny przełącznik.

Cienie

Scena cieniuje pierwsze rzucające cień światło stożkowe jedną perspektywiczną mapą głębi widzianą z jego punktu.

CastShadowsboolWłącza perspektywiczną mapę cieni (domyślnie wyłączona).
ShadowBiasfloatPrzesunięcie głębi przeciw „shadow acne”.
ShadowSoftnessfloatPromień półcienia w tekselach mapy cieni (0 = ostry).

Przykład

auto e = scene.CreateEntity("Flashlight");
auto& t = e.GetComponent<Thread::TransformComponent>();
t.Translation = { 0, 3, 0 };
t.Rotation    = { -1.2f, 0, 0 };   // skierowane w dół (radiany)

auto& s = e.AddComponent<Thread::SpotLightComponent>();
s.Range       = 20.0f;
s.InnerAngle  = 15.0f;
s.OuterAngle  = 28.0f;
s.CastShadows = true;

Zobacz też DirectionalLightComponent, PointLightComponent oraz sekcję cieni w Potoku renderowania.