Skip to content

SceneRenderTree

Defined in: renderer/src/SceneRenderTree.ts:26

Scene-owned render tree. Created by SceneRenderTreeProvider when a scene enters. Scoped DI: components resolve via this.use(SceneRenderTreeKey).

readonly defaultLayer: RenderLayer

Defined in: renderer/src/SceneRenderTree.ts:38

The auto-created “default” layer (order 0).


readonly fx: EffectsHost

Defined in: renderer/src/SceneRenderTree.ts:57

Scene-scope effects host — .fx.addEffect(...) attaches a filter to the entire per-scene root container, after layer-scope effects have composited. Common use: scene-wide CRT, color grade, vignette. Survives until the scene exits or the handle is .remove()d.

.fx.findEffect(definition) finds an attached effect when the caller no longer has its original handle.


readonly root: DisplayContainer

Defined in: renderer/src/SceneRenderTree.ts:30

The single root container for the scene. Lives under the renderer’s world-root container (which sits under app.stage and holds the fit transform).

addLayerEffect<H>(factory, layers): H

Defined in: renderer/src/SceneRenderTree.ts:78

Attach one effect to several layers and control it through one handle. The factory is called once per layer, so this is one filter pass per listed layer: N fullscreen layers cost N fullscreen passes per frame. For a single layer prefer tree.get(name).fx.addEffect(...).

Handle methods fan out to every layer; values (enabled, return values of extras such as trigger) come from the first listed layer. Layers with different camera bindings receive the same layer-local arguments. Throws when layers is empty or names a layer the scene does not have.

const grade = tree.addLayerEffect(colorGrade({ preset: "night" }), [
"background",
"world",
"props",
]);
grade.fadeOut(1); // fades on all three

H extends EffectHandle

EffectFactory<H>

readonly string[]

H


clearMask(): void

Defined in: renderer/src/SceneRenderTree.ts:88

Detach and destroy the scene-scope mask, if any.

void


ensureLayer(def, opts?): RenderLayer

Defined in: renderer/src/SceneRenderTree.ts:47

Get an existing layer or create it from the given definition. Used by plugins like UI that auto-provision a layer if the game didn’t declare one explicitly. Pass { space: "screen" } so a default camera leaves the layer fixed to the viewport (e.g. screen-space HUD). Existing layers keep their settings. A differing requested order warns in development once per tree, layer name, and expected order.

LayerDef

EnsureLayerOptions

RenderLayer


get(name): RenderLayer

Defined in: renderer/src/SceneRenderTree.ts:32

Get a layer by name. Throws if not found.

string

RenderLayer


getAll(): readonly RenderLayer[]

Defined in: renderer/src/SceneRenderTree.ts:36

All layers, sorted by draw order.

readonly RenderLayer[]


renderAboveEffects(node): void

Defined in: renderer/src/SceneRenderTree.ts:100

Draw node after this scene’s layers, outside every layer- and scene-scope effect and mask, while it keeps its logical parent (position, alpha, visibility, camera). Screen-scope effects still cover it. Draw order among nodes attached this way is attach order. node must be in this scene’s tree.

Visual components expose the same thing as VisualComponentOptions.renderAboveEffects; use this for a display object the game parents into the tree itself.

DisplayContainer

void


renderWithEffects(node): void

Defined in: renderer/src/SceneRenderTree.ts:102

Undo renderAboveEffects. No-op when node is not attached.

DisplayContainer

void


setMask(factory): MaskHandle

Defined in: renderer/src/SceneRenderTree.ts:86

Attach a scene-scope mask, replacing any existing one. Clips the entire per-scene root. Torn down on scene exit.

MaskFactory

MaskHandle


tryGet(name): RenderLayer | undefined

Defined in: renderer/src/SceneRenderTree.ts:34

Get a layer by name, or undefined if not found.

string

RenderLayer | undefined

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/renderer.md.