# Depth

Artifact: [androidx.xr.arcore:arcore](https://developer.android.com/jetpack/androidx/releases/xr-arcore) [View Source](https://cs.android.com/search?q=file:androidx/xr/arcore/Depth.kt+class:androidx.xr.arcore.Depth) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

*** ** * ** ***


```
class Depth
```

<br />

*** ** * ** ***

Depth information corresponding to a specific `https://developer.android.com/reference/kotlin/androidx/xr/arcore/RenderViewpoint`.

The availability of depth data depends on the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode`. Depth Maps can include smooth, `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#SMOOTH_ONLY()`, raw, `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#RAW_ONLY()`, or both, `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#SMOOTH_AND_RAW()`, postprocessing options depending on the runtime.

This also allows depth to be turned off by setting it to `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#DISABLED()`.

The mode is set in a `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session#config()` that is passed to `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session#configure(androidx.xr.runtime.Config)`.

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 `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#SMOOTH_AND_RAW()`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth.State` Contains the current state of depth tracking. |

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth#left(androidx.xr.runtime.Session)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session)` Returns the Depth data associated with the left display. |
| `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth#mono(androidx.xr.runtime.Session)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session)` Returns the Depth associated with the single device display. |
| `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth#right(androidx.xr.runtime.Session)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session)` Returns the Depth data associated with the right display. |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth#toString()()` Returns a string representation of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth` for debugging. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth.State>` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth#state()` the current `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth.State` of the depth data |

## Public companion functions

### left

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

```
fun left(session: Session): Depth
```

Returns the Depth data associated with the left display.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | the currently active `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Config#depthEstimation()` is set to `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#DISABLED()` or if the device does not support `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode#STEREO()` |

### mono

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

```
fun mono(session: Session): Depth
```

Returns the Depth associated with the single device display.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | the currently active `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session#config()` has `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode` set to DISABLED or if device does not support `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode#MONO()` |

### right

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

```
fun right(session: Session): Depth
```

Returns the Depth data associated with the right display.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | the currently active `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Config#depthEstimation()` is set to `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode#DISABLED()` or if the device does not support `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode#STEREO()` |

## Public functions

### toString

```
open fun toString(): String
```

Returns a string representation of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth` for debugging.

Note: Not intended for production use.

## Public properties

### state

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

```
val state: StateFlow<Depth.State>
```

the current `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Depth.State` of the depth data