Renderer · interface

MeshHandle

Geometry on the device, as something a consumer holds and hands back.

Explained in Hello world.

interface MeshHandle
import type { MeshHandle } from '@driftengine/core';

In depth

Opaque on purpose, and the opacity is forced rather than chosen. Mesh has private fields, which makes it nominal in TypeScript: no other type can ever satisfy it, however identical its shape, so a WebGPU mesh cannot be a Mesh and the shared surface cannot name one. That is not a flaw in Mesh — the privacy is what keeps WebGLBuffers out of reach — it just means the surface has to describe the handle rather than the object.

A consumer receives one from createMesh and passes it to drawMesh. There is nothing to read on it, which is the point: the backend that made it is the only thing that can.

Properties

NameTypeDescription
boundsreadonlyBounds
completereadonlybooleanWhether all of this mesh's geometry has reached the device.
More

True for every mesh createMesh returns; false between the steps of one from createMeshIncremental, until its last. Nothing incomplete is drawn — see that method for why, and for what a done upload with this still false means.

Named here for the reason bounds is: both backends' meshes genuinely carry it, so a consumer can ask without reaching past this surface for a backend-specific type.