API

Interface PickDiscardRule

Optional GPU-side discard rule for pickAsync.

This lets apps remove pick hits with custom WGSL while keeping the main scene render untouched. The WGSL must define fn shouldDiscardPick(input: PickDiscardInput) -> bool.

interface PickDiscardRule {
    key: string;
    storage?: readonly PickDiscardStorage[];
    vertexData?: PickVertexDataAttribute;
    wgsl: string;
    worldAdjustWgsl?: string;
}
Index
key: string

Stable cache key for the generated picking pipeline set. Change it when the WGSL or layout changes.

storage?: readonly PickDiscardStorage[]

Optional typed-array storage inputs exposed to WGSL at group 2.

Optional existing regular-mesh attribute forwarded flat as a padded PickDiscardInput.vertexData vec4. Values come from the mesh's source attribute buffer (not skin/morph-deformed). Meshes without the requested buffer and all thin instances receive zero.

wgsl: string

WGSL source that defines shouldDiscardPick(input: PickDiscardInput) -> bool.

worldAdjustWgsl?: string

Optional WGSL source that defines fn adjustPickWorld(input: PickWorldInput) -> vec3f. Use it to mirror a visible material's vertex displacement in the GPU pick pass. The hook runs before projection and fragment discard for regular and thin-instanced meshes. PickWorldInput exposes the base world/local position, affine basis and origin, spare thin-instance matrix lanes, instance identity, and the optional selected regular-mesh vertex attribute. Omit for identity projection.