# 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)

*** ** * ** ***


```
public final 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/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/androidx/xr/scenecore/VertexLayout#buffers()` is empty, if the layout does not contain a `https://developer.android.com/reference/androidx/xr/scenecore/VertexAttribute#POSITION()` attribute, if it contains duplicate attributes, or if only one of `https://developer.android.com/reference/androidx/xr/scenecore/VertexAttribute#BONE_INDICES()` or `https://developer.android.com/reference/androidx/xr/scenecore/VertexAttribute#BONE_WEIGHTS()` is present. |

## Summary

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

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final int` | `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#getBufferIndex(androidx.xr.scenecore.VertexAttribute)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/VertexAttribute attribute)` Returns the index of the `https://developer.android.com/reference/androidx/xr/scenecore/VertexBufferLayout` containing the specified `https://developer.android.com/reference/androidx/xr/scenecore/VertexAttribute` in the `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#buffers()` list. |
| `final int` | `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#getBufferIndex(androidx.xr.scenecore.VertexBufferLayout)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/VertexBufferLayout bufferLayout)` Returns the index of the specified `https://developer.android.com/reference/androidx/xr/scenecore/VertexBufferLayout` in the `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#buffers()` list. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/VertexBufferLayout>` | `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#getBuffers()()` List of `https://developer.android.com/reference/androidx/xr/scenecore/VertexBufferLayout`s defining the vertex layout. |
| `int` | `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/xr/scenecore/VertexLayout#toString()()` |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getBufferIndex

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

```
public final int getBufferIndex(@NonNull VertexAttribute attribute)
```

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

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

**Example:**

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

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

| Returns |
|---|---|
| `int` | 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)

```
public final int getBufferIndex(@NonNull VertexBufferLayout bufferLayout)
```

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

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

**Example:**

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

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

| Returns |
|---|---|
| `int` | 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. |

### getBuffers

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

```
public final @NonNull List<@NonNull VertexBufferLayout> getBuffers()
```

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

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```