Skip to main content

Class: Depth

Defined in: src/depth/Depth.ts:19

Constructors

Constructor

new Depth(): Depth

Defined in: src/depth/Depth.ts:50

Depth is a lightweight manager based on three.js to simply prototyping with Depth in WebXR.

Returns

Depth

Properties

depthArray

depthArray: DepthArray[] = []

Defined in: src/depth/Depth.ts:31


depthData

depthData: XRCPUDepthInformation[] = []

Defined in: src/depth/Depth.ts:30


depthMesh?

optional depthMesh: DepthMesh

Defined in: src/depth/Depth.ts:32


height

height: number = DEFAULT_DEPTH_HEIGHT

Defined in: src/depth/Depth.ts:36


occludableShaders

occludableShaders: Set<Shader>

Defined in: src/depth/Depth.ts:38


options

options: DepthOptions

Defined in: src/depth/Depth.ts:34


rawValueToMeters

rawValueToMeters: number = 0.0010000000474974513

Defined in: src/depth/Depth.ts:37


view

view: XRView[] = []

Defined in: src/depth/Depth.ts:29


width

width: number = DEFAULT_DEPTH_WIDTH

Defined in: src/depth/Depth.ts:35


instance?

static optional instance: Depth

Defined in: src/depth/Depth.ts:20

Methods

debugLog()

debugLog(): void

Defined in: src/depth/Depth.ts:266

Returns

void


getDepth()

getDepth(u, v): number

Defined in: src/depth/Depth.ts:96

Retrieves the depth at normalized coordinates (u, v).

Parameters

u

number

Normalized horizontal coordinate.

v

number

Normalized vertical coordinate.

Returns

number

Depth value at the specified coordinates.


getProjectedDepthViewPositionFromWorldPosition()

getProjectedDepthViewPositionFromWorldPosition(position, target): Vector3

Defined in: src/depth/Depth.ts:110

Projects the given world position to clip space and then to view space using the depth.

Parameters

position

Vector3

The world position to project.

target

Vector3 = ...

Returns

Vector3


getTexture()

getTexture(view_id): undefined | DataTexture

Defined in: src/depth/Depth.ts:178

Parameters

view_id

number

Returns

undefined | DataTexture


getVertex()

getVertex(u, v): null | Vector3

Defined in: src/depth/Depth.ts:131

Retrieves the depth at normalized coordinates (u, v).

Parameters

u

number

Normalized horizontal coordinate.

v

number

Normalized vertical coordinate.

Returns

null | Vector3

Vertex at (u, v)


init()

init(camera, options, renderer, registry, scene): void

Defined in: src/depth/Depth.ts:60

Initialize Depth manager.

Parameters

camera

PerspectiveCamera

options

DepthOptions

renderer

WebGLRenderer

registry

Registry

scene

Scene

Returns

void


pauseDepth()

pauseDepth(client): void

Defined in: src/depth/Depth.ts:282

Parameters

client

object

Returns

void


renderOcclusionPass()

renderOcclusionPass(): void

Defined in: src/depth/Depth.ts:245

Returns

void


resumeDepth()

resumeDepth(client): void

Defined in: src/depth/Depth.ts:277

Parameters

client

object

Returns

void


update()

update(frame): void

Defined in: src/depth/Depth.ts:183

Parameters

frame

XRFrame

Returns

void


updateDepthData()

updateDepthData(depthData, view_id): void

Defined in: src/depth/Depth.ts:146

Parameters

depthData

XRCPUDepthInformation

view_id

number = 0

Returns

void


updateLocalDepth()

updateLocalDepth(frame): void

Defined in: src/depth/Depth.ts:192

Parameters

frame

XRFrame

Returns

void