arrayOf
Creates an array schema that can be used to construct gpu buffers. Describes arrays with fixed-size length, storing elements of the same type.
Examples
Section titled “Examples”const LENGTH = 3;const array = d.arrayOf(d.u32, LENGTH);
If `elementCount` is not specified, a partially applied function is returned.const array = d.arrayOf(d.vec3f);// ^? (n: number) => WgslArray<d.Vec3f>The type of elements in the array.
The number of elements in the array.
Call Signature
Section titled “Call Signature”arrayOf<
TElement>(elementType): (elementCount) =>WgslArray<TElement>
Type Parameters
Section titled “Type Parameters”• TElement extends AnyWgslData
Parameters
Section titled “Parameters”elementType
Section titled “elementType”TElement
Returns
Section titled “Returns”Function
Parameters
Section titled “Parameters”elementCount
Section titled “elementCount”number
Returns
Section titled “Returns”WgslArray<TElement>
Defined in
Section titled “Defined in”packages/typegpu/src/data/array.ts:40
Call Signature
Section titled “Call Signature”arrayOf<
TElement>(elementType,elementCount):WgslArray<TElement>
Type Parameters
Section titled “Type Parameters”• TElement extends AnyWgslData
Parameters
Section titled “Parameters”elementType
Section titled “elementType”TElement
elementCount
Section titled “elementCount”number
Returns
Section titled “Returns”WgslArray<TElement>