MutableVertexData

class MutableVertexData(val positions: MutableList<Vector3> = mutableListOf(), val textureCoords: MutableList<Vector2> = mutableListOf(), val colors: MutableList<ColorRGBa> = mutableListOf(), val normals: MutableList<Vector3> = mutableListOf(), val tangents: MutableList<Vector3> = mutableListOf(), val bitangents: MutableList<Vector3> = mutableListOf()) : IVertexData(source)

Mutable 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 with mutable backing lists. It allows modification of vertex data.

This class implements the IVertexData interface, enabling conversion between mutable and immutable representations of vertex data.

Constructors

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

Creates a MutableVertexData object with optional initial data provided as mutable lists for positions, texture coordinates, colors, normals, tangents, and bitangents.

Properties

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

Mutable list of vertex bitangents as Vector3.

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

Mutable list of vertex colors as ColorRGBa.

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

Mutable list of vertex normals as Vector3.

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

Mutable list of vertex positions as Vector3.

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

Mutable list of vertex tangents as Vector3.

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

Mutable list of 2D texture coordinates as Vector2.

Functions

Link copied to clipboard

Adds a Point to the vertex data by updating the corresponding mutable lists of vertex attributes. Each optional attribute of the point is only added if it is not null.

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 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.