# VertexLayout

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

*** ** * ** ***


```
class VertexLayout
```

<br />

*** ** * ** ***

Layout of a vertex, composed of multiple buffer layouts.

A `VertexLayout` describes the complete structure of vertices in a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/MeshBuffer`, which may span across multiple vertex buffers.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#buffers()` is empty, if the layout does not contain a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute#POSITION()` attribute, if it contains duplicate attributes, or if only one of `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute#BONE_INDICES()` or `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute#BONE_WEIGHTS()` is present. |

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout`. |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#getBufferIndex(androidx.xr.scenecore.VertexAttribute)(attribute: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute)` Returns the index of the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout` containing the specified `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute` in the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#buffers()` list. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#getBufferIndex(androidx.xr.scenecore.VertexBufferLayout)(bufferLayout: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout)` Returns the index of the specified `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout` in the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#buffers()` list. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout>` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#buffers()` List of `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout`s defining the vertex layout. |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### getBufferIndex

Added in [1.1.0-alpha01](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.1.0-alpha01)

```
fun getBufferIndex(attribute: VertexAttribute): Int
```

Returns the index of the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout` containing the specified `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute` in the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#buffers()` list.

This is a convenience method that allows for chained, shorter syntax.

**Example:**

```kotlin
meshBuffer.updateVertexData(
    bufferIndex = vertexLayout.getBufferIndex(VertexAttribute.POSITION),
    vertexData = positionData
)
```

| Parameters |
|---|---|
| `attribute: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexAttribute` to find. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The 0-based index of the buffer containing the attribute. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the attribute is not present in the layout. |

### getBufferIndex

Added in [1.1.0-alpha01](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.1.0-alpha01)

```
fun getBufferIndex(bufferLayout: VertexBufferLayout): Int
```

Returns the index of the specified `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout` in the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexLayout#buffers()` list.

This is a convenience method that allows for chained, shorter syntax.

**Example:**

```kotlin
meshBuffer.updateVertexData(
    bufferIndex = vertexLayout.getBufferIndex(bufferLayout),
    vertexData = bufferData
)
```

| Parameters |
|---|---|
| `bufferLayout: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout` to find. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The 0-based index of the buffer layout. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the buffer layout is not present in the layout. |

### hashCode

```
open fun hashCode(): Int
```

### toString

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

## Public properties

### buffers

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

```
val buffers: List<VertexBufferLayout>
```

List of `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/VertexBufferLayout`s defining the vertex layout.