queueMeshes

View sourcequeueMeshes(world: World): void

Queues WebGL vertex arrays for mesh assets whose GPU representation must be created or rebuilt.

WebglRendererPlugin registers this function directly in the repeating AppSchedule.Update schedule’s CoreSystems.PostMain group. Each run reads typed Events resources for MeshAdded and MeshModified, a typed Assets resource for Mesh; the run also reads the MeshCache, the AttributeMap, and the Windows canvas resource.

The system selects the first tuple matching [[EntityHandle](</api/ecs/others/class/EntityHandle>), [Window](</api/window/component/Window>), [MainWindow](</api/window/component/MainWindow>)] with Query#single. No matching main window emits a warning and returns. Windows#getWindow returning no canvas returns silently, while a canvas without a webgl2 context emits a warning and returns. Any of these early returns skip both event passes for that invocation.

For each MeshAdded event, the asset id from event.data.id is passed to the internal mesh update path, which looks up the Mesh in Assets<Mesh>, asserts that it exists, calls createVAO, and stores the resulting WebGLVertexArrayObject in MeshCache under the same id. For each MeshModified event, the existing cached VAO is deleted with gl.deleteVertexArray, then recreated and replaced through the same path. The modified path assumes the mesh already has a cached VAO; it does not skip a missing cache entry.

Events#each visits the current readable batch in write order; it does not clear or remove those events, and this system does not call Events#clear. The event plugins normally rotate these batches separately in CoreSystems.End. Therefore a guard return means neither batch is processed during this invocation. This function does not retain or retry skipped events, so a later invocation sees them only if the event resource has not been cleared. MeshDropped Events and GPU deletion are handled by the sibling disposeDroppedMeshes system. This function only prepares the VAO cache; draw calls are issued by the WebGL render systems that consume it.

Examples

// WebglRendererPlugin installs queueMeshes in Update/PostMain.
app.registerPlugin(new WebglRendererPlugin())
// MeshAdded and MeshModified batches then create or rebuild MeshCache entries.

Parameters

NameDescriptionDefault
world

World containing the required resources and main-window components.

—