refactor(runtime): extract the live object frame
This commit is contained in:
parent
99a3e819c4
commit
4e4aac2c5a
27 changed files with 1217 additions and 371 deletions
|
|
@ -1,12 +1,15 @@
|
|||
using System.Numerics;
|
||||
using AcDream.App.Input;
|
||||
using AcDream.App.Physics;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Vfx;
|
||||
using AcDream.App.Streaming;
|
||||
using AcDream.App.World;
|
||||
using AcDream.Core.Net;
|
||||
using AcDream.Core.Net.Messages;
|
||||
using AcDream.Core.Physics;
|
||||
using AcDream.Core.World;
|
||||
using AcDream.Core.Vfx;
|
||||
using DatReaderWriter.DBObjs;
|
||||
using DatReaderWriter.Enums;
|
||||
using DatReaderWriter.Types;
|
||||
|
|
@ -629,14 +632,42 @@ public sealed class LiveEntityAnimationSchedulerTests
|
|||
var ordinaryPhysics = new LiveEntityOrdinaryPhysicsUpdater(
|
||||
physics,
|
||||
(_, _) => (0.48f, 1.835f));
|
||||
var identity = new LocalPlayerIdentityState { ServerGuid = localPlayerGuid };
|
||||
var poses = new EntityEffectPoseRegistry();
|
||||
foreach (WorldEntity entity in live.MaterializedWorldEntities.Values)
|
||||
poses.PublishMeshRefs(entity);
|
||||
IAnimationHookCaptureSink animationHooks = captureHooks is null
|
||||
? new AnimationHookCaptureSink(new AnimationHookFrameQueue(
|
||||
new AnimationHookRouter(),
|
||||
poses))
|
||||
: new TestAnimationHookCaptureSink(captureHooks);
|
||||
projectiles ??= new ProjectileController(live, physics);
|
||||
return new LiveEntityAnimationScheduler(
|
||||
() => live,
|
||||
() => localPlayerGuid,
|
||||
live,
|
||||
identity,
|
||||
remotePhysics,
|
||||
ordinaryPhysics,
|
||||
() => projectiles,
|
||||
publishRootPose ?? (_ => { }),
|
||||
captureHooks ?? ((_, _) => { }));
|
||||
projectiles,
|
||||
new TestRootPosePublisher(poses, publishRootPose),
|
||||
animationHooks);
|
||||
}
|
||||
|
||||
private sealed class TestAnimationHookCaptureSink(
|
||||
Action<uint, AnimationSequencer> capture) : IAnimationHookCaptureSink
|
||||
{
|
||||
public void Capture(uint ownerLocalId, AnimationSequencer sequencer) =>
|
||||
capture(ownerLocalId, sequencer);
|
||||
}
|
||||
|
||||
private sealed class TestRootPosePublisher(
|
||||
EntityEffectPoseRegistry poses,
|
||||
Action<WorldEntity>? published) : IEntityRootPosePublisher
|
||||
{
|
||||
public void UpdateRoot(WorldEntity entity)
|
||||
{
|
||||
poses.UpdateRoot(entity);
|
||||
published?.Invoke(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private static (LiveEntityRuntime Live, LiveEntityRecord Record,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue