RenderPass<U>
ts
type RenderPass<U> = {
render: (opts?: { target?: RenderTarget | null; clear?: boolean }) => void;
target: RenderTarget | null;
setTarget: (target: RenderTarget | null) => void;
setSize: ({ width, height }: { width: number; height: number }) => void;
uniforms: U;
vertex: string;
fragment: string;
onUpdated: (callback: UpdatedCallback<U>) => void;
onBeforeRender: (callback: RenderCallback<U>) => void;
onAfterRender: (callback: RenderCallback<U>) => void;
onInit: (callback: (gl: WebGL2RenderingContext) => void) => void;
onResize: (callback: (width: number, height: number) => void) => void;
initialize: (gl: WebGL2RenderingContext) => void;
};A generic rendering pass that encapsulates shaders, uniforms, and attributes.
Type Parameters
U
U extends Uniforms = Record<string, never>
Properties
| Property | Type | Description |
|---|---|---|
render | (opts?: { target?: | RenderTarget | null; clear?: boolean; }) => void | Executes the render pass. |
target | | RenderTarget | null | The current render target for this pass. |
setTarget | (target: | RenderTarget | null) => void | Updates the current render target. |
setSize | ({ width, height }: { width: number; height: number; }) => void | Resizes the render target associated with this pass. |
uniforms | U | The reactive uniforms proxy for this pass. |
vertex | string | The vertex shader source. |
fragment | string | The fragment shader source. |
onUpdated | (callback: UpdatedCallback<U>) => void | Registers a callback called whenever uniforms are updated. |
onBeforeRender | (callback: RenderCallback<U>) => void | Registers a callback called just before rendering. |
onAfterRender | (callback: RenderCallback<U>) => void | Registers a callback called just after rendering. |
onInit | (callback: (gl: WebGL2RenderingContext) => void) => void | Registers a callback called when the pass is initialized with a GL context. |
onResize | (callback: (width: number, height: number) => void) => void | Registers a callback called when the pass is resized. |
initialize | (gl: WebGL2RenderingContext) => void | Initializes the pass with a WebGL2 context. |