uniform()
Function in Runtime
A uniform of the struct of cls, a class a shader module exports: one range of the region, zeroed, then given the fields init names.
import { uniform } from 'typeshade/runtime'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
function uniform<T extends object>( cls: ResourceClass<T, 'set' | 'needsUpdate' | 'dispose'>, init?: Some<T>,): Uniform<T>Parameters
clsResourceClass<T, 'set' | 'needsUpdate' | 'dispose'>initoptionalSome<T>some of its fields, each a host value (Rule 8.21).
Return value
Uniform<T>
the uniform, whose fields are set with set and read with get.
Exceptions
TypeErrorTypeErrorfor a value that is no class of a shader module, for an abstract class, for a struct with no uniform layout (abool, a two-row matrix), for a field whose name is the accessor’s own (set,needsUpdate,dispose), and for aninitthat does not fit. The host’s editor refuses a class with such a field already, withTS8079(Amendment A5, D3).
Description
uniform<T> in a shader file and
uniform(T) in host code name the same thing, a uniform of T (Amendment A1).
In the guide
See also
Source
src/runtime/resource.ts, line 1014, at commit af54ddad5