class SceneMesh
SceneMesh
(
handle
)
| |
SceneMesh
(
filename
, defaultShaderOverride
, defaultSceneOverride
)
|
Signature
constructor(filename: String, defaultShaderOverride: String, defaultSceneOverride: Int = -1) Parameters filename: StringdefaultShaderOverride: StringdefaultSceneOverride: IntReturns SceneMesh |
animationNameToTrack
: Map
[Get] |
Signature
val animationNameToTrack: Map<String, Int> |
associatedFiles
: Array?
[Get] |
Signature
var associatedFiles: Array |
handle
: Long
[Get] |
Signature
var handle: Long |
materials
: Array?
[Get] |
Signature
var materials: Array<SceneMaterial>? |
nodeNameToId
: Map
[Get] |
Signature
val nodeNameToId: Map<String, Int> |
calculateNodeGlobalMatrix
(
index
)
|
Calculates the global transformation matrix of a node.
Signature
fun calculateNodeGlobalMatrix(index: Int): Matrix44 Parameters index: Int
The index of the node
|
computeCombinedBounds
()
|
Computes the combined bounding box of all geometry in this mesh.
Signature
fun computeCombinedBounds(): Bound3D |
destroy
()
|
Signature
fun destroy() |
getAnimationTracks
()
|
Gets all animation tracks defined in this mesh.
Signature
fun getAnimationTracks(): Array<AnimationTrack> Returns Array
An array of animation tracks
|
getMaterial
(
index
)
|
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.
If you know the name of the material, you can get the index from SceneMesh.getMaterialIndex()
Signature
fun getMaterial(index: Int): SceneMaterial? Parameters index: Int
The index of the material to get
|
getMaterial
(
material
)
|
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.
Signature
fun getMaterial(material: String): SceneMaterial? Parameters material: String
The name of the material to find
|
getMaterialIndex
(
material
)
|
Gets the index of a material by name.
Signature
fun getMaterialIndex(material: String): Int Parameters material: String
The name of the material to find
Returns Int
The index of the material, or -1 if not found
|
getMaterialIndexForNodeMeshElement
(
nodeId
, meshElementId
)
|
Gets the material index for a specific node and mesh element.
Signature
fun getMaterialIndexForNodeMeshElement(nodeId: Int, meshElementId: Int): Int Parameters nodeId: Int
The ID of the node
meshElementId: Int
The ID of the mesh element
Returns Int
The index of the material used by the specified node and mesh element
|
getMaterialName
(
materialIndex
)
|
Gets the name of a material by index.
Signature
fun getMaterialName(materialIndex: Int): String Parameters materialIndex: Int
The index of the material
Returns String
The name of the material
|
getNodeCount
()
|
Gets the number of nodes in this mesh.
Signature
fun getNodeCount(): Int Returns Int
The number of nodes
|
getNodeIndex
(
name
)
|
Gets the index of a node by name.
Signature
fun getNodeIndex(name: String): Int Parameters name: String
The name of the node to find
Returns Int
The index of the node, or -1 if not found
|
getNodeLocalMatrix
(
index
)
|
Gets the local transformation matrix of a node.
Signature
fun getNodeLocalMatrix(index: Int): Matrix44 Parameters index: Int
The index of the node
|
getNodeName
(
index
)
|
Gets the name of a node by index.
Signature
fun getNodeName(index: Int): String Parameters index: Int
The index of the node
Returns String
The name of the node
|
updateCylinderSurface
(
radius
, height
, fractionOfCircle
)
|
Updates the geometry of a cylinder surface mesh.
Signature
fun updateCylinderSurface(radius: Float, height: Float, fractionOfCircle: Float) Parameters radius: Float
The new radius of the cylinder
height: Float
The new height of the cylinder
fractionOfCircle: Float
The new fraction of the circle to include
|
updateGeometryDirect
(
positionsPtr
, normalsPtr
, uvsPtr
, colorsPtr
, indicesPtr
, vertexCount
, indexCount
, updateBVH
)
|
Updates geometry directly from raw C++ array pointers. The pointers are passed as Long values and written straight into the GPU buffer via map/memcpy/unmap — zero JNI array copies.
Signature
fun updateGeometryDirect(positionsPtr: Long, normalsPtr: Long, uvsPtr: Long, colorsPtr: Long, indicesPtr: Long, vertexCount: Int, indexCount: Int, updateBVH: Boolean = false) Parameters positionsPtr: Long
C++ float* to xyz position triplets
normalsPtr: Long
C++ float* to xyz normal triplets
uvsPtr: Long
C++ float* to uv pairs
colorsPtr: Long
C++ int32_t* to ARGB packed ints
indicesPtr: Long
C++ int32_t* to triangle indices
vertexCount: Int
Number of vertices
indexCount: Int
Number of indices
updateBVH: Boolean
Whether to update the bounding volume hierarchy
|
updateGeometryDirect
(
positionsPtr
, normalsPtr
, uvsPtr
, colorsPtr
, indicesPtr
, vertexCount
, indexCount
, materialRanges
, updateBVH
)
|
Update mesh geometry directly from C++ pointers (zero-copy) with updated material ranges. Use this overload when per-material index sections change each frame (e.g., particle systems with multiple emitters).
Signature
fun updateGeometryDirect(positionsPtr: Long, normalsPtr: Long, uvsPtr: Long, colorsPtr: Long, indicesPtr: Long, vertexCount: Int, indexCount: Int, materialRanges: IntArray, updateBVH: Boolean = false) Parameters positionsPtr: Long
C++ float* to xyz position triplets
normalsPtr: Long
C++ float* to xyz normal triplets
uvsPtr: Long
C++ float* to uv pairs
colorsPtr: Long
C++ int32_t* to ARGB packed ints
indicesPtr: Long
C++ int32_t* to triangle indices
vertexCount: Int
Number of vertices
indexCount: Int
Number of indices
materialRanges: IntArray
Flattened pairs of (startIndex, indexCount) per material section. For example, intArrayOf(0, 6, 6, 3) defines two sections: the first uses 6 indices starting at 0, the second uses 3 indices starting at 6.
updateBVH: Boolean
Whether to update the bounding volume hierarchy
|
updateWithTriangleMesh
(
triMesh
, updateBVH
)
|
Updates this mesh with geometry from a triangle mesh.
Signature
fun updateWithTriangleMesh(triMesh: TriangleMesh, updateBVH: Boolean = false) Parameters updateBVH: Boolean
Whether to update the bounding volume hierarchy
|
axis
(
size
, thickness
, material
)
|
Creates a coordinate axis visualization mesh.
Signature
fun axis(size: Float, thickness: Float, material: SceneMaterial): SceneMesh Parameters size: Float
Length of each axis
thickness: Float
Thickness of the axis lines
|
box
(
minx
, miny
, minz
, maxx
, maxy
, maxz
, material
)
|
Creates a box mesh with the specified dimensions and material.
Signature
fun box(minx: Float, miny: Float, minz: Float, maxx: Float, maxy: Float, maxz: Float, material: SceneMaterial): SceneMesh Parameters minx: Float
Minimum X coordinate
miny: Float
Minimum Y coordinate
minz: Float
Minimum Z coordinate
maxx: Float
Maximum X coordinate
maxy: Float
Maximum Y coordinate
maxz: Float
Maximum Z coordinate
|
box
(
min
, max
, material
)
|
Creates a box mesh with the specified bounds and material.
Signature
fun box(min: Vector3, max: Vector3, material: SceneMaterial): SceneMesh Parameters |
cylinderSurface
(
radius
, height
, fractionOfCircle
, material
, materialBack
)
|
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.
Signature
fun cylinderSurface(radius: Float, height: Float, fractionOfCircle: Float, material: SceneMaterial, materialBack: SceneMaterial? = null): SceneMesh Parameters radius: Float
The radius of the cylinder.
height: Float
The height of the cylinder (extends from Y=-height/2 to Y=height/2).
fractionOfCircle: Float
The fraction (0 to 1) of the cylinder's circumference to include.
|
dome
(
radius
, material
)
|
Creates a dome mesh (half-sphere) with the specified radius and material.
Signature
fun dome(radius: Float, material: SceneMaterial): SceneMesh Parameters radius: Float
Radius of the dome
|
equirectSurface
(
radius
, centralHorizontalAngle
, upperVerticalAngle
, lowerVerticalAngle
, material
)
|
Creates an inward portion of a sphere centered at (0, 0, 0). Uses a parameterization similar to OpenXR's equirect2 layers.
Signature
fun equirectSurface(radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, material: SceneMaterial): SceneMesh Parameters radius: Float
The radius of the sphere.
centralHorizontalAngle: Float
How far the surface wraps around the sphere horizontally 0, 2pi
upperVerticalAngle: Float
The angle from the center of the sphere to the top of the surface -pi/2, pi/2
lowerVerticalAngle: Float
The angle from the center of the sphere to the bottom of the surface -pi/2, pi/2
material: SceneMaterialReturns SceneMesh |
fromTriangleMesh
(
mesh
, createBVH
)
|
Creates a mesh from a triangle mesh.
Signature
fun fromTriangleMesh(mesh: TriangleMesh, createBVH: Boolean): SceneMesh Parameters mesh: TriangleMeshcreateBVH: Boolean
Whether to create a bounding volume hierarchy for the mesh
|
loadLocalFile
(
filename
, defaultShaderOverride
, defaultSceneOverride
)
|
Loads a 3D model from a glTF file.
Signature
fun loadLocalFile(filename: String, defaultShaderOverride: String = "", defaultSceneOverride: Int = -1): SceneMesh Parameters filename: String
Path to the model file (either .glb or .gltf)
defaultShaderOverride: String
Optional shader to override the default shader
defaultSceneOverride: Int
Optional scene index to override the default scene
|
loadLocalFile
(
filename
, materials
, defaultSceneOverride
)
|
Loads a 3D model from a glTF file.
Signature
fun loadLocalFile(filename: String, materials: List<SceneMaterial>, defaultSceneOverride: Int = -1): SceneMesh Parameters filename: String
Path to the model file (either .glb or .gltf)
materials: ListdefaultSceneOverride: Int
Optional scene index to override the default scene
|
meshWithMaterials
(
positions
, normals
, uvs
, colors
, indices
, materialRanges
, materials
, createBVH
)
|
Creates a custom mesh with the specified geometry data and materials.
Signature
fun meshWithMaterials(positions: FloatArray, normals: FloatArray, uvs: FloatArray, colors: IntArray, indices: IntArray, materialRanges: IntArray, materials: Array<SceneMaterial>, createBVH: Boolean): SceneMesh Parameters positions: FloatArray
Vertex positions as a flat array of floats (x, y, z triplets)
normals: FloatArray
Vertex normals as a flat array of floats (x, y, z triplets)
uvs: FloatArray
Primary texture coordinates as a flat array of floats (u, v pairs)
colors: IntArray
Vertex colors as an array of ARGB integers
indices: IntArray
Vertex indices as an array of integers
materialRanges: IntArray
Flattened pairs of (startIndex, indexCount) per material section. For example, intArrayOf(0, 6, 6, 3) defines two sections: the first uses 6 indices starting at 0, the second uses 3 indices starting at 6.
materials: Array
Array of materials to apply to the mesh
createBVH: Boolean
Whether to create a bounding volume hierarchy for the mesh
|
meshWithMaterials
(
positions
, normals
, uvs
, uv1s
, colors
, indices
, materialRanges
, materials
, createBVH
)
|
Creates a custom mesh with the specified geometry data, dual UV channels, and materials.
Signature
fun meshWithMaterials(positions: FloatArray, normals: FloatArray, uvs: FloatArray, uv1s: FloatArray, colors: IntArray, indices: IntArray, materialRanges: IntArray, materials: Array<SceneMaterial>, createBVH: Boolean): SceneMesh Parameters positions: FloatArray
Vertex positions as a flat array of floats (x, y, z triplets)
normals: FloatArray
Vertex normals as a flat array of floats (x, y, z triplets)
uvs: FloatArray
Primary texture coordinates as a flat array of floats (u, v pairs)
uv1s: FloatArray
Secondary texture coordinates as a flat array of floats (u, v pairs)
colors: IntArray
Vertex colors as an array of ARGB integers
indices: IntArray
Vertex indices as an array of integers
materialRanges: IntArray
Flattened pairs of (startIndex, indexCount) per material section. For example, intArrayOf(0, 6, 6, 3) defines two sections: the first uses 6 indices starting at 0, the second uses 3 indices starting at 6.
materials: Array
Array of materials to apply to the mesh
createBVH: Boolean
Whether to create a bounding volume hierarchy for the mesh
|
panel
(
min
, max
, edgeRadius
, materialPanel
, materialGlass
)
|
Creates a panel mesh with a glass frame.
Signature
fun panel(min: Vector3, max: Vector3, edgeRadius: Vector3, materialPanel: SceneMaterial, materialGlass: SceneMaterial): SceneMesh Parameters edgeRadius: Vector3 |
quad
(
min
, max
, material
)
|
Creates a single-sided quad (flat rectangle) mesh with the specified bounds and material.
Signature
fun quad(min: Vector3, max: Vector3, material: SceneMaterial): SceneMesh Parameters |
roundedBox
(
min
, max
, edgeRadius
, material
)
|
Creates a box with rounded corners.
Signature
fun roundedBox(min: Vector3, max: Vector3, edgeRadius: Vector3, material: SceneMaterial): SceneMesh Parameters edgeRadius: Vector3 |
singleSidedQuad
(
halfWidth
, halfHeight
, material
)
|
Creates a single-sided quad mesh with the specified dimensions and material.
Signature
fun singleSidedQuad(halfWidth: Float, halfHeight: Float, material: SceneMaterial): SceneMesh Parameters |
skybox
(
radius
, material
)
|
Creates a skybox mesh with the specified radius and material.
A skybox is a large sphere or cube that surrounds the scene and displays a background environment.
Signature
fun skybox(radius: Float, material: SceneMaterial): SceneMesh Parameters radius: Float
Radius of the skybox
|
sphere
(
radius
, material
)
|
Creates a sphere mesh with the specified radius and material.
Signature
fun sphere(radius: Float, material: SceneMaterial): SceneMesh Parameters radius: Float
Radius of the sphere
|