Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

LayerLifecycleHooks

Defined in: packages/sigma/src/rendering/nodes/types.ts:254

Lifecycle hooks for layers that need async resources. Returned by the lifecycle factory function.

Properties

beforeRender?

optional beforeRender?: () => void

Defined in: packages/sigma/src/rendering/nodes/types.ts:265

Called before each render. Use for binding textures, updating dynamic uniforms, etc.

Returns

void


getAttributeData?

optional getAttributeData?: (data, attributeSource) => number | number[] | null

Defined in: packages/sigma/src/rendering/nodes/types.ts:289

Returns data for special attribute sources. Used by layers that need to inject per-node data from external sources (like texture coordinates from an atlas).

Parameters

data

Record<string, unknown>

The node’s display data

attributeSource

string

The source name from the attribute specification

Returns

number | number[] | null

The value(s) for the attribute, or null to fall back to node data


init?

optional init?: () => void

Defined in: packages/sigma/src/rendering/nodes/types.ts:259

Called after the program is initialized and ready. Use for setting up event listeners, initializing resources, etc.

Returns

void


kill?

optional kill?: () => void

Defined in: packages/sigma/src/rendering/nodes/types.ts:278

Called when the program is destroyed. Use for cleanup: removing listeners, releasing resources, etc.

Returns

void


regenerate?

optional regenerate?: () => FragmentLayer

Defined in: packages/sigma/src/rendering/nodes/types.ts:272

Called when the layer’s shader portion needs regeneration. Should return a new FragmentLayer definition with updated GLSL. If not provided, the original layer definition is reused.

Returns

FragmentLayer