XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
namespace XFEEDToolBox.Core.Galaxy;

/// <summary>
/// A tool-owned instance of the original input component's frame-fade state.
/// Original activation3B37630 resets component1A8 to zero. This instance must
/// follow this tool's own camera/input lifetime; another camera's live1A8 is
/// not interchangeable with its history. All methods run on the owning frame
/// thread, once per input event, rather than once per alpha consumer.
/// </summary>
public sealed class GalaxyOriginalFrameFadeState
{
    public bool IsActive { get; private set; }
    public float? CurrentTransition { get; private set; }
    public float? TargetTransition { get; private set; }

    /// <summary>Begin a new camera/input lifetime at the recovered initial0.</summary>
    public void Activate()
    {
        IsActive=true;CurrentTransition=0;TargetTransition=null;
    }

    public void Deactivate()
    {
        IsActive=false;CurrentTransition=TargetTransition=null;
    }

    /// <summary>
    /// Advance from the actual camera, not its pending target. The same
    /// current catalogue Descriptor.InnerRadius binds both renderer280 and
    /// the Settings getter: provider3A5E4E0 -> interface551F408+30 ->1A3C960
    /// returns interface228, which is component280. Zero is a known range.
    /// inputFrameValue remains explicit: the original callback3ABA020 copies
    /// XMM2 to3AF5D70's XMM1 unchanged. Use GalaxyOriginalFrameFadeClock to
    /// bind host elapsed seconds through the recovered original frame
    /// clamps. Null never becomes an assumed cadence.
    /// </summary>
    public bool TryAdvanceForCamera(GalaxyCamera? camera,float? rendererInnerRadius,
        int? originalViewMode,float? inputFrameValue)
    {
        if(!IsActive)return false;
        if(camera is null||
           !GalaxyOriginalFrameFade.TryTargetTransition((float)camera.Distance,rendererInnerRadius,originalViewMode,out var target)||
           !GalaxyOriginalFrameFade.TryAdvanceTransition(CurrentTransition,target,inputFrameValue,out var next))
        {
            // An unobserved event loses the history. Later valid parameters
            // cannot recover the missing actual value from a target alone.
            CurrentTransition=TargetTransition=null;return false;
        }
        CurrentTransition=next;TargetTransition=target;return true;
    }

    /// <summary>
    /// Prepare any number of consumers without advancing time. Call only
    /// after this frame's input update; never change the state per vertex.
    /// </summary>
    public bool TryCreateForCamera(GalaxyCamera? camera,float? rendererInnerRadius,out GalaxyOriginalFrameFade fade)
        =>GalaxyOriginalFrameFade.TryCreateForCamera(IsActive?camera:null,rendererInnerRadius,CurrentTransition,out fade);
}