- .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
67 lines
2.8 KiB
C++
67 lines
2.8 KiB
C++
//
|
||
// Created by atdunbg on 2026/9/23.
|
||
//
|
||
// IAssetUploader:资产层 → GPU 的上传接口。
|
||
//
|
||
// 资产层(AssetManager/AssetCache)只认这个接口,不感知 Vulkan 具体类
|
||
// (Device/Allocator/DescriptorManager)。实现由渲染层提供
|
||
// (VulkanAssetUploader),组合根(Renderer)装配后注入。
|
||
//
|
||
// 对齐 UE:资产系统(AssetManager/StreamableManager)与渲染资源创建
|
||
// (rendering thread / RHI)分离,资产层只拿到"可用的渲染资源"。
|
||
//
|
||
// 后续演进点:接口加返回 future / 回调即为异步加载
|
||
// (IO 线程解析 → 上传队列提交),本接口已是正确的接缝。
|
||
//
|
||
|
||
#ifndef HELLOVULKAN_IASSETUPLOADER_H
|
||
#define HELLOVULKAN_IASSETUPLOADER_H
|
||
|
||
#include <Engine/Core/Types.h>
|
||
#include <Engine/Renderer/Model.h>
|
||
#include <Engine/Renderer/MaterialAsset.h>
|
||
#include <Engine/Renderer/Cubemap.h>
|
||
|
||
namespace Engine::Assets {
|
||
|
||
class IAssetUploader {
|
||
public:
|
||
virtual ~IAssetUploader() = default;
|
||
|
||
// 磁盘模型 → 解析 + GPU 上传(失败返回 nullptr)
|
||
virtual Scope<Model> LoadModel(const std::string& path) = 0;
|
||
|
||
// 异步路径:解析已在后台线程完成,此调用只做 GPU 构建(主线程)
|
||
virtual Scope<Model> LoadModel(const std::string& path,
|
||
ParsedModel&& parsed) = 0;
|
||
|
||
// 程序化纯色平面(size 为半边长)
|
||
virtual Scope<Model> CreatePlane(f32 halfSize, u8 r, u8 g, u8 b) = 0;
|
||
|
||
// 半透明纯色平面(alpha 0-255,透明绘制队列)
|
||
virtual Scope<Model> CreateTransparentPlane(f32 halfSize,
|
||
u8 r, u8 g, u8 b, u8 a) = 0;
|
||
|
||
// 环境 HDR → IBL 预积分四件套(compute 生成,毫秒级;失败返回 nullptr)
|
||
virtual Scope<Cubemap> LoadEnvironment(const std::string& path) = 0;
|
||
|
||
// 异步加载路径:解码已在后台线程完成,此调用只做 GPU 生成(主线程)
|
||
virtual Scope<Cubemap> LoadEnvironment(const std::string& path,
|
||
DecodedEquirect&& decoded) = 0;
|
||
|
||
// ---- 材质资产 GPU 构建(MaterialAsset 专用接缝)----
|
||
// 数据段 → 纹理上传 + Material 描述符(失败/空槽折共享默认纹理,
|
||
// 纹理所有权归返回的 MaterialAsset)。失败返回 nullptr
|
||
virtual Scope<MaterialAsset> CreateMaterial(
|
||
MaterialAssetData&& data) = 0;
|
||
|
||
// GPU 全停飞(编辑器低频重建路径用:材质资产 Reload 前调用,
|
||
// 保证旧纹理/描述符无在飞引用后销毁——与 Renderer::SetEnvironment
|
||
// 的 waitIdle 换绑同一先例)
|
||
virtual void WaitDeviceIdle() = 0;
|
||
};
|
||
|
||
} // namespace Engine::Assets
|
||
|
||
#endif //HELLOVULKAN_IASSETUPLOADER_H
|