Skip to content

@tmrw-realityos/charm


@tmrw-realityos/charm / readDepthTexture

Function: readDepthTexture()

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

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

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

Array of coordinates to read

vec3[] | [number, number][] | [number, number, number][] | vec2[]

flipY

boolean = false

Flip the y pixel coordinate

Returns

Promise<Float32Array<ArrayBufferLike>>

Array of length pixelCoordinates.length containing the depth texture values