Vixen
02b45cc4
csharp
public sealed class CameraExtractionSystem

Turns the scene's Camera entity into the frame's RenderView.

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

As a system

Phase
PreRender

Remarks

The last unwired half of "a world is drawn". Camera was a component a scene could place, CameraMath built the two matrices it implies, and RenderView was what every pass culls and draws against — and nothing anywhere read the first and wrote the last. A level with a camera in it rendered from wherever the host had last poked the view by hand, which is why every sample steers its own.

One view, not one per camera. The view is handed in rather than created here, because a view's name is what a compositor document binds a node to (view: Camera) and its stage mask is the host's — a document with two cameras in it is a document with two named views, and two of these. What this decides is only which entity fills the one it was given.

Lowest Order wins, ties going to the first the world walks. That is Order's documented meaning — "which camera renders first" — read as a priority, and it is the same rule the editor's scene list sorts by. A scene with no camera at all leaves the view exactly as it was and says so through Found: a frame drawn from a stale matrix is a picture, and a frame drawn from a zeroed one is a black screen that looks like the renderer is broken.

In PreRender, ordered by its declared access — the placement LightExtractionSystem explains: TransformSystem writes WorldTransform in the same phase and this reads it, so a camera moved this frame is rendered from where it now is rather than from where it was.

Fields and properties (6)

  • public Camera Chosen

    The camera extracted last, or a zeroed one when there was none.

  • public RenderView View

    The view this fills.

  • public float AspectRatio

    Width over height of what is being rendered into, for a camera whose own is zero.

  • public bool Found

    Whether the last pass found a camera to render from.

  • public int CameraCount

    How many cameras the last pass saw, of which one was used.

  • public SystemAccess Access

Methods (3)

  • public CameraExtractionSystem(RenderView view)

    Turns the scene's Camera entity into the frame's RenderView.

  • public override JobHandle Update(in SystemContext context, JobHandle dependency)

    Runs the system.

  • public void Extract(World world)

    Points the view at the scene's camera.

Used by (3)

  • AppGraphicsVixen.App.Hosting
  • CameraExtractionTestsVixen.Rendering.Tests
  • HostedRendererTestsVixen.App.Tests