namespace Sandbox;
public sealed partial class SceneModel
{
///
/// Update this animation. Delta is the time you want to advance, usually RealTime.Delta
///
public void Update( float delta )
{
animNative.Update( delta );
FinishBoneUpdate();
}
///
/// Update this animation. Delta is the time you want to advance, usually RealTime.Delta
///
internal void Update( float delta, Action updateBones )
{
animNative.Update( delta );
updateBones.Invoke();
FinishBoneUpdate();
}
///
/// Update all of the bones to the bind pose
///
public void UpdateToBindPose()
{
animNative.SetBindPose();
FinishBoneUpdate();
}
///
/// Update all of the bones to the bind pose
///
internal void UpdateToBindPose( Action updateBones )
{
animNative.SetBindPose();
updateBones.Invoke();
FinishBoneUpdate();
}
///
/// Updates attachments, ao proxies etc
/// Should be called any time the world transform change
///
internal void FinishBoneUpdate()
{
if ( Parent.IsValid() )
return;
animNative.CalculateWorldSpaceBones();
animNative.FinishUpdate();
}
///
/// Update our bones to match the target's bones. This is a manual bone merge.
///
public void MergeBones( SceneModel parent )
{
Assert.IsValid( parent );
Assert.False( parent == this );
animNative.MergeFrom( parent );
}
internal Transform GetParentSpaceBone( int i ) => animNative.GetParentSpaceBone( i );
internal void SetParentSpaceBone( int i, in Transform tx ) => animNative.SetParentSpaceBone( i, tx );
}