feat: added 3D AABB primitive

This commit is contained in:
2025-10-19 18:34:48 +03:00
parent 1d63391975
commit a9fc819268
4 changed files with 198 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
using Engine.Core;
namespace Engine.Systems.Tween;
public static class TweenAABB3DExtensions
{
private static readonly BoxedPool<AABB3D> boxedAABBPool = new(2);
public static ITween TweenAABB(this AABB3D initialAABB, ITweenManager tweenManager, float duration, AABB3D targetAABB, System.Action<AABB3D> setMethod)
{
Boxed<AABB3D> boxedInitial = boxedAABBPool.Get(initialAABB);
Boxed<AABB3D> boxedTarget = boxedAABBPool.Get(targetAABB);
ITween tween = tweenManager.StartTween(duration, t => setMethod?.Invoke(new AABB3D(boxedInitial.Value.LowerBoundary.Lerp(boxedTarget.Value.LowerBoundary, t), boxedInitial.Value.UpperBoundary.Lerp(boxedTarget.Value.UpperBoundary, t))));
tween.OnComplete(() =>
{
boxedAABBPool.Return(boxedInitial);
boxedAABBPool.Return(boxedTarget);
});
return tween;
}
}