- 动画:HumanoidRig 三层架构(standard 标准槽 / dialects 方言映射 / mapper 配对), 指/趾统一走世界增量两遍式烘焙;AnimationAttach 拆为纯算法 + facade;修正 HumanoidBasis 行走基朝向与跨骨架去重、根运动通道 - 物理:CharacterController 角色互碰撞 / shapeOffset / 接触事件;PhysicsWorld 接触合成与 字符冲量判定 - 渲染与材质:Model 多材质按材质拆子 mesh 与贴图路径解析、DDS 直传、GLB 内嵌纹理落盘、 不透明通道 alpha 固定 1.0、glTF FlipUVs 对齐;SceneSerializer 支持 meshIndex 与材质覆盖 - 脚本:FractureLib 抽为共享库(HostView 桥接)、WallFracture 参数直绑、新增 ThirdPersonCamera / Follower / WASDMove 玩法;移除 GameDirector / PlayerController / Target - 编辑器:新增 GamepadPanel、LogPanel(LogRing),改进 Inspector / 材质 / 统计 / 视口面板 - 依赖:vendored ufbx(FBX 5.x/6.x/7.x 全版本解析,替代 assimp 对 FBX 6.1 的拒读)
88 lines
2.2 KiB
C++
88 lines
2.2 KiB
C++
//
|
|
// Created by atdunbg on 2026/9/21.
|
|
//
|
|
|
|
#ifndef HELLOVULKAN_STATS_H
|
|
#define HELLOVULKAN_STATS_H
|
|
|
|
|
|
#include <Engine/Core/Types.h>
|
|
#include <mutex>
|
|
|
|
namespace Engine
|
|
{
|
|
class Stats
|
|
{
|
|
public:
|
|
static Stats& Get();
|
|
|
|
// ---- Engine 自己管理的 GPU 内存 ----
|
|
void AddTexture(u64 bytes);
|
|
void RemoveTexture(u64 bytes);
|
|
|
|
void AddMesh(u64 vertexBytes, u64 indexBytes);
|
|
void RemoveMesh(u64 vertexBytes, u64 indexBytes);
|
|
|
|
void AddBuffer(u64 bytes);
|
|
void RemoveBuffer(u64 bytes);
|
|
|
|
void AddMemoryBlock(u64 bytes);
|
|
void RemoveMemoryBlock(u64 bytes);
|
|
void AddMemoryUsed(u64 bytes);
|
|
void RemoveMemoryUsed(u64 bytes);
|
|
|
|
// ---- 每帧统计 ----
|
|
void BeginFrame();
|
|
void EndFrame();
|
|
void AddAllocation(u64 bytes);
|
|
void AddDeallocation(u64 bytes);
|
|
|
|
// ---- 只读快照(面板/遥测消费)----
|
|
struct Snapshot
|
|
{
|
|
u64 textureCount = 0;
|
|
u64 textureBytes = 0;
|
|
u64 meshCount = 0;
|
|
u64 meshBytes = 0;
|
|
u64 bufferCount = 0;
|
|
u64 bufferBytes = 0;
|
|
u64 memoryBlockBytes = 0; // MemoryAllocator 已分配块
|
|
u64 memoryUsedBytes = 0; // 块内实际占用
|
|
u64 frameAllocation = 0; // 本帧新增(BeginFrame 清零)
|
|
u64 frameDeallocation = 0; // 本帧释放
|
|
u64 totalAllocation = 0;
|
|
u64 totalDeallocation = 0;
|
|
};
|
|
Snapshot TakeSnapshot() const;
|
|
|
|
private:
|
|
Stats() = default;
|
|
|
|
mutable std::mutex m_Mutex;
|
|
|
|
// 资源计数
|
|
u64 m_TextureCount = 0;
|
|
u64 m_TextureBytes = 0;
|
|
|
|
u64 m_MeshCount = 0;
|
|
u64 m_MeshBytes = 0;
|
|
|
|
u64 m_BufferCount = 0;
|
|
u64 m_BufferBytes = 0;
|
|
|
|
// MemoryAllocator
|
|
u64 m_MemoryBlockBytes = 0;
|
|
u64 m_MemoryUsedBytes = 0;
|
|
|
|
// 每帧
|
|
u64 m_FrameAllocation = 0;
|
|
u64 m_FrameDeallocation = 0;
|
|
u64 m_TotalAllocation = 0;
|
|
u64 m_TotalDeallocation = 0;
|
|
};
|
|
|
|
#define STATS Engine::Stats::Get()
|
|
} // namespace Engine
|
|
|
|
#endif //HELLOVULKAN_STATS_H
|