VertexBuffer

class VertexBuffer(nativeHandle: NativePointer)

Holds a set of buffers that define the geometry of a Renderable.

The geometry of the Renderable itself is defined by a set of vertex attributes such as position, color, normals, tangents, etc. There is no need to have a 1-to-1 mapping between attributes and buffer. A buffer can hold the data of several attributes—attributes are then referred to as being "interleaved".

The buffers themselves are GPU resources, therefore mutating their data can be relatively slow. For this reason, it is best to separate the constant data from the dynamic data into multiple buffers. It is possible, and even encouraged, to use a single vertex buffer for several Renderables.

See also

, RenderableManager

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard

Data types for vertex attributes.

Link copied to clipboard
class Builder

Builder for creating VertexBuffer instances.

Link copied to clipboard

Vertex attribute types that can be defined in a VertexBuffer.

Properties

Link copied to clipboard

Returns whether the asynchronous creation of this VertexBuffer has completed; always true when it wasn't built with Builder.async().

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

Gets the number of vertices in each buffer of this set.

Functions

Link copied to clipboard
fun setBufferAt(engine: Engine, bufferIndex: Int, data: ByteArray)

Sets the data for a given buffer in this vertex buffer set.

fun setBufferAt(engine: Engine, bufferIndex: Int, data: ByteArray, destOffsetInBytes: Int, count: Int)

Sets the data for a given buffer with offset and count.

fun setBufferAt(engine: Engine, bufferIndex: Int, data: ByteArray, destOffsetInBytes: Int, count: Int, callback: () -> Unit? = null)

Sets the data for a given buffer with offset, count, and optional completion callback.

Link copied to clipboard
fun setBufferAtAsync(engine: Engine, bufferIndex: Int, data: ByteArray, destOffsetInBytes: Int = 0, count: Int = 0, callback: (VertexBuffer, AsyncCallStatus) -> Unit? = null): Int

setBufferAt, asynchronously: returns an ID for Engine.cancelAsyncCall, and callback runs once on the main thread with how it ended. Needs Engine.isAsynchronousModeEnabled.

Link copied to clipboard
fun setBufferObjectAt(engine: Engine, bufferIndex: Int, bufferObject: BufferObject)

Associates a BufferObject with a buffer in this vertex buffer set.

Link copied to clipboard
fun setBufferObjectAtAsync(engine: Engine, bufferIndex: Int, bufferObject: BufferObject, callback: (VertexBuffer, AsyncCallStatus) -> Unit? = null): Int

setBufferObjectAt, asynchronously; see setBufferAtAsync.