DriftTexture · interface

Weights

Explained in DriftTexture.

interface Weights
import type { Weights } from '@driftengine/texture';

Methods

read

read(name: string, shape?: readonly number[]): string

The weight name as a value of the graph; refused if absent or held at another shape.

ParameterTypeDescription
namestring
shape?readonly number[]

derive

derive(name: string, shape: readonly number[], compute: (values: (part: string, shape?: readonly number[]) => Float32Array) => Float32Array): string

A weight computed once from others, kept under name. compute reads its parts through values, which counts each as read; a source already holding name answers with it instead.

ParameterTypeDescription
namestring
shapereadonly number[]
compute(values: (part: string, shape?: readonly number[]) => Float32Array) => Float32Array

constant

constant(name: string, shape: readonly number[], data: Float32Array): string

A table computed from the graph's shapes, rebuilt on every run and never a weight.

ParameterTypeDescription
namestring
shapereadonly number[]
dataFloat32Array

ignore

ignore(nameOrPrefix: string): void

Weights the definition deliberately does not read: a name, or a prefix ending in a dot.

ParameterTypeDescription
nameOrPrefixstring