forked from Misaki/GhostEngine
Major architectural update to graphics/material/shader system: - Introduced strongly-typed key structs (Key64/Key128) for passes, variants, and pipelines; removed legacy key types. - Implemented robust hashing and key generation utilities for efficient variant and pipeline lookup/caching. - Shader compiler now compiles/caches all keyword variants using new key system; includes handled as lists. - Switched to push constant root signature for per-draw data; updated HLSL and C# codegen accordingly. - Refactored Material, Shader, and Pass data structures for cache efficiency and variant support. - Pipeline library and PSO management now use 128-bit keys and variant-specific caching. - Replaced WorldNode with SceneNode in editor/scene graph; introduced ComponentManager for archetype/query management. - Migrated math utilities to Misaki.HighPerformance.Mathematics; updated editor controls. - Updated all HLSL and codegen for new buffer/push constant layouts and macros. - Misc: project reference cleanup, D3D12 Work Graph support, doc updates, and code modernization.
70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Misaki.HighPerformance.Mathematics;
|
|
|
|
namespace Ghost.Editor.Core.Controls;
|
|
|
|
[TemplatePart(Name = "XComponent", Type = typeof(NumberBox))]
|
|
[TemplatePart(Name = "YComponent", Type = typeof(NumberBox))]
|
|
[TemplatePart(Name = "ZComponent", Type = typeof(NumberBox))]
|
|
public sealed partial class Float3Field : ValueControl<float3>
|
|
{
|
|
private NumberBox? _xComponent;
|
|
private NumberBox? _yComponent;
|
|
private NumberBox? _zComponent;
|
|
|
|
public Float3Field()
|
|
{
|
|
DefaultStyleKey = typeof(Float3Field);
|
|
}
|
|
|
|
protected override void ValueChanged(float3 oldValue, float3 newValue)
|
|
{
|
|
SyncFromValue();
|
|
}
|
|
|
|
protected override void OnApplyTemplate()
|
|
{
|
|
base.OnApplyTemplate();
|
|
|
|
_xComponent?.ValueChanged -= OnComponentChanged;
|
|
_yComponent?.ValueChanged -= OnComponentChanged;
|
|
_zComponent?.ValueChanged -= OnComponentChanged;
|
|
|
|
_xComponent = GetTemplateChild("XComponent") as NumberBox;
|
|
_yComponent = GetTemplateChild("YComponent") as NumberBox;
|
|
_zComponent = GetTemplateChild("ZComponent") as NumberBox;
|
|
|
|
SyncFromValue();
|
|
|
|
_xComponent?.ValueChanged += OnComponentChanged;
|
|
_yComponent?.ValueChanged += OnComponentChanged;
|
|
_zComponent?.ValueChanged += OnComponentChanged;
|
|
}
|
|
|
|
private void SyncFromValue()
|
|
{
|
|
SuppressChangedEvent = true;
|
|
_xComponent?.Value = Value.x;
|
|
_yComponent?.Value = Value.y;
|
|
_zComponent?.Value = Value.z;
|
|
SuppressChangedEvent = false;
|
|
}
|
|
|
|
private void OnComponentChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
|
|
{
|
|
if (SuppressChangedEvent)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var newValue = new float3(
|
|
(float)(_xComponent?.Value ?? 0),
|
|
(float)(_yComponent?.Value ?? 0),
|
|
(float)(_zComponent?.Value ?? 0));
|
|
|
|
RiseChangedEvent(Value, newValue);
|
|
Value = newValue;
|
|
}
|
|
}
|