Geometry
On this page

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 only number

How many vertices, or indices when indices is given.

instancesoptionalread only number

How many instances: 1 when omitted.

verticesoptionalread only ArrayBufferView | Buffer<f32> | Buffer<i32> | Buffer<u32> | object

The vertex buffer, laid out as the manifest’s vertex entry reads it (its @location inputs, tightly packed): a typed array, uploaded at each draw; a Buffer<f32>, Buffer<i32> or Buffer<u32>, uploaded once (change 0138, Amendment A11, Q3), a Buffer<number> among them, whose element the attributes’ scalar fixes (Amendment A12, D3); or the host’s GPUBuffer. Omitted for a vertex entry with no @location input, such as a full-screen triangle drawn from vertex_index. Escape hatch (Rule 11.17): a host GPUBuffer, or on WebGL2 a WebGLBuffer, bound as it is.

indicesoptionalread only | Uint16Array | Uint32Array | Buffer<u32> | { readonly buffer: object; readonly format: 'uint16' | 'uint32' }

The index buffer: a Uint16Array or Uint32Array, uploaded at each draw; a Buffer<u32>, uploaded once, its format uint32, a Buffer<number> among them, which it fixes as u32 (Amendment A12, D3); or { buffer, format }, the host’s GPUBuffer bound as it is. Escape hatch (Rule 11.17): a host GPUBuffer, or on WebGL2 a WebGLBuffer, as the buffer of { buffer, format }.

Source

src/runtime/program.ts, line 336, at commit af54ddad5

Edit this page Report a problem