Skip to content

@tmrw-realityos/charmDocs


@tmrw-realityos/charm / readDepthTexture

Function: readDepthTexture()

readDepthTexture(context, depthTexture, pixelCoordinates, flipY): Promise<Float32Array>

Read pixel values from a depth texture

Parameters

context: WebGPURenderContext

Rendering context

depthTexture: GPUTexture

Depth texture to read from, must be created with GPUTextureUsage.TEXTURE_BINDING. Can be multisampled.

pixelCoordinates: vec3[] | [number, number][] | [number, number, number][] | vec2[]

Array of coordinates to read

flipY: boolean = false

Flip the y pixel coordinate

Returns

Promise<Float32Array>

Array of length pixelCoordinates.length containing the depth texture values

Defined in

packages/charm/src/graphics/WebGPU/WebGPUTextureTools.ts:131