VertexLayout


public final 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

public final class VertexLayout.Builder

Builder for VertexLayout.

Public methods

boolean
equals(Object other)
final int

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

final int

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

final @NonNull List<@NonNull VertexBufferLayout>

List of VertexBufferLayouts defining the vertex layout.

int
@NonNull String

Public methods

equals

public boolean equals(Object other)

getBufferIndex

Added in 1.1.0-alpha01
public final int getBufferIndex(@NonNull VertexAttribute attribute)

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
@NonNull VertexAttribute attribute

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
public final int getBufferIndex(@NonNull VertexBufferLayout bufferLayout)

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
@NonNull VertexBufferLayout bufferLayout

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.

getBuffers

Added in 1.0.0
public final @NonNull List<@NonNull VertexBufferLayout> getBuffers()

List of VertexBufferLayouts defining the vertex layout.

hashCode

public int hashCode()

toString

public @NonNull String toString()