API Reference · Model and texture loading

GltfInstance

Namespace: Ava3D

public sealed class GltfInstance

One copy of a GltfAsset in a scene: its own nodes to place and pose, its own GltfInstance.Animator and morph weights, sharing the asset's meshes and textures with every other copy.

Two instances of one asset are two characters. Playing a clip on one moves only its joints; setting a shape on one reshapes only its face. What they share by default is the materials — recolour one and both change — which is what a crowd wants and what MaterialSharing.Copy is there to change for the one who has to be different.

Properties

MemberDescription
Animator Animator { get; }

The player for GltfInstance.Clips, this instance's own. Always present, and does nothing at all until something is played. GltfInstance.AddTo registers it with the scene so the view advances it.

IReadOnlyList<AppearanceParameter> Appearance { get; }

Everything adjustable about this instance, described well enough to build a panel from.

GltfAsset Asset { get; }

The asset this is a copy of.

IReadOnlyList<AnimationClip> Clips { get; }

The clips, bound to this instance's nodes, in the file's order.

MaterialLookup Materials { get; }

The materials this instance wears, by the names the file gave them: the asset's, or copies.

Node Root { get; }

The node the file's own roots hang from. Move this to move the model.

MorphShapes Shape { get; }

The morph targets, as named parameters, this instance's own.

IReadOnlyList<Skin> Skins { get; }

The skeletons, bound to this instance's joints.

Methods

MemberDescription
GltfModel AddTo(Scene scene)

Puts the instance in a scene: adds GltfInstance.Root to its children and, when there are clips, registers GltfInstance.Animator so that Ava3DView advances it without the caller running a clock. Nothing plays until it is asked to.

returns

The instance as a GltfModel, the shape a single-model viewer already knows.

See also