Skip to main content

Class: Depth

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

Constructors

Constructor

new Depth(): Depth

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

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


depthArray

depthArray: DepthArray[] = []

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


depthCameraPositions

depthCameraPositions: Vector3[] = []

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


depthCameraRotations

depthCameraRotations: Quaternion[] = []

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


depthMesh?

optional depthMesh: DepthMesh

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


depthProjectionInverseMatrices

depthProjectionInverseMatrices: Matrix4[] = []

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


depthProjectionMatrices

depthProjectionMatrices: Matrix4[] = []

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


depthViewMatrices

depthViewMatrices: Matrix4[] = []

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


depthViewProjectionMatrices

depthViewProjectionMatrices: Matrix4[] = []

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


enabled

enabled: boolean = false

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


gpuDepthData

gpuDepthData: XRWebGLDepthInformation[] = []

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


height

height: number = DEFAULT_DEPTH_HEIGHT

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


normDepthBufferFromNormViewMatrices

normDepthBufferFromNormViewMatrices: Matrix4[] = []

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

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


options

options: DepthOptions

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


view

view: XRView[] = []

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


width

width: number = DEFAULT_DEPTH_WIDTH

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


instance?

static optional instance: Depth

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

Accessors

rawValueToMeters

Get Signature

get rawValueToMeters(): number

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

Returns

number

Methods

debugLog()

debugLog(): void

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

Returns

void


getDepth()

getDepth(u, v): number

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

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

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): undefined | ExternalTexture | DataTexture

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

Parameters

viewId

number

Returns

undefined | ExternalTexture | DataTexture


getVertex()

getVertex(u, v): null | Vector3

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

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

null | Vector3

Vertex at (u, v)


init()

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

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

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

Parameters

client

object

Returns

void


renderOcclusionPass()

renderOcclusionPass(): void

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

Returns

void


resumeDepth()

resumeDepth(client): void

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

Parameters

client

object

Returns

void


update()

update(frame?): void

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

Parameters

frame?

XRFrame

Returns

void


updateCPUDepthData()

updateCPUDepthData(depthData, viewId): void

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

Parameters

depthData

XRCPUDepthInformation

viewId

number = 0

Returns

void


updateGPUDepthData()

updateGPUDepthData(depthData, viewId): void

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

Parameters

depthData

XRWebGLDepthInformation

viewId

number = 0

Returns

void


updateLocalDepth()

updateLocalDepth(frame): void

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

Parameters

frame

XRFrame

Returns

void