VertexLayout


class VertexLayout


Layout of a vertex, composed of multiple buffer layouts.

A VertexLayout describes the complete structure of vertices in a MeshBuffer, which may span across multiple vertex buffers.

Throws
IllegalArgumentException

if buffers is empty, if the layout does not contain a VertexAttribute.POSITION attribute, if it contains duplicate attributes, or if only one of VertexAttribute.BONE_INDICES or VertexAttribute.BONE_WEIGHTS is present.

Summary

Nested types

Builder for VertexLayout.

Public functions

open operator Boolean
equals(other: Any?)
Int

Returns the index of the VertexBufferLayout containing the specified VertexAttribute in the buffers list.

Int

Returns the index of the specified VertexBufferLayout in the buffers list.

open Int
open String

Public properties

List<VertexBufferLayout>

List of VertexBufferLayouts defining the vertex layout.

Public functions

equals

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

getBufferIndex

Added in 1.1.0-alpha01
fun getBufferIndex(attribute: VertexAttribute): Int

Returns the index of the VertexBufferLayout containing the specified VertexAttribute in the buffers list.

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

Example:

meshBuffer.updateVertexData(
bufferIndex = vertexLayout.getBufferIndex(VertexAttribute.POSITION),
vertexData = positionData
)
Parameters
attribute: VertexAttribute

The VertexAttribute to find.

Returns
Int

The 0-based index of the buffer containing the attribute.

Throws
IllegalArgumentException

if the attribute is not present in the layout.

getBufferIndex

Added in 1.1.0-alpha01
fun getBufferIndex(bufferLayout: VertexBufferLayout): Int

Returns the index of the specified VertexBufferLayout in the buffers list.

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

Example:

meshBuffer.updateVertexData(
bufferIndex = vertexLayout.getBufferIndex(bufferLayout),
vertexData = bufferData
)
Parameters
bufferLayout: VertexBufferLayout

The VertexBufferLayout to find.

Returns
Int

The 0-based index of the buffer layout.

Throws
IllegalArgumentException

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
val buffers: List<VertexBufferLayout>

List of VertexBufferLayouts defining the vertex layout.