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
-
objectAnimatedModel
- 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
meshXAnimatedMeshThe 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
Properties
AnimationSetNames
The names of the animations available in this model.
public ImmutableArray<string> AnimationSetNames { get; }
Property Value
CurrentAnimation
The name of the animation currently playing on the primary track; null if none.
public string? CurrentAnimation { get; }
Property Value
NumberSubsets
The numbers of subsets in this model
public int NumberSubsets { get; protected set; }
Property Value
Speed
The speed at which animations are played back (1 = normal speed).
public float Speed { get; set; }
Property Value
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
indexintThe index of the animation to blend to (see AnimationSetNames).
durationdoubleThe 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
namestringThe name of the animation to blend to (see AnimationSetNames).
durationdoubleThe 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
rayRayA 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.
distancefloatReturns the distance along the
rayat which the intersection took place.
Returns
- bool
trueif this PositionableRenderable was intersected by theray.
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
indexintThe index of the animation (see AnimationSetNames).
loopboolWhether 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
namestringThe name of the animation (see AnimationSetNames).
loopboolWhether to loop the animation.