GltfModelNode


class GltfModelNode


GltfModelNode represents a node in a GltfModelEntity.

The lifecycle of a glTF node is tied to the glTF model itself. Trying to use the GltfModelNode after the GltfModelEntity is disposed will throw an IllegalStateException.

Summary

Public functions

Unit

Clears a previously set material override for a specific primitive of a node's mesh within the glTF graph.

Unit
@MainThread
setMaterialOverride(material: Material, primitiveIndex: Int)

Sets a material override for a primitive of a node within the glTF graph.

Public properties

Int

The index of this node in the flattened list of child nodes of the glTF model.

Pose

The Pose of this node relative to its immediate parent GltfModelNode.

Vector3

The scale of this node relative to its immediate parent GltfModelNode.

Pose

The Pose of this node relative to the GltfModelEntity root.

Vector3

The scale of this node relative to the GltfModelEntity root.

String?

The name of the node as defined in the glTF file.

Public functions

clearMaterialOverride

Added in 1.0.0-alpha13
@MainThread
fun clearMaterialOverride(primitiveIndex: Int = 0): Unit

Clears a previously set material override for a specific primitive of a node's mesh within the glTF graph.

If no override was previously set for that primitive, this call has no effect.

Parameters
primitiveIndex: Int = 0

The zero-based index for the primitive of the specified node, as defined in the glTF graph. Default is the first primitive of that node.

Throws
IllegalStateException

if the node does not have a mesh.

IndexOutOfBoundsException

if the primitiveIndex is out of bounds.

setMaterialOverride

Added in 1.0.0-alpha13
@MainThread
fun setMaterialOverride(material: Material, primitiveIndex: Int = 0): Unit

Sets a material override for a primitive of a node within the glTF graph.

The override is then applied to a primitive of that node's mesh at the specified primitiveIndex.

Parameters
material: Material

The new Material to apply to the primitive.

primitiveIndex: Int = 0

The zero-based index for the primitive of the specified node, as defined in the glTF graph. Default is the first primitive of that node.

Throws
IllegalArgumentException

if the provided Material is invalid.

IllegalStateException

if the node does not have a mesh.

IndexOutOfBoundsException

if the primitiveIndex is out of bounds.

Public properties

index

Added in 1.0.0-alpha13
val indexInt

The index of this node in the flattened list of child nodes of the glTF model.

localPose

Added in 1.0.0-alpha13
var localPosePose

The Pose of this node relative to its immediate parent GltfModelNode.

localScale

Added in 1.0.0-alpha13
var localScaleVector3

The scale of this node relative to its immediate parent GltfModelNode.

modelPose

Added in 1.0.0-alpha13
var modelPosePose

The Pose of this node relative to the GltfModelEntity root.

modelScale

Added in 1.0.0-alpha13
var modelScaleVector3

The scale of this node relative to the GltfModelEntity root.

name

Added in 1.0.0-alpha13
val nameString?

The name of the node as defined in the glTF file. Returns null if the node has no name.