UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

31 lines (30 loc) 1.34 kB
import type { AnyData, Disarray } from './dataTypes.ts'; interface DisarrayConstructor { <TElement extends AnyData>(elementType: TElement): (elementCount: number) => Disarray<TElement>; <TElement extends AnyData>(elementType: TElement, elementCount: number): Disarray<TElement>; } /** * 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. * * @example * const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f * * @example * const disarray = d.disarrayOf(d.align(16, d.vec3f), 3); * * If `elementCount` is not specified, a partially applied function is returned. * @example * const disarray = d.disarrayOf(d.vec3f); * // ^? (n: number) => Disarray<d.Vec3f> * * @param elementType The type of elements in the array. * @param elementCount The number of elements in the array. */ export declare const disarrayOf: import("../indexNamedExports.ts").TgpuComptime<DisarrayConstructor>; export declare function cpu_disarrayOf<TElement extends AnyData>(elementType: TElement, elementCount: number): Disarray<TElement>; export {};