public final class Depth


Contains the depth information corresponding to a specific RenderViewpoint for left eye, right eye, or mono view depending on what is supported by the runtime.

The availability of depth data depends on the DepthEstimationMode. Depth Maps can include smooth, DepthEstimationMode.SMOOTH_ONLY, raw, DepthEstimationMode.RAW_ONLY, or both, DepthEstimationMode.SMOOTH_AND_RAW, postprocessing options depending on the runtime.

This also allows depth to be turned off by setting it to DepthEstimationMode.DISABLED.

The mode is set in a Session.config that is passed to Session.configure.

Update frequency and the dimensions of the maps provided are system-defined. The buffer lifecycles are controlled by the runtime so if the data will not be used upon receiving, a copy should be made.

OpenXr does not support DepthEstimationMode.SMOOTH_AND_RAW.

Summary

Nested types

public final class Depth.State

Contains the current state of depth tracking.

Public methods

final @NonNull StateFlow<@NonNull Depth.State>

the current State of the depth data.

static final @NonNull Depth
left(@NonNull Session session)

Returns the Depth data associated with the left display.

static final @NonNull Depth
mono(@NonNull Session session)

Returns the Depth associated with the single device display.

static final @NonNull Depth
right(@NonNull Session session)

Returns the Depth data associated with the right display.

Public methods

getState

Added in 1.0.0-alpha15
public final @NonNull StateFlow<@NonNull Depth.StategetState()

the current State of the depth data.

left

Added in 1.0.0-alpha15
public static final @NonNull Depth left(@NonNull Session session)

Returns the Depth data associated with the left display.

Parameters
@NonNull Session session

the currently active Session

mono

Added in 1.0.0-alpha15
public static final @NonNull Depth mono(@NonNull Session session)

Returns the Depth associated with the single device display.

Parameters
@NonNull Session session

the currently active Session

Throws
IllegalStateException

if Session.config has DepthEstimationMode set to DISABLED or if device does not support androidx.xr.runtime.RenderingMode.MONO

right

Added in 1.0.0-alpha15
public static final @NonNull Depth right(@NonNull Session session)

Returns the Depth data associated with the right display.

Parameters
@NonNull Session session

the currently active Session