API reference
API reference
Select your platform
No SDKs available
No versions available

SceneMesh

SceneMesh

class SceneMesh
SceneMesh combines SceneMaterials with geometry to create a textured 3D Object. Geometries can come from:
  1. glb/gltf files
  2. Generated geometries from SceneMesh Companion Object.
A SceneMesh is the asset form of a mesh. A SceneObject is an instance of a SceneMesh that is usually attached to an entity.
SceneMesh provides functionality for creating, manipulating, and rendering 3D geometry with materials. It supports various primitive shapes (box, sphere, quad, etc.) as well as loading 3D models from files.

Constructors

NameSummary
SceneMesh
constructor(handle: Long)constructor(filename: String, defaultShaderOverride: String, defaultSceneOverride: Int = -1)

Types

NameSummary
Companion
object Companion

Properties

NameSummary
animationNameToTrack
val animationNameToTrack: Map<String, Int>
associatedFiles
var associatedFiles: Array<<Error class: unknown class>>?
handle
var handle: Long
materials
var materials: Array<SceneMaterial>?
nodeNameToId
val nodeNameToId: Map<String, Int>

Functions

NameSummary
calculateNodeGlobalMatrix
fun calculateNodeGlobalMatrix(index: Int): Matrix44

Calculates the global transformation matrix of a node.
computeCombinedBounds
fun computeCombinedBounds(): Bound3D

Computes the combined bounding box of all geometry in this mesh.
destroy
fun destroy()
getAnimationTracks
fun getAnimationTracks(): Array<AnimationTrack>

Gets all animation tracks defined in this mesh.
getMaterial
fun getMaterial(index: Int): SceneMaterial?

Gets a material from this mesh by index. This material is the "parent" of any SceneObjects instanced from this mesh. Any changes to attributes will apply to the non-overridden properties of the child materials.



fun getMaterial(material: String): SceneMaterial?

Gets a material by name. This material is the "parent" of any SceneObjects instanced from this mesh. Any changes to attributes will apply to the non-overridden properties of the child materials.
fun getMaterialIndex(material: String): Int

Gets the index of a material by name.
getMaterialIndexForNodeMeshElement
fun getMaterialIndexForNodeMeshElement(nodeId: Int, meshElementId: Int): Int

Gets the material index for a specific node and mesh element.
getMaterialName
fun getMaterialName(materialIndex: Int): String

Gets the name of a material by index.
getNodeCount
fun getNodeCount(): Int

Gets the number of nodes in this mesh.
getNodeLocalMatrix
fun getNodeLocalMatrix(index: Int): Matrix44

Gets the local transformation matrix of a node.
getNodeName
fun getNodeName(index: Int): String

Gets the name of a node by index.
updateCylinderSurface
fun updateCylinderSurface(radius: Float, height: Float, fractionOfCircle: Float)

Updates the geometry of a cylinder surface mesh.
updateWithTriangleMesh
fun updateWithTriangleMesh(triMesh: TriangleMesh, updateBVH: Boolean = false)

Updates this mesh with geometry from a triangle mesh.

Companion

object Companion

Functions

NameSummary
axis
fun axis(size: Float, thickness: Float, material: SceneMaterial): SceneMesh

Creates a coordinate axis visualization mesh.
box
fun box(min: Vector3, max: Vector3, material: SceneMaterial): SceneMesh

Creates a box mesh with the specified bounds and material.



fun box(minx: Float, miny: Float, minz: Float, maxx: Float, maxy: Float, maxz: Float, material: SceneMaterial): SceneMesh

Creates a box mesh with the specified dimensions and material.
cylinderSurface
fun cylinderSurface(radius: Float, height: Float, fractionOfCircle: Float, material: SceneMaterial, materialBack: SceneMaterial? = null): SceneMesh

Creates a portion of a cylinder centered at (0, 0, 0) that is a single sided surface facing inwards. This cylinder is symmetric about the XZ plane.
dome
fun dome(radius: Float, material: SceneMaterial): SceneMesh

Creates a dome mesh (half-sphere) with the specified radius and material.
equirectSurface
fun equirectSurface(radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, material: SceneMaterial): SceneMesh

Creates an inward portion of a sphere centered at (0, 0, 0). Uses a parameterization similar to OpenXR’s equirect2 layers.
fromTriangleMesh
fun fromTriangleMesh(mesh: TriangleMesh, createBVH: Boolean): SceneMesh

Creates a mesh from a triangle mesh.
loadLocalFile
fun loadLocalFile(filename: String, defaultShaderOverride: String = "", defaultSceneOverride: Int = -1): SceneMesh

Loads a 3D model from a glTF file.
meshWithMaterials
fun meshWithMaterials(positions: FloatArray, normals: FloatArray, uvs: FloatArray, colors: IntArray, indices: IntArray, materialRanges: IntArray, materials: Array<SceneMaterial>, createBVH: Boolean): SceneMesh

Creates a custom mesh with the specified geometry data and materials.



fun meshWithMaterials(positions: FloatArray, normals: FloatArray, uvs: FloatArray, uv1s: FloatArray, colors: IntArray, indices: IntArray, materialRanges: IntArray, materials: Array<SceneMaterial>, createBVH: Boolean): SceneMesh
panel
fun panel(min: Vector3, max: Vector3, edgeRadius: Vector3, materialPanel: SceneMaterial, materialGlass: SceneMaterial): SceneMesh

Creates a panel mesh with a glass frame.
quad
fun quad(min: Vector3, max: Vector3, material: SceneMaterial): SceneMesh

Creates a single-sided quad (flat rectangle) mesh with the specified bounds and material.
roundedBox
fun roundedBox(min: Vector3, max: Vector3, edgeRadius: Vector3, material: SceneMaterial): SceneMesh

Creates a box with rounded corners.
singleSidedQuad
fun singleSidedQuad(halfWidth: Float, halfHeight: Float, material: SceneMaterial): SceneMesh

Creates a single-sided quad mesh with the specified dimensions and material.
skybox
fun skybox(radius: Float, material: SceneMaterial): SceneMesh

Creates a skybox mesh with the specified radius and material.
sphere
fun sphere(radius: Float, material: SceneMaterial): SceneMesh

Creates a sphere mesh with the specified radius and material.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon