@luma.gl/core
Version:
The luma.gl core Device API
51 lines • 1.98 kB
TypeScript
import type { CompositeUniformValue, UniformValue } from "../adapter/types/uniforms.js";
import { type ShaderBlockLayout } from "../shadertypes/shader-types/shader-block-layout.js";
/**
* Serializes nested JavaScript uniform values according to a {@link ShaderBlockLayout}.
*/
export declare class ShaderBlockWriter {
/** Layout metadata used to flatten and serialize values. */
readonly layout: ShaderBlockLayout;
/**
* Creates a writer for a precomputed shader-block layout.
*/
constructor(layout: ShaderBlockLayout);
/**
* Returns `true` if the flattened layout contains the given field.
*/
has(name: string): boolean;
/**
* Returns offset and size metadata for a flattened field.
*/
get(name: string): {
offset: number;
size: number;
} | undefined;
/**
* Flattens nested composite values into leaf-path values understood by {@link 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.
*/
getFlatUniformValues(uniformValues: Readonly<Record<string, CompositeUniformValue>>): Record<string, UniformValue>;
/**
* Serializes the supplied values into buffer-backed binary data.
*
* The returned view length matches {@link ShaderBlockLayout.byteLength}, which
* is the exact packed size of the block.
*/
getData(uniformValues: Readonly<Record<string, CompositeUniformValue>>): Uint8Array;
/**
* Recursively flattens nested values using the declared composite shader type.
*/
private _flattenCompositeValue;
/**
* Expands tightly packed numeric arrays into per-element leaf fields.
*/
private _flattenPackedArray;
/**
* Writes one flattened leaf value into its typed-array view.
*/
private _writeLeafValue;
}
//# sourceMappingURL=shader-block-writer.d.ts.map