Geometry
Interface in Runtime
What a draw draws: count vertices, instances times, from the vertex buffer the manifest lays out.
import type { Geometry } from 'typeshade/runtime'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
interface Geometry { readonly count: number; readonly instances?: number; readonly vertices?: ArrayBufferView | Buffer<f32> | Buffer<i32> | Buffer<u32> | object; readonly indices?: | Uint16Array | Uint32Array | Buffer<u32> | { readonly buffer: object; readonly format: 'uint16' | 'uint32' };}Description
A typed array is uploaded at the draw; a Buffer is uploaded on its
first use and bound as it is after (change 0053); a GPUBuffer is bound as is.
Instance properties
countread onlynumberHow many vertices, or indices when
indicesis given.instancesoptionalread onlynumberHow many instances: 1 when omitted.
verticesoptionalread onlyArrayBufferView | Buffer<f32> | Buffer<i32> | Buffer<u32> | objectThe vertex buffer, laid out as the manifest’s vertex entry reads it (its
@locationinputs, tightly packed): a typed array, uploaded at each draw; aBuffer<f32>,Buffer<i32>orBuffer<u32>, uploaded once (change 0138, Amendment A11, Q3), aBuffer<number>among them, whose element the attributes’ scalar fixes (Amendment A12, D3); or the host’sGPUBuffer. Omitted for a vertex entry with no@locationinput, such as a full-screen triangle drawn fromvertex_index. Escape hatch (Rule 11.17): a hostGPUBuffer, or on WebGL2 aWebGLBuffer, bound as it is.indicesoptionalread only| Uint16Array | Uint32Array | Buffer<u32> | { readonly buffer: object; readonly format: 'uint16' | 'uint32' }The index buffer: a
Uint16ArrayorUint32Array, uploaded at each draw; aBuffer<u32>, uploaded once, its formatuint32, aBuffer<number>among them, which it fixes asu32(Amendment A12, D3); or{ buffer, format }, the host’sGPUBufferbound as it is. Escape hatch (Rule 11.17): a hostGPUBuffer, or on WebGL2 aWebGLBuffer, as thebufferof{ buffer, format }.
Source
src/runtime/program.ts, line 336, at commit af54ddad5