Skip to main content

Class: Depth

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

Constructors

Constructor

new Depth(): Depth

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

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:30


depthArray

depthArray: DepthArray[] = []

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


depthCameraPositions

depthCameraPositions: Vector3[] = []

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


depthCameraRotations

depthCameraRotations: Quaternion[] = []

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


depthDataFormat?

optional depthDataFormat: XRDepthDataFormat

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


depthMesh?

optional depthMesh: DepthMesh

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


depthProjectionInverseMatrices

depthProjectionInverseMatrices: Matrix4[] = []

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


depthProjectionMatrices

depthProjectionMatrices: Matrix4[] = []

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


depthViewMatrices

depthViewMatrices: Matrix4[] = []

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


depthViewProjectionMatrices

depthViewProjectionMatrices: Matrix4[] = []

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


enabled

enabled: boolean = false

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


gpuDepthData

gpuDepthData: XRWebGLDepthInformation[] = []

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


height

height: number = DEFAULT_DEPTH_HEIGHT

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


normDepthBufferFromNormViewMatrices

normDepthBufferFromNormViewMatrices: Matrix4[] = []

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

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:47


options

options: DepthOptions

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


view

view: XRView[] = []

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


width

width: number = DEFAULT_DEPTH_WIDTH

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


instance?

static optional instance: Depth

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

Accessors

rawValueToMeters

Get Signature

get rawValueToMeters(): number

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

Returns

number

Methods

debugLog()

debugLog(): void

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

Returns

void


getDepth()

getDepth(u, v): number

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

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.

v

number

Normalized vertical coordinate.

Returns

number

Depth value at the specified coordinates.


getProjectedDepthViewPositionFromWorldPosition()

getProjectedDepthViewPositionFromWorldPosition(position, target): Vector3

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

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:367

Parameters

viewId

number

Returns

ExternalTexture | DataTexture | undefined


getVertex()

getVertex(u, v): Vector3 | null

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

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.

v

number

Normalized vertical coordinate.

Returns

Vector3 | null

Vertex at (u, v)


init()

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

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

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:482

Parameters

client

object

Returns

void


renderOcclusionPass()

renderOcclusionPass(): void

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

Returns

void


resumeDepth()

resumeDepth(client): void

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

Parameters

client

object

Returns

void


update()

update(frame?): void

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

Parameters

frame?

XRFrame

Returns

void


updateCPUDepthData()

updateCPUDepthData(depthData, viewId, depthDataFormat): void

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

Parameters

depthData

XRCPUDepthInformation

viewId

number

depthDataFormat

XRDepthDataFormat

Returns

void


updateFullResolutionDepthMesh()

updateFullResolutionDepthMesh(): void

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

Manually updates the depth mesh geometry using the cached depth.

Returns

void


updateGPUDepthData()

updateGPUDepthData(depthData, viewId): void

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

Parameters

depthData

XRWebGLDepthInformation

viewId

number

Returns

void


updateLocalDepth()

updateLocalDepth(frame): void

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

Parameters

frame

XRFrame

Returns

void