Skip to main content

Class: DepthMesh

Defined in: src/depth/DepthMesh.ts:11

Extends

Constructors

Constructor

new DepthMesh(depthOptions, width, height, depthTextures?): DepthMesh

Defined in: src/depth/DepthMesh.ts:44

Parameters

depthOptions

DepthOptions

width

number

height

number

depthTextures?

DepthTextures

Returns

DepthMesh

Overrides

MeshScript.constructor

Properties

downsampledGeometry?

optional downsampledGeometry: BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Defined in: src/depth/DepthMesh.ts:25


downsampledMesh?

optional downsampledMesh: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>

Defined in: src/depth/DepthMesh.ts:26


isXRScript

isXRScript: boolean = true

Defined in: src/core/Script.ts:99

Inherited from

MeshScript.isXRScript


xb?

optional xb: XBObjectOptions

Defined in: src/interaction/InteractionTypes.ts:32

Inherited from

MeshScript.xb


dependencies

static dependencies: object

Defined in: src/depth/DepthMesh.ts:12

renderer

renderer: typeof WebGLRenderer = THREE.WebGLRenderer


isDepthMesh

static isDepthMesh: boolean = true

Defined in: src/depth/DepthMesh.ts:15

Methods

dispose()

dispose(): void

Defined in: src/core/Script.ts:263

Called when the script is removed from the scene. Opposite of init.

Returns

void

Inherited from

MeshScript.dispose


getColliderFromHandle()

getColliderFromHandle(handle): Collider | undefined

Defined in: src/depth/DepthMesh.ts:417

Parameters

handle

number

Returns

Collider | undefined


init()

init(__namedParameters): void

Defined in: src/depth/DepthMesh.ts:137

Initialize the depth mesh.

Parameters

__namedParameters
renderer

WebGLRenderer

Returns

void

Overrides

MeshScript.init


initPhysics()

initPhysics(_physics): void | Promise<void>

Defined in: src/core/Script.ts:118

Enables depth-aware interactions with physics. See /samples/advanced/ballpit

Parameters

_physics

Physics

Returns

void | Promise<void>

Inherited from

MeshScript.initPhysics


initRapierPhysics()

initRapierPhysics(RAPIER, blendedWorld): void

Defined in: src/depth/DepthMesh.ts:353

Parameters

RAPIER

__module

blendedWorld

World

Returns

void


onHoverEnter()

onHoverEnter(_event): void

Defined in: src/core/Script.ts:215

Called when a source starts hovering over this object.

Parameters

_event

HoverEvent

The hover source, target, surface, and intersection. Call event.stopPropagation() to stop bubbling to ancestor Scripts.

Returns

void

Inherited from

MeshScript.onHoverEnter


onHoverExit()

onHoverExit(_event): void

Defined in: src/core/Script.ts:221

Called when a source stops hovering over this object.

Parameters

_event

HoverEvent

The hover source, target, surface, and intersection. Call event.stopPropagation() to stop bubbling to ancestor Scripts.

Returns

void

Inherited from

MeshScript.onHoverExit


onHovering()

onHovering(_event): void

Defined in: src/core/Script.ts:227

Called while a source hovers over this object.

Parameters

_event

HoverEvent

The hover source, target, surface, and intersection. Call event.stopPropagation() to stop bubbling to ancestor Scripts.

Returns

void

Inherited from

MeshScript.onHovering


onKeyDown()

onKeyDown(_event): void

Defined in: src/core/Script.ts:158

Called on keyboard keypress.

Parameters

_event

KeyEvent

Event containing .code to read the keyboard key.

Returns

void

Inherited from

MeshScript.onKeyDown


onKeyUp()

onKeyUp(_event): void

Defined in: src/core/Script.ts:159

Parameters

_event

KeyEvent

Returns

void

Inherited from

MeshScript.onKeyUp


onLongSelect()

onLongSelect(_event): void

Defined in: src/core/Script.ts:152

Called when an object selection reaches the long-select delay.

Parameters

_event

LongSelectEvent

Returns

void

Inherited from

MeshScript.onLongSelect


onObjectGrabbing()

onObjectGrabbing(_event): void

Defined in: src/core/Script.ts:253

Called every frame a hand is grabbing this object.

Parameters

_event

ObjectGrabEvent

Returns

void

Inherited from

MeshScript.onObjectGrabbing


onObjectGrabEnd()

onObjectGrabEnd(_event): void

Defined in: src/core/Script.ts:258

Called when a hand stops grabbing this object. This ends built-in direct-touch manipulation without ending contact.

Parameters

_event

ObjectGrabEvent

Returns

void

Inherited from

MeshScript.onObjectGrabEnd


onObjectGrabStart()

onObjectGrabStart(_event): void

Defined in: src/core/Script.ts:249

Called when a hand starts grabbing this object (touching + pinching). A grab starts built-in direct-touch manipulation when enabled.

Parameters

_event

ObjectGrabEvent

Returns

void

Inherited from

MeshScript.onObjectGrabStart


onObjectLongSelect()

onObjectLongSelect(_event): void

Defined in: src/core/Script.ts:203

Called once when a captured selection is held for the long-select delay. Manipulation captures do not emit this callback.

Parameters

_event

LongSelectEvent

The controller and completed hold duration. Call event.stopPropagation() to stop bubbling to ancestor Scripts.

Returns

void

Inherited from

MeshScript.onObjectLongSelect


onObjectManipulate()

onObjectManipulate(_event): void

Defined in: src/core/Script.ts:209

Called for each phase of an automatic object manipulation. Call event.stopPropagation() to stop bubbling. Calling preventDefault() on a start event suppresses the automatic action.

Parameters

_event

ManipulationEvent

Returns

void

Inherited from

MeshScript.onObjectManipulate


onObjectSelectEnd()

onObjectSelectEnd(_event): void

Defined in: src/core/Script.ts:196

Called when a source stops selecting the object this Script represents.

Parameters

_event

SelectEndEvent

The completed state and end reason. Call event.stopPropagation() to stop bubbling to ancestor Scripts.

Returns

void

Inherited from

MeshScript.onObjectSelectEnd


onObjectSelectStart()

onObjectSelectStart(_event): void

Defined in: src/core/Script.ts:190

Called when a source starts selecting the object this Script represents.

Parameters

_event

SelectEvent

event.target is the logical object and event.source.controller identifies the controller. Call event.stopPropagation() to stop bubbling to ancestor Scripts.

Returns

void

Inherited from

MeshScript.onObjectSelectStart


onObjectTouchEnd()

onObjectTouchEnd(_event): void

Defined in: src/core/Script.ts:244

Called when a hand's index finger stops touching this object. This ends the default selection lifecycle after the touch callback.

Parameters

_event

ObjectTouchEvent

Returns

void

Inherited from

MeshScript.onObjectTouchEnd


onObjectTouching()

onObjectTouching(_event): void

Defined in: src/core/Script.ts:239

Called every frame that a hand's index finger is touching this object. The object remains selected during these frames unless touch selection was prevented when contact started.

Parameters

_event

ObjectTouchEvent

Returns

void

Inherited from

MeshScript.onObjectTouching


onObjectTouchStart()

onObjectTouchStart(_event): void

Defined in: src/core/Script.ts:233

Called when a hand's index finger starts touching this object. Direct touch starts the object's selection lifecycle by default. Call event.preventDefault() to handle contact without selecting.

Parameters

_event

ObjectTouchStartEvent

Returns

void

Inherited from

MeshScript.onObjectTouchStart


onSelect()

onSelect(_event): void

Defined in: src/core/Script.ts:144

Called whenever pinch / mouse click successfully completes, globally.

Parameters

_event

SelectEvent

The interaction source and completed target.

Returns

void

Inherited from

MeshScript.onSelect


onSelectEnd()

onSelectEnd(_event): void

Defined in: src/core/Script.ts:138

Called whenever pinch / mouse click discontinues, globally.

Parameters

_event

SelectEndEvent

The completed state and end reason.

Returns

void

Inherited from

MeshScript.onSelectEnd


onSelecting()

onSelecting(_event): void

Defined in: src/core/Script.ts:149

Called whenever pinch / mouse click is happening, globally.

Parameters

_event

SelectEvent

Returns

void

Inherited from

MeshScript.onSelecting


onSelectStart()

onSelectStart(_event): void

Defined in: src/core/Script.ts:132

Called whenever pinch / mouse click starts, globally.

Parameters

_event

SelectEvent

The interaction source and optional captured target.

Returns

void

Inherited from

MeshScript.onSelectStart


onSimulatorStarted()

onSimulatorStarted(): void

Defined in: src/core/Script.ts:124

Returns

void

Inherited from

MeshScript.onSimulatorStarted


onSqueeze()

onSqueeze(_event): void

Defined in: src/core/Script.ts:181

Called whenever gamepad trigger successfully completes, globally.

Parameters

_event

SelectEvent

event.source.controller identifies the controller.

Returns

void

Inherited from

MeshScript.onSqueeze


onSqueezeEnd()

onSqueezeEnd(_event): void

Defined in: src/core/Script.ts:170

Called whenever gamepad trigger stops, globally.

Parameters

_event

SelectEvent

event.source.controller identifies the controller.

Returns

void

Inherited from

MeshScript.onSqueezeEnd


onSqueezeStart()

onSqueezeStart(_event): void

Defined in: src/core/Script.ts:165

Called whenever gamepad trigger starts, globally.

Parameters

_event

SelectEvent

event.source.controller identifies the controller.

Returns

void

Inherited from

MeshScript.onSqueezeStart


onSqueezing()

onSqueezing(_event): void

Defined in: src/core/Script.ts:175

Called whenever gamepad is being triggered, globally.

Parameters

_event

SelectEvent

Returns

void

Inherited from

MeshScript.onSqueezing


onXRSessionEnded()

onXRSessionEnded(): void

Defined in: src/core/Script.ts:122

Returns

void

Inherited from

MeshScript.onXRSessionEnded


onXRSessionStarted()

onXRSessionStarted(_session?): void

Defined in: src/core/Script.ts:121

Parameters

_session?

XRSession

Returns

void

Inherited from

MeshScript.onXRSessionStarted


physicsStep()

physicsStep(): void

Defined in: src/core/Script.ts:119

Returns

void

Inherited from

MeshScript.physicsStep


raycast()

raycast(raycaster, intersects): boolean

Defined in: src/depth/DepthMesh.ts:390

Customizes raycasting to compute normals for intersections.

Parameters

raycaster

Raycaster

The raycaster object.

intersects

Intersection<Object3D<Object3DEventMap>>[]

Array to store intersections.

Returns

boolean

  • True if intersections are found.

Overrides

MeshScript.raycast


update()

update(_time?, _frame?): void

Defined in: src/core/Script.ts:113

Runs per frame.

Parameters

_time?

number

_frame?

XRFrame

Returns

void

Inherited from

MeshScript.update


updateDepth()

updateDepth(depthData, projectionMatrixInverse, depthDataFormat): void

Defined in: src/depth/DepthMesh.ts:145

Updates the depth data and geometry positions based on the provided camera and depth data.

Parameters

depthData

Readonly<XRCPUDepthInformation>

projectionMatrixInverse

Readonly<THREE.Matrix4>

depthDataFormat

XRDepthDataFormat

Returns

void


updateFullResolutionGeometry()

updateFullResolutionGeometry(depthData, depthDataFormat): void

Defined in: src/depth/DepthMesh.ts:223

Method to manually update the full resolution geometry. Only needed if options.updateFullResolutionGeometry is false.

Parameters

depthData

XRCPUDepthInformation

depthDataFormat

XRDepthDataFormat

Returns

void


updatePose()

updatePose(translation, quaternion): void

Defined in: src/depth/DepthMesh.ts:209

Parameters

translation

Vector3

quaternion

Quaternion

Returns

void