Skip to main content

Function: createPresentEcsSystem()

createPresentEcsSystem(renderContext): EcsSystem<[CameraEcsComponent], null, PresentCommand | null>

Defined in: rendering/systems/present-system.ts:39

Creates a system that presents each distinct off-screen render target in use by a camera onto the canvas, by drawing the target's color texture with a full-screen quad. Cameras without a renderTarget are left untouched, since they already render directly onto the canvas. Cameras that share the same renderTarget (for example a background and foreground camera composited into one scene) only present it once per frame.

Multiple different render targets presented in the same frame (for example a blurred background target and a separate, sharp foreground target) are layered onto the canvas in ascending CameraEcsComponent.layer order: the lowest layer clears the canvas and replaces it outright, and every subsequent (higher) layer alpha-blends on top instead, so later layers don't erase earlier ones.

run only gathers each camera's renderTarget and layer; afterRun dedupes and sorts them once every camera has run, then does the actual presenting, since the draw order depends on every camera's layer and can only be resolved once the whole tick's cameras are known.

Parameters

renderContext

RenderContext

The rendering context

Returns

EcsSystem<[CameraEcsComponent], null, PresentCommand | null>

The present ECS system