arrayOf
Call Signature
Section titled “Call Signature”arrayOf<
TElement
>(elementType
,elementCount
):WgslArray
<TElement
>
Defined in: packages/typegpu/src/data/array.ts:26
Creates an array schema that can be used to construct gpu buffers. Describes arrays with fixed-size length, storing elements of the same type.
Type Parameters
Section titled “Type Parameters”• TElement extends AnyWgslData
Parameters
Section titled “Parameters”elementType
Section titled “elementType”TElement
The type of elements in the array.
elementCount
Section titled “elementCount”number
The number of elements in the array.
Returns
Section titled “Returns”WgslArray
<TElement
>
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>
Call Signature
Section titled “Call Signature”arrayOf<
TElement
>(elementType
,elementCount
?): (elementCount
) =>WgslArray
<TElement
>
Defined in: packages/typegpu/src/data/array.ts:31
Creates an array schema that can be used to construct gpu buffers. Describes arrays with fixed-size length, storing elements of the same type.
Type Parameters
Section titled “Type Parameters”• TElement extends AnyWgslData
Parameters
Section titled “Parameters”elementType
Section titled “elementType”TElement
The type of elements in the array.
elementCount?
Section titled “elementCount?”undefined
The number of elements in the array.
Returns
Section titled “Returns”Function
Parameters
Section titled “Parameters”elementCount
Section titled “elementCount”number
Returns
Section titled “Returns”WgslArray
<TElement
>
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>