Skip to main content

Class: InstancedMesh2<T, G, M>

InstancedMesh2.InstancedMesh2

Extends the functionality of InstancedMesh, providing streamlined control over instance transformations and visibility, while also integrating frustum culling for each instance to improve performance.

Type parameters

NameTypeDescription
T{}Custom data type.
Gextends BufferGeometry = BufferGeometryGeometry type.
Mextends Material = MaterialMaterial type.

Hierarchy

  • InstancedMesh<G, M>

    InstancedMesh2

Constructors

constructor

new InstancedMesh2<T, G, M>(geometry, material, count, config)

Type parameters

NameType
T{}
Gextends BufferGeometry<NormalBufferAttributes, G> = BufferGeometry<NormalBufferAttributes>
Mextends Material<M> = Material

Parameters

NameTypeDescription
geometryGThe geometry for the instanced mesh.
materialMThe material to apply to the instanced mesh.
countnumberThe number of instances to create.
configInstancedMesh2Params<T>Configuration object.

Overrides

InstancedMesh<G, M\>.constructor

Defined in

packages/InstancedMesh2/src/InstancedMesh2.ts:56

Properties

cursor

cursor: Cursor

Cursor style when interacting with the object.

Inherited from

InstancedMesh.cursor

Defined in

src/patch/Object3D.ts:56


cursorDrag

cursorDrag: Cursor

Cursor style when dragging the object.

Inherited from

InstancedMesh.cursorDrag

Defined in

src/patch/Object3D.ts:58


cursorDrop

cursorDrop: Cursor

Cursor style when dropping an object onto this one.

Inherited from

InstancedMesh.cursorDrop

Defined in

src/patch/Object3D.ts:60


dragTarget

dragTarget: Object3D<Object3DEventMap>

Indicates which object will be dragged instead of this one.

Inherited from

InstancedMesh.dragTarget

Defined in

src/patch/Object3D.ts:46


draggable

draggable: boolean

Indicates whether the object is draggable. Default is DEFAULT_DRAGGABLE (false).

Inherited from

InstancedMesh.draggable

Defined in

src/patch/Object3D.ts:50


enabled

enabled: boolean

Determines if the object is enabled. Default is true. If set to true, it allows triggering all InteractionEvents; otherwise, events are disabled.

Inherited from

InstancedMesh.enabled

Defined in

src/patch/Object3D.ts:40


findDropTarget

findDropTarget: boolean

Determines when the object is dragged, whether it will have to search for any drop targets. Default is false.

Inherited from

InstancedMesh.findDropTarget

Defined in

src/patch/Object3D.ts:52


focusable

focusable: boolean

Indicates whether the object can receive focus. Default is DEFAULT_FOCUSABLE (true).

Inherited from

InstancedMesh.focusable

Defined in

src/patch/Object3D.ts:48


hitboxes

hitboxes: Hitbox[]

Array of hitboxes for collision detection.

Inherited from

InstancedMesh.hitboxes

Defined in

src/patch/Object3D.ts:44


instances

instances: Entity<T>[]

An array storing individual InstancedEntity instances associated with this InstancedMesh2. Each element represents a separate instance that can be managed individually.

Defined in

packages/InstancedMesh2/src/InstancedMesh2.ts:43


interceptByRaycaster

interceptByRaycaster: boolean

Determines if the object can be intercepted by the main raycaster. Default is DEFAULT_INTERCEPT_BY_RAYCASTER (true).

Inherited from

InstancedMesh.interceptByRaycaster

Defined in

src/patch/Object3D.ts:42


isInstancedMesh2

isInstancedMesh2: boolean = true

A flag indicating that this is an instance of InstancedMesh2.

Defined in

packages/InstancedMesh2/src/InstancedMesh2.ts:38


needsRender

needsRender: boolean

Indicates whether the scene needs rendering.

Inherited from

InstancedMesh.needsRender

Defined in

src/patch/Object3D.ts:62


scene

scene: Scene

Reference to the scene the object belongs to.

Inherited from

InstancedMesh.scene

Defined in

src/patch/Object3D.ts:54


tags

tags: Set<string>

Indicates the tags to be searched using the querySelector and querySelectorAll methods.

Inherited from

InstancedMesh.tags

Defined in

src/patch/Object3D.ts:64

Accessors

clicking

get clicking(): boolean

Indicates if the object is currently being clicked.

Returns

boolean

Inherited from

InstancedMesh.clicking

Defined in

src/patch/Object3D.ts:70


dragging

get dragging(): boolean

Indicates if the object is currently being dragged.

Returns

boolean

Inherited from

InstancedMesh.dragging

Defined in

src/patch/Object3D.ts:72


enabledState

get enabledState(): boolean

Retrieves the combined enabled state considering parent objects.

Returns

boolean

Inherited from

InstancedMesh.enabledState

Defined in

src/patch/Object3D.ts:74


firstFocusable

get firstFocusable(): Object3D<Object3DEventMap>

Retrieves the first possible focusable object.

Returns

Object3D<Object3DEventMap>

Inherited from

InstancedMesh.firstFocusable

Defined in

src/patch/Object3D.ts:78


focused

get focused(): boolean

Indicates if the object is currently focused.

Returns

boolean

Inherited from

InstancedMesh.focused

Defined in

src/patch/Object3D.ts:68


hovered

get hovered(): boolean

Indicates if the primary pointer is over this object.

Returns

boolean

Inherited from

InstancedMesh.hovered

Defined in

src/patch/Object3D.ts:66


visibilityState

get visibilityState(): boolean

Retrieves the combined visibility state considering parent objects.

Returns

boolean

Inherited from

InstancedMesh.visibilityState

Defined in

src/patch/Object3D.ts:76

Methods

applyBlur

applyBlur(): void

Applies blur (removes focus) from the object.

Returns

void

Inherited from

InstancedMesh.applyBlur

Defined in

src/patch/Object3D.ts:86


applyFocus

applyFocus(): void

Applies focus to the object.

Returns

void

Inherited from

InstancedMesh.applyFocus

Defined in

src/patch/Object3D.ts:82


bindProperty

bindProperty<T>(property, getCallback, renderOnChange?): InstancedMesh2<T, G, M>

Binds a property to a callback function for updates.

Type parameters

NameType
Textends keyof InstancedMesh2<T, G, M>

Parameters

NameTypeDescription
propertyTThe name of the property to bind.
getCallback() => InstancedMesh2<T, G, M>[T]A function that retrieves the property's value.
renderOnChange?booleanIndicates whether to render when the property changes (optional, default: false).

Returns

InstancedMesh2<T, G, M>

The instance of the object with the binding applied.

Inherited from

InstancedMesh.bindProperty

Defined in

src/patch/Object3D.ts:138


detectChanges

detectChanges(recursive?): void

Calculates all bindings on the current object. If 'recursive' is set to true, it will also calculate bindings for all children.

Parameters

NameTypeDescription
recursive?booleanIf true, calculate bindings for children as well (optional, default: false).

Returns

void

Inherited from

InstancedMesh.detectChanges

Defined in

src/patch/Object3D.ts:130


hasEvent

hasEvent<K>(type, listener): boolean

Checks if the object has a specific event listener.

Type parameters

NameType
Kextends keyof MiscEvents | keyof InteractionEvents<Object3D<Object3DEventMap>, Object3D<Object3DEventMap>, Object3D<Object3DEventMap> | InstancedMeshEntity> | keyof UpdateEvents

Parameters

NameTypeDescription
typeKThe type of event to check for.
listener(event?: Events[K]) => voidThe callback function to check.

Returns

boolean

true if the event listener is attached; otherwise, false.

Inherited from

InstancedMesh.hasEvent

Defined in

src/patch/Object3D.ts:100


off

off<K>(type, listener): void

Removes an event listener from the object.

Type parameters

NameType
Kextends keyof MiscEvents | keyof InteractionEvents<Object3D<Object3DEventMap>, Object3D<Object3DEventMap>, Object3D<Object3DEventMap> | InstancedMeshEntity> | keyof UpdateEvents

Parameters

NameTypeDescription
typeKThe type of event to remove the listener from.
listener(event?: Events[K]) => voidThe callback function to remove.

Returns

void

Inherited from

InstancedMesh.off

Defined in

src/patch/Object3D.ts:106


on

on<K>(type, listener): (event?: Events[K]) => void

Attaches an event listener to the object.

Type parameters

NameType
Kextends keyof MiscEvents | keyof InteractionEvents<Object3D<Object3DEventMap>, Object3D<Object3DEventMap>, Object3D<Object3DEventMap> | InstancedMeshEntity> | keyof UpdateEvents

Parameters

NameTypeDescription
typeK | K[]The type of event to listen for.
listener(this: InstancedMesh2<T, G, M>, event?: Events[K]) => voidThe callback function to execute when the event occurs.

Returns

fn

A function to remove the event listener.

▸ (event?): void

Attaches an event listener to the object.

Parameters
NameType
event?Events[K]
Returns

void

A function to remove the event listener.

Inherited from

InstancedMesh.on

Defined in

src/patch/Object3D.ts:93


querySelector

querySelector(query): Object3D<Object3DEventMap>

Finds and returns the first Object3D element that matches the specified query string. This method follows a similar syntax to CSS selectors.

Parameters

NameTypeDescription
querystringThe query string to match against the Object3D elements.

Returns

Object3D<Object3DEventMap>

The first Object3D element that matches the query, or undefined if no match is found.

Inherited from

InstancedMesh.querySelector

Defined in

src/patch/Object3D.ts:158


querySelectorAll

querySelectorAll(query): Object3D<Object3DEventMap>[]

Finds and returns a list of Object3D elements that match the specified query string. This method follows a similar syntax to CSS selectors.

Parameters

NameTypeDescription
querystringThe query string to match against the Object3D elements.

Returns

Object3D<Object3DEventMap>[]

An array of Object3D elements that match the query.

Inherited from

InstancedMesh.querySelectorAll

Defined in

src/patch/Object3D.ts:165


setManualDetectionMode

setManualDetectionMode(): void

Activates manual detection mode for bindings. When this method is used, all bindings will no longer be calculated automatically. Instead, they must be manually computed using the 'detectChanges' function.

Returns

void

Inherited from

InstancedMesh.setManualDetectionMode

Defined in

src/patch/Object3D.ts:124


trigger

trigger<K>(type, event?): void

Triggers a specific event on the object.

Type parameters

NameType
Kextends keyof MiscEvents | keyof InteractionEvents<Object3D<Object3DEventMap>, Object3D<Object3DEventMap>, Object3D<Object3DEventMap> | InstancedMeshEntity> | keyof UpdateEvents

Parameters

NameTypeDescription
typeKThe type of event to trigger.
event?Events[K]Optional event data to pass to the listeners.

Returns

void

Inherited from

InstancedMesh.trigger

Defined in

src/patch/Object3D.ts:112


triggerAncestor

triggerAncestor<K>(type, event?): void

Triggers a specific event on the object and all its ancestors.

Type parameters

NameType
Kextends keyof InteractionEvents<Object3D<Object3DEventMap>, Object3D<Object3DEventMap>, Object3D<Object3DEventMap> | InstancedMeshEntity>

Parameters

NameTypeDescription
typeKThe type of event to trigger.
event?InteractionEvents<Object3D<Object3DEventMap>, Object3D<Object3DEventMap>, Object3D<Object3DEventMap> | InstancedMeshEntity>[K]Optional event data to pass to the listeners.

Returns

void

Inherited from

InstancedMesh.triggerAncestor

Defined in

src/patch/Object3D.ts:118


tween

tween<T>(id?): Tween<T>

Initiates a Tween animation for the object.

Type parameters

NameTypeDescription
Textends Object3D<Object3DEventMap, T> = Object3D<Object3DEventMap>The type of the target.

Parameters

NameTypeDescription
id?stringUnique identifier. If you start a new tween, the old one with the same id (if specified) will be stopped.

Returns

Tween<T>

A Tween instance for further configuration.

Inherited from

InstancedMesh.tween

Defined in

src/patch/Object3D.ts:151


unbindProperty

unbindProperty<T>(property): InstancedMesh2<T, G, M>

Unbinds a previously bound property from the object.

Type parameters

NameType
Textends keyof InstancedMesh2<T, G, M>

Parameters

NameTypeDescription
propertyTThe name of the property to unbind.

Returns

InstancedMesh2<T, G, M>

The instance of the object with the binding removed.

Inherited from

InstancedMesh.unbindProperty

Defined in

src/patch/Object3D.ts:144


updateCulling

updateCulling(camera): void

Updates the visibility of instances based on the camera's frustum. This method is responsible for determining which instances are within the camera's view and should be rendered, and which are outside and should be culled to improve performance.

Parameters

NameTypeDescription
cameraCameraCamera used for rendering.

Returns

void

Defined in

packages/InstancedMesh2/src/InstancedMesh2.ts:276