MeshGeometry

class MeshGeometry(val usage: Usage, val attributes: VertexAttributes, size: Int = INITIAL_SIZE, val grow: Boolean = false)

Holds vertex and index data that can be used to render to a mesh.

Author

Colton Daily

Constructors

Link copied to clipboard
fun MeshGeometry(usage: Usage, attributes: VertexAttributes, size: Int = INITIAL_SIZE, grow: Boolean = false)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun add(newVertices: FloatArray, srcOffset: Int = 0, dstOffset: Int = 0, count: Int = newVertices.size)

Add a list of existing vertices to the geometry.

Link copied to clipboard
fun addIndex(idx: Int)

Add an index.

Link copied to clipboard
fun addIndices(vararg indices: Int)
fun addIndices(indices: List<Int>)

Adds a list of indices.

Link copied to clipboard
fun addTriIndices(i0: Int, i1: Int, i2: Int)

Adds three indices as a "tri".

Link copied to clipboard
inline fun addVertex(action: VertexView.() -> Unit): Int

Add a single vertex to the geometry using a VertexView.

Link copied to clipboard
inline fun batchUpdate(rebuildBounds: Boolean = false, block: MeshGeometry.() -> Unit)

Mark this geometry as a batch update. This does nothing on its own. Use isBatchUpdate to handle.

Link copied to clipboard
fun clear()

Clears the vertices.

Link copied to clipboard

Clears the indices.

Link copied to clipboard
inline fun forEach(block: (VertexView) -> Unit)
Link copied to clipboard
operator fun get(i: Int): VertexView
Link copied to clipboard

Converts the array of indices based on a quad.

Link copied to clipboard

Converts the array of indices based on a triangle.

Link copied to clipboard
Link copied to clipboard
fun skip(totalVertices: Int)

This moves the current an X amount of vertices from the current vertex index. This takes into account the vertexSize.

Properties

Link copied to clipboard
Link copied to clipboard

Bounds of the mesh.

Link copied to clipboard

If the geometry has changed since last update.

Link copied to clipboard
val grow: Boolean = false
Link copied to clipboard
var indicesDirty: Boolean = false
Link copied to clipboard
var isBatchUpdate: Boolean = false

true if this is mid-batch update.

Link copied to clipboard
Link copied to clipboard
var numVertices: Int = 0
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var verticesDirty: Boolean = false