CustomMesh


class CustomMesh : AutoCloseable


A resource that defines the structure of a renderable mesh.

A CustomMesh is composed of a MeshBuffer and a list of MeshSubsets. Each MeshSubset defines a part of the mesh that can be rendered with a single Material.

Summary

Nested types

Builder for CustomMesh using an existing MeshBuffer.

Builder for CustomMesh providing raw data directly.

Public functions

open Unit

Closes the given CustomMesh.

Public properties

BoundingBox

Bounding box of the mesh, used for culling.

MeshBuffer

The MeshBuffer containing the vertex and index data for this mesh.

List<MeshSubset>

The list of MeshSubsets defining the parts of the mesh.

Public functions

close

Added in 1.0.0
@MainThread
open fun close(): Unit

Closes the given CustomMesh.

The CustomMesh can be explicitly closed at anytime or garbage collected. An exception will be thrown if the CustomMesh is used after being closed.

Throws
IllegalStateException

if the resource has already been closed.

Public properties

bounds

Added in 1.0.0
var bounds: BoundingBox

Bounding box of the mesh, used for culling.

It is an axis-aligned bounding box in the mesh's local coordinate space. It does not need to be tightly fit to the mesh, but tighter bounds will result in more efficient culling.

When the vertex positions are dynamically updated in the underlying MeshBuffer, this culling volume is not automatically recalculated on the CPU to avoid expensive synchronization or active memory copies. Instead, the application can manually set this property to specify the updated bounds.

The setter for this property must be called on the main thread.

Throws
IllegalStateException

if the property is set after this mesh has been closed.

meshBuffer

Added in 1.0.0
val meshBuffer: MeshBuffer

The MeshBuffer containing the vertex and index data for this mesh.

subsets

Added in 1.0.0
val subsets: List<MeshSubset>

The list of MeshSubsets defining the parts of the mesh.