mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-05 04:48:19 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
namespace Sandbox;
|
|
|
|
public sealed partial class SceneModel
|
|
{
|
|
/// <summary>
|
|
/// Update this animation. Delta is the time you want to advance, usually RealTime.Delta
|
|
/// </summary>
|
|
public void Update( float delta )
|
|
{
|
|
animNative.Update( delta );
|
|
FinishBoneUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update this animation. Delta is the time you want to advance, usually RealTime.Delta
|
|
/// </summary>
|
|
internal void Update( float delta, Action updateBones )
|
|
{
|
|
animNative.Update( delta );
|
|
updateBones.Invoke();
|
|
FinishBoneUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update all of the bones to the bind pose
|
|
/// </summary>
|
|
public void UpdateToBindPose()
|
|
{
|
|
animNative.SetBindPose();
|
|
FinishBoneUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update all of the bones to the bind pose
|
|
/// </summary>
|
|
internal void UpdateToBindPose( Action updateBones )
|
|
{
|
|
animNative.SetBindPose();
|
|
updateBones.Invoke();
|
|
FinishBoneUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Updates attachments, ao proxies etc
|
|
/// Should be called any time the world transform change
|
|
/// </summary>
|
|
internal void FinishBoneUpdate()
|
|
{
|
|
if ( Parent.IsValid() )
|
|
return;
|
|
|
|
animNative.CalculateWorldSpaceBones();
|
|
animNative.FinishUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update our bones to match the target's bones. This is a manual bone merge.
|
|
/// </summary>
|
|
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 );
|
|
}
|