Implement initial Unity-style asset library cache

This commit is contained in:
2026-04-02 03:03:36 +08:00
parent 619856ab22
commit 4c167bec0e
29 changed files with 4818 additions and 73 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <XCEngine/Components/Component.h>
#include <XCEngine/Core/Asset/AssetRef.h>
#include <XCEngine/Core/Asset/ResourceHandle.h>
#include <XCEngine/Resources/Material/Material.h>
@@ -20,6 +21,7 @@ public:
const Resources::ResourceHandle<Resources::Material>& GetMaterialHandle(size_t index) const;
const std::string& GetMaterialPath(size_t index) const;
const std::vector<std::string>& GetMaterialPaths() const { return m_materialPaths; }
const std::vector<Resources::AssetRef>& GetMaterialAssetRefs() const { return m_materialRefs; }
void SetMaterialPath(size_t index, const std::string& materialPath);
void SetMaterial(size_t index, const Resources::ResourceHandle<Resources::Material>& material);
@@ -45,6 +47,7 @@ private:
std::vector<Resources::ResourceHandle<Resources::Material>> m_materials;
std::vector<std::string> m_materialPaths;
std::vector<Resources::AssetRef> m_materialRefs;
bool m_castShadows = true;
bool m_receiveShadows = true;
uint32_t m_renderLayer = 0;