forked from Misaki/GhostEngine
Refactor: variant-aware shader/material pipeline overhaul
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.
This commit is contained in:
@@ -3,41 +3,45 @@ using Ghost.Editor.Core.Inspector;
|
||||
using Ghost.Engine.Components;
|
||||
using Ghost.Engine.Utilities;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
|
||||
namespace Ghost.Editor.Components;
|
||||
|
||||
[CustomEditor(typeof(LocalToWorld))]
|
||||
internal class LocalToWorldEditor : ComponentEditor
|
||||
{
|
||||
private Vector3Field _translationField = null!;
|
||||
private Vector3Field _rotationField = null!;
|
||||
private Vector3Field _scaleField = null!;
|
||||
private Float3Field _translationField = null!;
|
||||
private Float3Field _rotationField = null!;
|
||||
private Float3Field _scaleField = null!;
|
||||
|
||||
public override void Create(StackPanel container)
|
||||
{
|
||||
_translationField = new Vector3Field();
|
||||
_rotationField = new Vector3Field();
|
||||
_scaleField = new Vector3Field();
|
||||
_translationField = new Float3Field();
|
||||
_rotationField = new Float3Field();
|
||||
_scaleField = new Float3Field();
|
||||
|
||||
_translationField.OnValueChanged += (s, e) =>
|
||||
{
|
||||
var data = ComponentObject.GetData<LocalToWorld>();
|
||||
MatrixUtility.GetTRS(data.ValueRO.matrix, out var _, out var oldRotation, out var oldScale);
|
||||
data.ValueRW.matrix = MatrixUtility.CreateTRS(e.NewValue, oldRotation, oldScale);
|
||||
ref var data = ref ComponentObject.GetData<LocalToWorld>();
|
||||
data.matrix.c3.xyz = e.NewValue;
|
||||
};
|
||||
|
||||
_rotationField.OnValueChanged += (s, e) =>
|
||||
{
|
||||
var data = ComponentObject.GetData<LocalToWorld>();
|
||||
MatrixUtility.GetTRS(data.ValueRO.matrix, out var oldTranslation, out var _, out var oldScale);
|
||||
data.ValueRW.matrix = MatrixUtility.CreateTRS(oldTranslation, e.NewValue.ToQuaternion(), oldScale);
|
||||
ref var data = ref ComponentObject.GetData<LocalToWorld>();
|
||||
var newRotation = quaternion.EulerXYZ(e.NewValue * math.TORADIANS);
|
||||
|
||||
data.matrix.GetTRS(out var oldTranslation, out var _, out var oldScale);
|
||||
data.matrix = float4x4.TRS(oldTranslation, newRotation, oldScale);
|
||||
};
|
||||
|
||||
_scaleField.OnValueChanged += (s, e) =>
|
||||
{
|
||||
var data = ComponentObject.GetData<LocalToWorld>();
|
||||
MatrixUtility.GetTRS(data.ValueRO.matrix, out var oldTranslation, out var oldRotation, out var _);
|
||||
data.ValueRW.matrix = MatrixUtility.CreateTRS(oldTranslation, oldRotation, e.NewValue);
|
||||
ref var data = ref ComponentObject.GetData<LocalToWorld>();
|
||||
var newScale = e.NewValue;
|
||||
|
||||
data.matrix.GetTRS(out var oldTranslation, out var oldRotation, out var _);
|
||||
data.matrix = float4x4.TRS(oldTranslation, oldRotation, newScale);
|
||||
};
|
||||
|
||||
container.Children.Add(new PropertyField() { Label = "Position", Content = _translationField });
|
||||
@@ -48,14 +52,14 @@ internal class LocalToWorldEditor : ComponentEditor
|
||||
public override void Update()
|
||||
{
|
||||
var data = ComponentObject.GetData<LocalToWorld>();
|
||||
MatrixUtility.GetTRS(data.ValueRO.matrix, out var translation, out var rotation, out var scale);
|
||||
data.matrix.GetTRS(out var position, out var rotation, out var scale);
|
||||
|
||||
_translationField.Value = translation;
|
||||
_rotationField.Value = VectorUtility.CreateFromQuaternion(rotation);
|
||||
_translationField.Value = position;
|
||||
_rotationField.Value = math.degrees(math.EulerXYZ(rotation));
|
||||
_scaleField.Value = scale;
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user