API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classRenderTarget

@codexo/exojs / rendering / stable

Renderable destination - either the on-screen canvas (the `root` target owned by the backend) or an offscreen texture (a RenderTexture). Owns a default View that controls the camera transform and viewport, and emits a destroy event so backends can release backing GPU resources. Set `view` to swap cameras for this target; call `resize(w, h)` when the underlying canvas / texture dimensions change. An assigned view is caller-owned: swapping it out or destroying the target leaves it alive, so destroy the views you create yourself.

9
props
12
methods
0
events
Import
import { RenderTarget } from '@codexo/exojs'

Renderable destination - either the on-screen canvas (the `root` target owned by the backend) or an offscreen texture (a RenderTexture). Owns a default View that controls the camera transform and viewport, and emits a destroy event so backends can release backing GPU resources.

Set `view` to swap cameras for this target; call `resize(w, h)` when the underlying canvas / texture dimensions change. An assigned view is caller-owned: swapping it out or destroying the target leaves it alive, so destroy the views you create yourself.

Constructors1
new(width: number, height: number, root: boolean): RenderTarget
Methods12
_enableDepthTexture(): void
Give this target a sampleable depth attachment. Called once, from the constructor of a subclass whose options asked for one.
_syncDepthSize(): void
Keep the depth attachment at the target's size. A subclass that resizes through a path other than resize calls this itself - a depth attachment left at the old size makes the whole framebuffer incomplete.
_touch(): void
addDestroyListener(listener: () => void): this
Subscribe to the moment this target (or any subclass - including RenderTexture) is destroyed. Backends use this to release GPU-side resources (framebuffer + attached texture) tied to the target. Listeners fire exactly once.
destroy(): void
removeDestroyListener(listener: () => void): this
Remove a previously registered destroy listener. No-op if absent.
resize(width: number, height: number): this
Point this target at view, or back at its own default view when passed null. The view is caller-owned - neither this call nor destroy releases it.
updateViewport(): this
Properties9
needsStencil: boolean
Whether this target needs a stencil attachment for geometric stencil clipping (RenderNode.clip with a Geometry clipShape). Set by the WebGL2 backend when such a clip is rendered into an offscreen RenderTexture, so its framebuffer gets a depth/stencil renderbuffer; the WebGL2 on-screen root uses the default framebuffer's stencil (requested at context creation), so the flag only affects offscreen WebGL2 targets. The WebGPU backend does not consult this flag: it allocates a separate depth24plus-stencil8 attachment per clipped target (root included) on demand, sized to the colour attachment's physical pixels.
Sampleable depth attachment, or null on a target that did not opt in - the on-screen root target always answers null. Opting in ({ depth: true } on a RenderTexture or a MultiRenderTarget) buys a depth buffer that survives the pass and can be read back as a texture; a MeshMaterial with writesDepth fills it. Without the opt-in a depth-writing material still draws, it just writes depth nowhere.
destroyed: boolean
true once destroy has run. A destroyed target must not be rendered into - the backend throws rather than drawing into released GPU state.
height: number
root: boolean
version: number
width: number
Source