@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / InstancedMeshComponent
Class: InstancedMeshComponent
Defined in: components/InstancedMesh.ts:64
Holds authored instanced-mesh data for an entity that renders as a THREE.InstancedMesh. Supports primitive geometry kinds (cube, sphere, plane, capsule, cylinder).
The instancedMesh field is a live runtime reference that is not serialized into snapshots — it is excluded by the snapshot normalizer in worldSnapshotUtils.ts to prevent history churn.
Extends
Constructors
Constructor
ts
new InstancedMeshComponent(
meshKind?,
meshParameters?,
options?): InstancedMeshComponent;Defined in: components/InstancedMesh.ts:93
Parameters
| Parameter | Type | Default value |
|---|---|---|
meshKind | InstancedMeshKind | "cube" |
meshParameters? | Partial<MeshGeometryParameters> | undefined |
options? | { castShadow?: boolean; receiveShadow?: boolean; instanceEntityIds?: number[]; modelPath?: string; } | undefined |
options.castShadow? | boolean | undefined |
options.receiveShadow? | boolean | undefined |
options.instanceEntityIds? | number[] | undefined |
options.modelPath? | string | undefined |
Returns
InstancedMeshComponent
Overrides
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
meshKind | InstancedMeshKind | Geometry kind for all instances. Use "model" for a custom GLTF/GLB asset. | components/InstancedMesh.ts:66 |
modelPath | string | Path to the GLTF/GLB asset when meshKind === "model". Serialized in snapshots and restored on hydration. | components/InstancedMesh.ts:71 |
meshParameters | MeshGeometryParameters | Editable geometry parameters (width/height/depth, radius, etc.). Ignored when meshKind === "model". | components/InstancedMesh.ts:73 |
castShadow | boolean | Whether all instances cast shadows. | components/InstancedMesh.ts:75 |
receiveShadow | boolean | Whether all instances receive shadows. | components/InstancedMesh.ts:77 |
instanceEntityIds | number[] | Ordered list of entity IDs for the instance slot entities owned by this group. Each slot entity carries a TransformComponent that InstancedMeshSystem reads every frame to build the per-instance matrix. | components/InstancedMesh.ts:83 |
instancedMesh | Object3D<Object3DEventMap> | null | Live runtime container managed by InstancedMeshSystem: - For primitive kinds: a THREE.InstancedMesh. - For "model" kind: a THREE.Group containing per-mesh THREE.InstancedMesh objects. Excluded from snapshot serialization — do not read this in hydration code. | components/InstancedMesh.ts:91 |
Methods
getSanitizedParameters()
ts
getSanitizedParameters(): MeshGeometryParameters;Defined in: components/InstancedMesh.ts:117
Sanitize and return a copy of the current mesh parameters with valid values.

