GltfModelNode


public final 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 methods

final void
@MainThread
clearMaterialOverride(int primitiveIndex)

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

final int

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

final @NonNull Pose

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

final @NonNull Vector3

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

final @NonNull Pose

The Pose of this node relative to the GltfModelEntity root.

final @NonNull Vector3

The scale of this node relative to the GltfModelEntity root.

final String

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

final void

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

final void

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

final void
@MainThread
setMaterialOverride(@NonNull Material material, int primitiveIndex)

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

final void

The Pose of this node relative to the GltfModelEntity root.

final void

The scale of this node relative to the GltfModelEntity root.

Public methods

clearMaterialOverride

Added in 1.0.0-alpha13
@MainThread
public final void clearMaterialOverride(int primitiveIndex)

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
int primitiveIndex

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.

getIndex

Added in 1.0.0-alpha13
public final int getIndex()

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

getLocalPose

Added in 1.0.0-alpha13
@MainThread
public final @NonNull Pose getLocalPose()

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

getLocalScale

Added in 1.0.0-alpha13
@MainThread
public final @NonNull Vector3 getLocalScale()

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

getModelPose

Added in 1.0.0-alpha13
@MainThread
public final @NonNull Pose getModelPose()

The Pose of this node relative to the GltfModelEntity root.

getModelScale

Added in 1.0.0-alpha13
@MainThread
public final @NonNull Vector3 getModelScale()

The scale of this node relative to the GltfModelEntity root.

getName

Added in 1.0.0-alpha13
public final String getName()

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

setLocalPose

Added in 1.0.0-alpha13
@MainThread
public final void setLocalPose(@NonNull Pose value)

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

setLocalScale

Added in 1.0.0-alpha13
@MainThread
public final void setLocalScale(@NonNull Vector3 value)

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

setMaterialOverride

Added in 1.0.0-alpha13
@MainThread
public final void setMaterialOverride(@NonNull Material material, int primitiveIndex)

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
@NonNull Material material

The new Material to apply to the primitive.

int primitiveIndex

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.

setModelPose

Added in 1.0.0-alpha13
@MainThread
public final void setModelPose(@NonNull Pose value)

The Pose of this node relative to the GltfModelEntity root.

setModelScale

Added in 1.0.0-alpha13
@MainThread
public final void setModelScale(@NonNull Vector3 value)

The scale of this node relative to the GltfModelEntity root.