Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / InstancedMeshSystem

Class: InstancedMeshSystem

Defined in: systems/InstancedMeshSystem.ts:128

Maintains the runtime geometry for entities with an InstancedMeshComponent.

  • Primitive kinds (cube, sphere, plane, cylinder, capsule): creates a single THREE.InstancedMesh on the anchor and writes per-instance matrices every frame.
  • Model kind (model): asynchronously loads the GLTF/GLB at comp.modelPath, traverses the scene to collect all THREE.Mesh nodes, and creates one THREE.InstancedMesh per mesh (preserving the mesh's local transform and original materials). All sub-meshes are grouped under a THREE.Group stored in comp.instancedMesh. Per-instance matrices are composed as instanceTransform × meshLocalMatrix every frame.

Geometry is rebuilt whenever the signature (meshKind:parameters:instanceCount for primitives, model:path:instanceCount for model kind) changes.

Implements

Constructors

Constructor

ts
new InstancedMeshSystem(): InstancedMeshSystem;

Returns

InstancedMeshSystem

Methods

update()

ts
update(world): void;

Defined in: systems/InstancedMeshSystem.ts:146

Parameters

ParameterType
worldWorld

Returns

void

Implementation of

EcsSystem.update