VertexData

class VertexData(val positions: List<Vector3> = emptyList(), val textureCoords: List<Vector2> = emptyList(), val colors: List<ColorRGBa> = emptyList(), val normals: List<Vector3> = emptyList(), val tangents: List<Vector3> = emptyList(), val bitangents: List<Vector3> = emptyList()) : IVertexData(source)

Immutable implementation of vertex data for 3D graphics. This class provides a container for vertex attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.

It implements the IVertexData interface, allowing easy conversion between immutable and mutable representations of vertex data.

Constructors

Link copied to clipboard
constructor(positions: List<Vector3> = emptyList(), textureCoords: List<Vector2> = emptyList(), colors: List<ColorRGBa> = emptyList(), normals: List<Vector3> = emptyList(), tangents: List<Vector3> = emptyList(), bitangents: List<Vector3> = emptyList())

Properties

Link copied to clipboard
open override val bitangents: List<Vector3>

List of vertex bitangents as Vector3.

Link copied to clipboard
open override val colors: List<ColorRGBa>

List of vertex colors as ColorRGBa.

Link copied to clipboard
open override val normals: List<Vector3>

List of vertex normals as Vector3.

Link copied to clipboard
open override val positions: List<Vector3>

List of vertex positions as Vector3.

Link copied to clipboard
open override val tangents: List<Vector3>

List of vertex tangents as Vector3.

Link copied to clipboard
open override val textureCoords: List<Vector2>

List of 2D texture coordinates as Vector2.

Functions

Link copied to clipboard
operator fun IVertexData.get(index: Int, textureCoordsIndex: Int = index, colorsIndex: Int = index, normalsIndex: Int = index, tangentsIndex: Int = index, bitangentsIndex: Int = index): Point

Retrieves a Point instance from the vertex data at the specified indices. The indices allow access to positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard

Converts the vertex data into a MeshData representation by constructing the indexed polygons based on the vertex data attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard

Converts the vertex data represented by the current instance into a mutable MutableVertexData object. This includes attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard
fun IVertexData.toVertexBuffer(elementOffset: Int = 0, vertexBuffer: VertexBuffer? = null): VertexBuffer

Converts the vertex data stored in the IVertexData instance to a VertexBuffer. The method iterates through the vertex attributes such as positions, normals, texture coordinates, and colors, and writes them sequentially into the provided or newly created VertexBuffer. Missing attributes are substituted with default values.

Link copied to clipboard
open override fun toVertexData(): VertexData

Converts the vertex data represented by the current instance into an immutable VertexData object. This includes attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.