Asset concepts
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 14m5s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 14m23s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 14m24s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 13m53s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 14m22s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 14m43s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 14m49s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 14m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 15m21s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Failing after 12m47s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 12m42s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 12m41s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 48s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Clang Format Checks (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 2m4s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 2m24s
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 14m5s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 14m23s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 14m24s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 13m53s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 14m22s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 14m43s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 14m49s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 14m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 15m21s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Failing after 12m47s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 12m42s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 12m41s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 48s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Clang Format Checks (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 2m4s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 2m24s
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSET_HPP
|
#ifndef BIGFOOT_ENGINE_ASSET_ASSET_HPP
|
||||||
#define BIGFOOT_ENGINE_ASSET_ASSET_HPP
|
#define BIGFOOT_ENGINE_ASSET_ASSET_HPP
|
||||||
|
#include <Engine/Asset/AssetConcepts.hpp>
|
||||||
#include <Engine/Asset/Asset_generated.hpp>
|
#include <Engine/Asset/Asset_generated.hpp>
|
||||||
#include <Engine/EngineAssertHandler.hpp>
|
#include <Engine/EngineAssertHandler.hpp>
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ class AssetBase
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class ASSET>
|
template<class ASSET>
|
||||||
|
requires AssetTraits<ASSET>
|
||||||
class Asset: public AssetBase
|
class Asset: public AssetBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
* \file AssetConcepts.hpp
|
||||||
|
*
|
||||||
|
* \author Romain BOULLARD
|
||||||
|
* \date August 2026
|
||||||
|
*********************************************************************/
|
||||||
|
#ifndef BIGFOOT_ENGINE_ASSET_ASSETCONCEPTS_HPP
|
||||||
|
#define BIGFOOT_ENGINE_ASSET_ASSETCONCEPTS_HPP
|
||||||
|
#include <Engine/Asset/AssetTypeID.hpp>
|
||||||
|
|
||||||
|
#include <System/UUID/UUID.hpp>
|
||||||
|
|
||||||
|
#include <concepts>
|
||||||
|
|
||||||
|
namespace Bigfoot
|
||||||
|
{
|
||||||
|
class AssetBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The traits struct passed to Asset<TRAITS> (e.g. AssetATraits).
|
||||||
|
* Must name the generated flatbuffers table type for the asset.
|
||||||
|
*/
|
||||||
|
template<class TRAITS>
|
||||||
|
concept AssetTraits = requires {
|
||||||
|
typename TRAITS::FLAT;
|
||||||
|
typename TRAITS::FLAT::NativeTableType;
|
||||||
|
{ TRAITS::FLAT::GetFullyQualifiedName() } -> std::convertible_to<const char*>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A concrete Asset type (e.g. AssetA), usable with AssetContainer, AssetLibrary and References.
|
||||||
|
*/
|
||||||
|
template<class ASSET>
|
||||||
|
concept AssetType = std::derived_from<ASSET, AssetBase> && !std::same_as<ASSET, AssetBase> &&
|
||||||
|
requires(const ASSET& p_asset) {
|
||||||
|
{ ASSET::GetTypeID() } -> std::convertible_to<AssetTypeID>;
|
||||||
|
{ p_asset.GetHeader().uuid } -> std::convertible_to<UUID>;
|
||||||
|
};
|
||||||
|
} // namespace Bigfoot
|
||||||
|
#endif
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
|
#ifndef BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
|
||||||
#define BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
|
#define BIGFOOT_ENGINE_ASSET_ASSETCONTAINER_HPP
|
||||||
#include <Engine/Asset/Asset.hpp>
|
#include <Engine/Asset/Asset.hpp>
|
||||||
|
#include <Engine/Asset/AssetConcepts.hpp>
|
||||||
#include <Engine/EngineAssertHandler.hpp>
|
#include <Engine/EngineAssertHandler.hpp>
|
||||||
|
|
||||||
#include <Utils/Containers/SlotMap.hpp>
|
#include <Utils/Containers/SlotMap.hpp>
|
||||||
@@ -284,6 +285,7 @@ class AssetContainerBase
|
|||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
|
|
||||||
template<class ASSET>
|
template<class ASSET>
|
||||||
|
requires AssetType<ASSET>
|
||||||
class AssetContainer: public AssetContainerBase
|
class AssetContainer: public AssetContainerBase
|
||||||
{
|
{
|
||||||
using SlotMap = StableSlotMap<ASSET>;
|
using SlotMap = StableSlotMap<ASSET>;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
|
#ifndef BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
|
||||||
#define BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
|
#define BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
|
||||||
|
#include <Engine/Asset/AssetConcepts.hpp>
|
||||||
#include <Engine/Asset/AssetContainer.hpp>
|
#include <Engine/Asset/AssetContainer.hpp>
|
||||||
#include <Engine/Asset/AssetTypeID.hpp>
|
#include <Engine/Asset/AssetTypeID.hpp>
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ class AssetLibrary
|
|||||||
* \return The AssetContainer for the Asset type. Nullptr if not found
|
* \return The AssetContainer for the Asset type. Nullptr if not found
|
||||||
*/
|
*/
|
||||||
template<class ASSET>
|
template<class ASSET>
|
||||||
|
requires AssetType<ASSET>
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
bool Insert(AssetContainer<ASSET>* p_assetContainer)
|
bool Insert(AssetContainer<ASSET>* p_assetContainer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#ifndef BIGFOOT_ENGINE_ASSET_REFERENCE_HPP
|
#ifndef BIGFOOT_ENGINE_ASSET_REFERENCE_HPP
|
||||||
#define BIGFOOT_ENGINE_ASSET_REFERENCE_HPP
|
#define BIGFOOT_ENGINE_ASSET_REFERENCE_HPP
|
||||||
|
#include <Engine/Asset/AssetConcepts.hpp>
|
||||||
#include <Engine/Asset/AssetLibrary.hpp>
|
#include <Engine/Asset/AssetLibrary.hpp>
|
||||||
|
|
||||||
#include <System/UUID/UUID.hpp>
|
#include <System/UUID/UUID.hpp>
|
||||||
@@ -43,6 +44,7 @@ class ReferenceBase
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
const ASSET* Get() const
|
const ASSET* Get() const
|
||||||
{
|
{
|
||||||
|
static_assert(AssetType<ASSET>, "ASSET must derive from AssetBase (and not be AssetBase itself)");
|
||||||
return m_handle ? static_cast<const ASSET*>(m_handle->GetAsset()) : nullptr;
|
return m_handle ? static_cast<const ASSET*>(m_handle->GetAsset()) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +56,7 @@ class ReferenceBase
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
ASSET* Get()
|
ASSET* Get()
|
||||||
{
|
{
|
||||||
|
static_assert(AssetType<ASSET>, "ASSET must derive from AssetBase (and not be AssetBase itself)");
|
||||||
return m_handle ? static_cast<ASSET*>(m_handle->GetAsset()) : nullptr;
|
return m_handle ? static_cast<ASSET*>(m_handle->GetAsset()) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user