Class: ShaderBlockWriter
Defined in: modules/core/src/portable/shader-block-writer.ts:22
Serializes nested JavaScript uniform values according to a ShaderBlockLayout.
Constructors
Constructor
new ShaderBlockWriter(
layout):ShaderBlockWriter
Defined in: modules/core/src/portable/shader-block-writer.ts:29
Creates a writer for a precomputed shader-block layout.
Parameters
layout
Returns
ShaderBlockWriter
Properties
layout
readonlylayout:ShaderBlockLayout
Defined in: modules/core/src/portable/shader-block-writer.ts:24
Layout metadata used to flatten and serialize values.
Methods
get()
get(
name): {offset:number;size:number; } |undefined
Defined in: modules/core/src/portable/shader-block-writer.ts:43
Returns offset and size metadata for a flattened field.
Parameters
name
string
Returns
{ offset: number; size: number; } | undefined
getData()
getData(
uniformValues):Uint8Array
Defined in: modules/core/src/portable/shader-block-writer.ts:77
Serializes the supplied values into buffer-backed binary data.
The returned view length matches ShaderBlockLayout.byteLength, which is the exact packed size of the block.
Parameters
uniformValues
Readonly<Record<string, CompositeUniformValue>>
Returns
Uint8Array
getFlatUniformValues()
getFlatUniformValues(
uniformValues):Record<string,UniformValue>
Defined in: modules/core/src/portable/shader-block-writer.ts:54
Flattens nested composite values into leaf-path values understood by UniformBlock.
Top-level values may be supplied either in nested object form matching the declared composite shader types or as already-flattened leaf-path values.
Parameters
uniformValues
Readonly<Record<string, CompositeUniformValue>>
Returns
Record<string, UniformValue>
has()
has(
name):boolean
Defined in: modules/core/src/portable/shader-block-writer.ts:36
Returns true if the flattened layout contains the given field.
Parameters
name
string
Returns
boolean