Skip to content

Class: ShaderAttributeResolver ​

Defined in: src/ShaderAttributeResolver.ts:20

Reads a part's SHDR (integration shader) attribute into the values every renderer hands its shader: which built-in ss-* program to use, its eight parameters, and the cell's UV rect.

What the shader is and what it is given does not depend on how it is bound — ssplayer-pixi writes into a UniformGroup and ssplayer-webgl calls gl.uniform*, and the GLSL/WGSL bodies stay with each of them, but the numbers reaching them are the same numbers. The cell rect in particular is a derivation rather than a value in the frame: it is the min/max of the quad's four corner UVs, and getting it wrong shows up as a shader sampling outside its own cell.

Allocation-free: params and cellRect are reused across calls, valid until the next resolve.

Constructors ​

Constructor ​

new ShaderAttributeResolver(): ShaderAttributeResolver

Returns ​

ShaderAttributeResolver

Properties ​

cellRect ​

readonly cellRect: Float32Array<ArrayBuffer>

Defined in: src/ShaderAttributeResolver.ts:26

The cell's UV rect as (left, top, right, bottom).


idHash ​

idHash: number = 0

Defined in: src/ShaderAttributeResolver.ts:22

id_hash of the ss-* program the part asks for.


params ​

readonly params: Float32Array<ArrayBuffer>

Defined in: src/ShaderAttributeResolver.ts:24

param0..param7, in order.

Methods ​

resolve() ​

resolve(frameData, shaderIdx, uvs): boolean

Defined in: src/ShaderAttributeResolver.ts:36

Read the SHDR attribute at shaderIdx of frameData, taking the cell rect from uvs — the quad's corner UVs at indices 0..3 (vertex 4, where one exists, is the centre and takes no part). Returns false when the attribute is not there, in which case nothing is written.

Parameters ​

frameData ​

FrameData

shaderIdx ​

number

uvs ​

Float32Array

Returns ​

boolean