Table of Contents

Class AnimatedModel

Namespace
OmegaEngine.Graphics.Renderables
Assembly
OmegaEngine.dll

A mesh-based model with frame-hierarchy (skeletal) animation that can be rendered by the engine.

public class AnimatedModel : PositionableRenderable, IDisposable, IPositionable
Inheritance
object
AnimatedModel
Implements
Inherited Members

Constructors

AnimatedModel(XAnimatedMesh)

Creates a new animated model based upon a cached animated mesh, using its internal material data.

public AnimatedModel(XAnimatedMesh mesh)

Parameters

mesh XAnimatedMesh

The animated mesh to use for rendering

Fields

Materials

An array of all materials used to render this mesh (aggregated across all mesh containers, held for reference counting).

protected readonly XMaterial[] Materials

Field Value

XMaterial[]

Properties

AnimationSetNames

The names of the animations available in this model.

public ImmutableArray<string> AnimationSetNames { get; }

Property Value

ImmutableArray<string>

CurrentAnimation

The name of the animation currently playing on the primary track; null if none.

public string? CurrentAnimation { get; }

Property Value

string

NumberSubsets

The numbers of subsets in this model

public int NumberSubsets { get; protected set; }

Property Value

int

Speed

The speed at which animations are played back (1 = normal speed).

public float Speed { get; set; }

Property Value

float

Methods

CrossFadeTo(int, double)

Smoothly blends from the currently playing animation to another one by index.

public void CrossFadeTo(int index, double duration = 0.25)

Parameters

index int

The index of the animation to blend to (see AnimationSetNames).

duration double

The duration of the transition in seconds.

CrossFadeTo(string, double)

Smoothly blends from the currently playing animation to another one by name.

public void CrossFadeTo(string name, double duration = 0.25)

Parameters

name string

The name of the animation to blend to (see AnimationSetNames).

duration double

The duration of the transition in seconds.

IntersectsGeometry(Ray, out float)

Determine whether the geometry of this PositionableRenderable is intersected by a ray in entity space.

protected override bool IntersectsGeometry(Ray ray, out float distance)

Parameters

ray Ray

A ray in entity space (the space BoundingSphere and BoundingBox live in, even before applying PreTransform) along which to check for intersections. Its direction is not normalized, so that distances keep the scale of the original ray.

distance float

Returns the distance along the ray at which the intersection took place.

Returns

bool

true if this PositionableRenderable was intersected by the ray.

Remarks

Only called if the ray passes the bounding bodies, unless PreCheckBounding is off.

OnDispose()

Hook that is called when the object needs to dispose its internal resources.

protected override void OnDispose()

OnEngineSet()

Hook that is called when Engine is set for the first time.

protected override void OnEngineSet()

OnPreRender()

Called once per frame before rendering the entity. Will only be called once, even if the entity is rendered in multiple views. Will not be called if the entity is excluded by a culling test.

protected override void OnPreRender()

PlayAnimation(int, bool)

Immediately starts playing an animation by index on the primary track.

public void PlayAnimation(int index, bool loop = true)

Parameters

index int

The index of the animation (see AnimationSetNames).

loop bool

Whether to loop the animation.

PlayAnimation(string, bool)

Immediately starts playing an animation by name on the primary track.

public void PlayAnimation(string name, bool loop = true)

Parameters

name string

The name of the animation (see AnimationSetNames).

loop bool

Whether to loop the animation.