Skip to content

disarrayOf

disarrayOf<TElement>(elementType, elementCount): Disarray<TElement>

Defined in: packages/typegpu/src/data/disarray.ts:31

Creates an array schema that can be used to construct vertex buffers. Describes arrays with fixed-size length, storing elements of the same type.

Elements in the schema are not aligned in respect to their byteAlignment, unless they are explicitly decorated with the custom align attribute via d.align function.

TElement extends AnyData

TElement

The type of elements in the array.

number

The number of elements in the array.

Disarray<TElement>

const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f
const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);
If `elementCount` is not specified, a partially applied function is returned.
const disarray = d.disarrayOf(d.vec3f);
// ^? (n: number) => Disarray<d.Vec3f>

disarrayOf<TElement>(elementType, elementCount?): (elementCount) => Disarray<TElement>

Defined in: packages/typegpu/src/data/disarray.ts:36

Creates an array schema that can be used to construct vertex buffers. Describes arrays with fixed-size length, storing elements of the same type.

Elements in the schema are not aligned in respect to their byteAlignment, unless they are explicitly decorated with the custom align attribute via d.align function.

TElement extends AnyData

TElement

The type of elements in the array.

undefined

The number of elements in the array.

Function

number

Disarray<TElement>

const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f
const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);
If `elementCount` is not specified, a partially applied function is returned.
const disarray = d.disarrayOf(d.vec3f);
// ^? (n: number) => Disarray<d.Vec3f>