Vixen
02b45cc4
csharp
public sealed class LightExtractionSystem

Turns the scene's Light entities into the lighting feature's frame list.

No guide page documents this yet — the page shows what the code says about itself.

As a system

Phase
PreRender

Remarks

The bridge, and it is a copy rather than a translation. Light holds what a light is and RenderLight holds what the shader needs — the same fields, plus the position and the basis folded in from the transform. That the two line up is deliberate: a bridge that had to reinterpret values would be a place for the authored meaning and the rendered one to drift apart.

Rebuilt every frame rather than mirrored. A light has no handle to keep, so there is nothing to reconcile: the list is cleared and refilled, which costs a walk over the handful of entities that emit light and removes the entire class of bug where a destroyed entity leaves a light burning. That is the opposite trade from PhysicsBody, where the handle is expensive to create and is therefore kept — and the difference is exactly that a body is state and a light is not.

In PreRender, ordered by its declared access. TransformSystem writes WorldTransform in the same phase and this reads it, so the dependency graph puts this second — which is what makes a light's position this frame's rather than last frame's. Naming the phase alone would not have been enough.

⚠ The transform supplies position and orientation, and the component supplies neither. A directional light has no position and reads only its forward axis; a point light has no orientation and reads only its position; the two area kinds need a whole basis. Every one of them takes it from WorldTransform, so a light is aimed with the rotate gizmo and a scene file cannot say two different things about where one points.

Fields and properties (2)

  • public int LightCount

    How many lights the last pass put in the list.

  • public SystemAccess Access

Methods (4)

Used by (2)

  • LightExtractionTestsVixen.Rendering.Tests
  • WorldRendererVixen.Engine.Renderer