Add animation controller system, material assets and skeleton visualization

- .animctrl state machine asset (params/transitions/blend trees, 1D+2D
  directional blending) with Unity Animator-style editor panel: state
  list, transitions, params, directional pad preview driving live
  CrossFade on the selected entity
- Split animation evaluation out of SceneRenderer into
  AnimationSystem/AnimationEvaluator; skin palettes with rest-pose
  fallback and blend-weight epsilon filtering
- MaterialAsset (.material) with reload-safe preview tile pool
  (DropMaterial clears dirty refs before instance destruction)
- EditorGizmoPass skeleton wires + viewport joint overlay; camera
  projection rework (baked Vulkan Y-flip, ortho support)
- Editor/game build split via HELLOVULKAN_EDITOR option
This commit is contained in:
2026-10-07 01:50:04 +08:00
parent a941207ae3
commit cc837bc605
71 changed files with 8198 additions and 548 deletions
+25 -2
View File
@@ -24,10 +24,14 @@
#include <Engine/Renderer/Renderer.h>
#include <Engine/Renderer/EditorCamera.h>
#include <Engine/Core/Input.h>
#include <Engine/Core/Input.h>
// editor/game 编译期分离(HELLOVULKAN_EDITOR CMake option):editor 形态
// 挂接 docking Editor;game 形态 = Direct 直渲 + primary 相机,零编辑器代码
#ifdef HELLO_EDITOR
#include "Editor.h"
#include "EditorContext.h"
#endif
using namespace Engine;
@@ -51,6 +55,7 @@ namespace
void OnInit() override
{
Renderer& renderer = GetRenderer();
#ifdef HELLO_EDITOR
renderer.SetDisplayMode(kDisplayViewport);
@@ -59,10 +64,15 @@ namespace
// Editor 注入:引擎门面 + 沙盒能力回调(环境异步切换等)
InitEditor();
#else
// game 形态:全窗口 Direct 直渲(Renderer 默认即 kDisplayDirect),
// 相机由场景 primary camera 提供,无 UI
#endif
}
void OnUpdate(const FrameTime& frameTime) override
{
#ifdef HELLO_EDITOR
// 编辑器形态:驱动编辑器相机(RMB 飞行 / MMB 焦点环绕 /
// 滚轮推拉)。暂停(timeScale=0)时仍可飞行——unscaled dt。
// PIE 内嵌播放:渲染源已切 primary 相机,编辑器相机停驱
@@ -73,31 +83,42 @@ namespace
{
GetRenderer().GetEditorCamera().Update(frameTime.UnscaledDt());
}
#else
(void)frameTime; // game 形态:本沙盒无游戏逻辑
#endif
}
// ---- UI(全部委托 docking Editor;本文件零 ImGui 控件)----
void OnImGuiRender() override
{
#ifdef HELLO_EDITOR
m_Editor->Draw();
#endif
}
// ---- 事件 ----
void OnWindowClose(const Event& event) override
{
#ifdef HELLO_EDITOR
// 退出确认走 Editor 的模态框(ImGui 必须可见才有 UI)
SetImGuiEnabled(true);
m_Editor->RequestQuit();
#else
(void)event;
#endif
}
void OnKeyPress(const Event& event) override
{
// 键码统一走 Input::Key(App 层零 GLFW 依赖)
#ifdef HELLO_EDITOR
if (event.key == static_cast<int>(Input::Key::GraveAccent))
{
SetImGuiEnabled(!GetImGuiEnabled());
}
#endif
if (event.key == static_cast<int>(Input::Key::F1))
{
STATS.PrintComparison();
@@ -111,6 +132,7 @@ namespace
}
private:
#ifdef HELLO_EDITOR
// Editor 注入:门面指针 + 反向能力回调(面板 → 沙盒)
void InitEditor()
{
@@ -136,6 +158,7 @@ namespace
private:
std::unique_ptr<Editor> m_Editor = std::make_unique<Editor>();
#endif
};
}