uniform
On this page

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

cls ResourceClass<T, 'set' | 'needsUpdate' | 'dispose'>
initoptional Some<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

TypeError

TypeError for a value that is no class of a shader module, for an abstract class, for a struct with no uniform layout (a bool, a two-row matrix), for a field whose name is the accessor’s own (set, needsUpdate, dispose), and for an init that does not fit. The host’s editor refuses a class with such a field already, with TS8079 (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

Edit this page Report a problem