struct
Declare a record type.
struct(name: string, fields: Record<string, StructFieldType>): StructType
Import struct from shaders/std.
The engine writes the WGSL struct for you and sizes buffers from it, so it is type-checked in TypeScript and identical in every pass that uses it.
Parameters
| Name | Type | Notes |
|---|---|---|
name | string | |
fields | Record<string, StructFieldType> |
Example
const Star = struct('Star', {pos: 'vec3f', vel: 'vec3f', heat: 'f32'})