Daily update on 20251015-002614 by Nitload Youmu. Additional Message : Organize files of numerial math.

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-10-15 00:26:15 +08:00
parent c5eaf250ab
commit e283490525
50 changed files with 1319 additions and 1520 deletions
@@ -1,37 +1,35 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="TriggerButton.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="TriggerButton"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
@@ -40,10 +38,7 @@ using System.Text;
namespace StgSharp.Controls
{
public delegate void RenderButtonTextureCallback(
ButtonStatus status,
float beginTime,
in TextureProvider texture );
public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture);
public enum ButtonStatus
{
@@ -55,12 +50,12 @@ namespace StgSharp.Controls
Confirm = 0b1000,
DisableToEnable = Disable | Enable,
EnableToDisable = -( Enable | DisableToEnable ),
EnableToDisable = -(Enable | DisableToEnable),
EnableToHighlight = Enable | Highlight,
HighlightToEnable = -( Enable | Highlight ),
HighlightToEnable = -(Enable | Highlight),
HighlightToDisable = -( Highlight | Disable ),
HighlightToDisable = -(Highlight | Disable),
}
@@ -106,7 +101,7 @@ namespace StgSharp.Controls
{
add
{
if( _renderButton == null )
if (_renderButton == null)
{
_renderButton = value;
} else
@@ -116,7 +111,7 @@ namespace StgSharp.Controls
}
remove
{
if( _renderButton != null ) {
if (_renderButton != null) {
_renderButton -= value;
}
}
@@ -130,7 +125,7 @@ namespace StgSharp.Controls
public ReadOnlySpan<Vec4> TextureBox
{
get => MemoryMarshal.Cast<Vec2, Vec4>( _texture.TextureCoordinate );
get => MemoryMarshal.Cast<Vec2, Vec4>(_texture.TextureCoordinate);
}
public Rectangle BoundingBox { get; set; }
@@ -155,7 +150,7 @@ namespace StgSharp.Controls
public void DeHighlight()
{
if( CurrentStatus == ButtonStatus.Highlight ) {
if (CurrentStatus == ButtonStatus.Highlight) {
CurrentStatus = ButtonStatus.HighlightToEnable;
}
}
@@ -168,48 +163,48 @@ namespace StgSharp.Controls
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
_ => CurrentStatus,
};
if( disableCallback != null ) {
if (disableCallback != null) {
disableCallback();
}
}
public void Enable()
{
if( CurrentStatus == ButtonStatus.Disable )
if (CurrentStatus == ButtonStatus.Disable)
{
CurrentStatus = ButtonStatus.DisableToEnable;
} else
{
return;
}
if( enableCallback != null ) {
if (enableCallback != null) {
enableCallback();
}
}
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
_renderButton( CurrentStatus, _statusBeginTime, in _texture );
yield return new PlainGeometryMesh( this.BoundingBox, _texture );
_renderButton(CurrentStatus, _statusBeginTime, in _texture);
yield return new PlainGeometryMesh(this.BoundingBox, _texture);
}
public void Highlight()
{
if( CurrentStatus == ButtonStatus.Enable )
if (CurrentStatus == ButtonStatus.Enable)
{
CurrentStatus |= ButtonStatus.EnableToHighlight;
} else
{
return;
}
if( confirmCallback != null ) {
if (confirmCallback != null) {
confirmCallback();
}
}
internal void Init( ButtonStatus status )
internal void Init(ButtonStatus status)
{
if( CurrentStatus == ButtonStatus.Error ) {
if (CurrentStatus == ButtonStatus.Error) {
CurrentStatus = status;
}
}