---
url: https://cri-middleware.github.io/SSPlayerForWeb/api/@spritestudio/ssplayer-core/classes/ShaderAttributeResolver.md
---
# Class: ShaderAttributeResolver

Defined in: [src/ShaderAttributeResolver.ts:20](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-core/src/ShaderAttributeResolver.ts#L20)

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](#params) and [cellRect](#cellrect) are reused across calls,
valid until the next [resolve](#resolve).

## Constructors

### Constructor

> **new ShaderAttributeResolver**(): `ShaderAttributeResolver`

#### Returns

`ShaderAttributeResolver`

## Properties

### cellRect

> `readonly` **cellRect**: `Float32Array`<`ArrayBuffer`>

Defined in: [src/ShaderAttributeResolver.ts:26](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-core/src/ShaderAttributeResolver.ts#L26)

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

***

### idHash

> **idHash**: `number` = `0`

Defined in: [src/ShaderAttributeResolver.ts:22](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-core/src/ShaderAttributeResolver.ts#L22)

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

***

### params

> `readonly` **params**: `Float32Array`<`ArrayBuffer`>

Defined in: [src/ShaderAttributeResolver.ts:24](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-core/src/ShaderAttributeResolver.ts#L24)

`param0`..`param7`, in order.

## Methods

### resolve()

> **resolve**(`frameData`, `shaderIdx`, `uvs`): `boolean`

Defined in: [src/ShaderAttributeResolver.ts:36](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-core/src/ShaderAttributeResolver.ts#L36)

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`](FrameData.md)

##### shaderIdx

`number`

##### uvs

`Float32Array`

#### Returns

`boolean`
