Uniform
On this page

Uniform

Type in Runtime

A uniform of the struct T: one range of the region laid out by the uniform rules of Rule 6.8, with an accessor for each field.

import type { Uniform } from 'typeshade/runtime'

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

type Uniform<T> = StructOf<T> &
Disposable & {
/** Whether the uniform holds a change not yet uploaded. Set it to `true` after writing through
* a view that `get` returned, as in three.js. A new uniform is dirty. */
needsUpdate: boolean;
/** Free the uniform's range. A use of an accessor after it throws a `TypeError`. */
dispose(): void;
};

Description

camera.pos.set(0, 2, 5) writes a vector, camera.view.set(m) a matrix from an array, camera.set({ view, proj }) several fields; camera.pos.get() is the field’s typed view. Each set writes only what changed and widens the dirty range. Made by uniform; freed by dispose() or when the garbage collector reclaims it. Where the runtime has Symbol.dispose, it has [Symbol.dispose]() too, which using calls; the type declares it as Disposable where the host’s lib declares Symbol.dispose (Amendment A5, D4). The view types an exported binding without dispose() and [Symbol.dispose](), since it lives as long as its module (D7).

See also

Source

src/runtime/resource.ts, line 506, at commit af54ddad5

Edit this page Report a problem