unstruct
unstruct<
TProps>(properties):Unstruct<TProps>
Defined in: packages/typegpu/src/data/unstruct.ts:29
Creates a loose struct schema that can be used to construct vertex buffers. Describes structs with members of both loose and non-loose types.
The order of members matches the passed in properties object.
Members are not aligned in respect to their byteAlignment,
unless they are explicitly decorated with the custom align attribute
via d.align function.
Type Parameters
Section titled “Type Parameters”• TProps extends Record<string, BaseData>
Parameters
Section titled “Parameters”properties
Section titled “properties”TProps
Record with string keys and TgpuData or TgpuLooseData values,
each entry describing one struct member.
Returns
Section titled “Returns”Unstruct<TProps>
Examples
Section titled “Examples”const CircleStruct = d.unstruct({ radius: d.f32, pos: d.vec3f }); // packed struct with no paddingconst CircleStruct = d.unstruct({ radius: d.f32, pos: d.align(16, d.vec3f) });