Skip to main content

Class: Depth

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

Constructors​

Constructor​

new Depth(): Depth

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

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

Returns​

Depth

Properties​

cpuDepthData​

cpuDepthData: XRCPUDepthInformation[] = []

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


depthArray​

depthArray: DepthArray[] = []

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


depthCameraPositions​

depthCameraPositions: Vector3[] = []

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


depthCameraRotations​

depthCameraRotations: Quaternion[] = []

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


depthDataFormat?​

optional depthDataFormat: XRDepthDataFormat

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


depthMesh?​

optional depthMesh: DepthMesh

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


depthProjectionInverseMatrices​

depthProjectionInverseMatrices: Matrix4[] = []

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


depthProjectionMatrices​

depthProjectionMatrices: Matrix4[] = []

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


depthViewMatrices​

depthViewMatrices: Matrix4[] = []

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


depthViewProjectionMatrices​

depthViewProjectionMatrices: Matrix4[] = []

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


enabled​

enabled: boolean = false

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


gpuDepthData​

gpuDepthData: XRWebGLDepthInformation[] = []

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


height​

height: number = DEFAULT_DEPTH_HEIGHT

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


normDepthBufferFromNormViewMatrices​

normDepthBufferFromNormViewMatrices: Matrix4[] = []

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

Transforms from normalized view coordinates to normalized depth buffer coordinates. Identity when matchDepthView is true.


occludableShaders​

occludableShaders: Set<Shader>

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


options​

options: DepthOptions

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


view​

view: XRView[] = []

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


width​

width: number = DEFAULT_DEPTH_WIDTH

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


instance?​

static optional instance: Depth

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

Accessors​

rawValueToMeters​

Get Signature​

get rawValueToMeters(): number

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

Returns​

number

Methods​

debugLog()​

debugLog(): void

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

Returns​

void


dispose()​

dispose(): void

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

Releases depth resources at terminal Core teardown, not on XR exit.

Returns​

void


getDepth()​

getDepth(u, v): number

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

Retrieves the depth at normalized coordinates (u, v). Note: The UV coordinates are with respect to the user's view, not the depth camera view.

Parameters​

u​

number

Normalized horizontal coordinate, origin at the bottom left of the view, growing right.

v​

number

Normalized vertical coordinate, origin at the bottom left of the view, growing up.

Returns​

number

Depth value at the specified coordinates.


getProjectedDepthViewPositionFromWorldPosition()​

getProjectedDepthViewPositionFromWorldPosition(position, target): Vector3

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

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

Parameters​

position​

Vector3

The world position to project.

target​

Vector3 = ...

Returns​

Vector3

The depth camera view space position.


getTexture()​

getTexture(viewId): ExternalTexture | DataTexture | undefined

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

Parameters​

viewId​

number

Returns​

ExternalTexture | DataTexture | undefined


getVertex()​

getVertex(u, v): Vector3 | null

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

Retrieves the depth at normalized coordinates (u, v). Note: The UV coordinates are with respect to the user's view, not the depth camera view.

Parameters​

u​

number

Normalized horizontal coordinate, origin at the bottom left of the view, growing right.

v​

number

Normalized vertical coordinate, origin at the bottom left of the view, growing up.

Returns​

Vector3 | null

Vertex at (u, v)


init()​

init(camera, options, renderer, registry, scene): void | Promise<void>

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

Initialize Depth manager.

Parameters​

camera​

PerspectiveCamera

options​

DepthOptions

renderer​

WebGLOrWebGPURenderer

registry​

Registry

scene​

Scene

Returns​

void | Promise<void>


pauseDepth()​

pauseDepth(client): void

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

Parameters​

client​

object

Returns​

void


renderOcclusionPass()​

renderOcclusionPass(): void

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

Returns​

void


resumeDepth()​

resumeDepth(client): void

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

Parameters​

client​

object

Returns​

void


update()​

update(frame?): void

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

Parameters​

frame?​

XRFrame

Returns​

void


updateCPUDepthData()​

updateCPUDepthData(depthData, viewId, depthDataFormat): void

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

Parameters​

depthData​

XRCPUDepthInformation

viewId​

number

depthDataFormat​

XRDepthDataFormat

Returns​

void


updateFullResolutionDepthMesh()​

updateFullResolutionDepthMesh(): void

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

Manually updates the depth mesh geometry using the cached depth.

Returns​

void


updateGPUDepthData()​

updateGPUDepthData(depthData, viewId): void

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

Parameters​

depthData​

XRWebGLDepthInformation

viewId​

number

Returns​

void


updateLocalDepth()​

updateLocalDepth(frame): void

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

Parameters​

frame​

XRFrame

Returns​

void