Fix acronym naming standard
- Now follow standard that acronyms should only capitalize the first letter
This commit is contained in:
@@ -233,7 +233,7 @@
|
||||
<ClCompile Include="src\copium\buffer\VertexBuffer.cpp" />
|
||||
<ClCompile Include="src\copium\pipeline\VertexDescriptor.cpp" />
|
||||
<ClCompile Include="src\copium\mesh\VertexPassthrough.cpp" />
|
||||
<ClCompile Include="src\copium\util\UUID.cpp" />
|
||||
<ClCompile Include="src\copium\util\Uuid.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\copium\asset\Asset.h" />
|
||||
@@ -313,7 +313,7 @@
|
||||
<ClInclude Include="src\copium\mesh\Vertex.h" />
|
||||
<ClInclude Include="src\copium\buffer\VertexBuffer.h" />
|
||||
<ClInclude Include="src\copium\pipeline\VertexDescriptor.h" />
|
||||
<ClInclude Include="src\copium\util\UUID.h" />
|
||||
<ClInclude Include="src\copium\util\Uuid.h" />
|
||||
<ClInclude Include="src\copium\util\VulkanException.h" />
|
||||
<ClInclude Include="src\copium\mesh\VertexPassthrough.h" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
<ClCompile Include="src\copium\pipeline\ShaderBinding.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\copium\util\UUID.cpp">
|
||||
<ClCompile Include="src\copium\util\Uuid.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\copium\asset\AssetManager.cpp">
|
||||
@@ -329,7 +329,7 @@
|
||||
<ClInclude Include="src\copium\pipeline\ShaderBinding.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\copium\util\UUID.h">
|
||||
<ClInclude Include="src\copium\util\Uuid.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\copium\asset\AssetMeta.h">
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Copium
|
||||
return metaData.name;
|
||||
}
|
||||
|
||||
UUID Asset::GetUUID() const
|
||||
Uuid Asset::GetUuid() const
|
||||
{
|
||||
return metaData.uuid;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/util/MetaFile.h"
|
||||
#include "copium/util/UUID.h"
|
||||
#include "copium/util/Uuid.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Copium
|
||||
|
||||
AssetHandle GetHandle() const;
|
||||
const std::string& GetName() const;
|
||||
UUID GetUUID() const;
|
||||
Uuid GetUuid() const;
|
||||
bool isRuntime() const;
|
||||
|
||||
operator AssetHandle() const;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Copium
|
||||
return path;
|
||||
}
|
||||
|
||||
UUID AssetFile::GetUUID() const
|
||||
Uuid AssetFile::GetUuid() const
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace Copium
|
||||
void AssetFile::Load(const MetaFile& metaFile, const std::string& className)
|
||||
{
|
||||
const MetaFileClass& metaClass = metaFile.GetMetaClass(className);
|
||||
uuid = UUID{metaClass.GetValue("uuid")};
|
||||
uuid = Uuid{metaClass.GetValue("uuid")};
|
||||
dateModified = FileSystem::DateModified(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/util/MetaFile.h"
|
||||
#include "copium/util/UUID.h"
|
||||
#include "copium/util/Uuid.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
@@ -12,7 +12,7 @@ namespace Copium
|
||||
private:
|
||||
static std::vector<std::string> assetTypes;
|
||||
std::string path;
|
||||
UUID uuid;
|
||||
Uuid uuid;
|
||||
int64_t dateModified;
|
||||
|
||||
public:
|
||||
@@ -22,7 +22,7 @@ namespace Copium
|
||||
void Load();
|
||||
|
||||
const std::string& GetPath() const;
|
||||
UUID GetUUID() const;
|
||||
Uuid GetUuid() const;
|
||||
private:
|
||||
void Load(const MetaFile& metaFile, const std::string& className);
|
||||
static void RegisterAssetType(const std::string& assetType);
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
|
||||
Asset& AssetManager::LoadAsset(const UUID& uuid)
|
||||
Asset& AssetManager::LoadAsset(const Uuid& uuid)
|
||||
{
|
||||
CP_DEBUG("Loading uuid Asset: %s", uuid.ToString().c_str());
|
||||
for (auto&& assetFile : cachedAssetFiles)
|
||||
@@ -91,7 +91,7 @@ namespace Copium
|
||||
if (assetFile.NeedReload())
|
||||
assetFile.Load();
|
||||
|
||||
if (assetFile.GetUUID() != uuid)
|
||||
if (assetFile.GetUuid() != uuid)
|
||||
continue;
|
||||
|
||||
return LoadAssetFromPath(assetFile.GetPath());
|
||||
@@ -145,7 +145,7 @@ namespace Copium
|
||||
Asset* asset2 = assets.emplace(handle, std::move(asset)).first->second.get();
|
||||
asset2->metaData.handle = handle;
|
||||
asset2->metaData.name = name;
|
||||
asset2->metaData.uuid = UUID();
|
||||
asset2->metaData.uuid = Uuid();
|
||||
asset2->metaData.isRuntime = true;
|
||||
nameToAssetCache.emplace(name, handle);
|
||||
return *asset2;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Copium
|
||||
static void UnregisterAssetDir(std::string assetDir);
|
||||
static Asset& GetAsset(AssetHandle handle);
|
||||
static Asset& LoadAsset(const std::string& assetPath);
|
||||
static Asset& LoadAsset(const UUID& uuid);
|
||||
static Asset& LoadAsset(const Uuid& uuid);
|
||||
static void UnloadAsset(AssetHandle handle);
|
||||
static Asset& RegisterRuntimeAsset(const std::string& name, std::unique_ptr<Asset>&& asset);
|
||||
static void Cleanup();
|
||||
@@ -51,7 +51,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename AssetT>
|
||||
static AssetT& LoadAsset(const UUID& uuid)
|
||||
static AssetT& LoadAsset(const Uuid& uuid)
|
||||
{
|
||||
AssetT* asset = dynamic_cast<AssetT*>(&LoadAsset(uuid));
|
||||
CP_ASSERT(asset, "Invalid Asset cast");
|
||||
@@ -86,7 +86,7 @@ namespace Copium
|
||||
Asset& asset = *assets.emplace(handle, std::make_unique<T>(metaFile)).first->second.get();
|
||||
asset.metaData.handle = handle;
|
||||
asset.metaData.name = metaFile.GetFilePath();
|
||||
asset.metaData.uuid = UUID{metaFile.GetMetaClass(metaFileClass).GetValue("uuid")};
|
||||
asset.metaData.uuid = Uuid{metaFile.GetMetaClass(metaFileClass).GetValue("uuid")};
|
||||
asset.metaData.isRuntime = false;
|
||||
return asset;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/util/UUID.h"
|
||||
#include "copium/util/Uuid.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
@@ -14,7 +14,7 @@ namespace Copium
|
||||
{
|
||||
AssetHandle handle;
|
||||
std::string name;
|
||||
UUID uuid;
|
||||
Uuid uuid;
|
||||
bool isRuntime = false;
|
||||
int loadCount = 1;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Copium
|
||||
Framebuffer::Framebuffer(const MetaFile& metaFile)
|
||||
{
|
||||
const MetaFileClass& metaClass = metaFile.GetMetaClass("Framebuffer");
|
||||
ColorAttachment& attachment = AssetManager::LoadAsset<ColorAttachment>(UUID{metaClass.GetValue("rendertexture-uuid")});
|
||||
ColorAttachment& attachment = AssetManager::LoadAsset<ColorAttachment>(Uuid{metaClass.GetValue("rendertexture-uuid")});
|
||||
colorAttachment = attachment;
|
||||
width = attachment.GetWidth();
|
||||
height = attachment.GetHeight();
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Copium
|
||||
|
||||
std::sort(devicePriorities.begin(), devicePriorities.end(), [](const std::pair<VkPhysicalDevice, uint32_t>& lhs, const std::pair<VkPhysicalDevice, uint32_t>& rhs) { return lhs.second > rhs.second; });
|
||||
auto&& it = devicePriorities.begin();
|
||||
CP_ASSERT(it->second != 0, "Failed to find suitable GPU");
|
||||
CP_ASSERT(it->second != 0, "Failed to find suitable gpu");
|
||||
|
||||
VkPhysicalDeviceProperties deviceProperties;
|
||||
vkGetPhysicalDeviceProperties(it->first, &deviceProperties);
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace Copium
|
||||
std::vector<Component> components;
|
||||
|
||||
public:
|
||||
ComponentPool(EntityID entity, const Component& component)
|
||||
ComponentPool(EntityId entity, const Component& component)
|
||||
{
|
||||
Emplace(entity, component);
|
||||
}
|
||||
|
||||
Component& Emplace(EntityID entity, const Component& component)
|
||||
Component& Emplace(EntityId entity, const Component& component)
|
||||
{
|
||||
components.push_back(component);
|
||||
entities.Emplace(entity);
|
||||
@@ -34,7 +34,7 @@ namespace Copium
|
||||
entities.Pop();
|
||||
}
|
||||
|
||||
bool Erase(EntityID entity)
|
||||
bool Erase(EntityId entity)
|
||||
{
|
||||
size_t index = entities.Find(entity);
|
||||
if (!entities.Erase(entity))
|
||||
@@ -48,12 +48,12 @@ namespace Copium
|
||||
return operator[](index);
|
||||
}
|
||||
|
||||
size_t Find(EntityID entity)
|
||||
size_t Find(EntityId entity)
|
||||
{
|
||||
return entities.Find(entity);
|
||||
}
|
||||
|
||||
Component* FindComponent(EntityID entity)
|
||||
Component* FindComponent(EntityId entity)
|
||||
{
|
||||
size_t index = Find(entity);
|
||||
if (index < Size())
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
std::vector<EntityID>& ComponentPoolBase::GetEntities()
|
||||
std::vector<EntityId>& ComponentPoolBase::GetEntities()
|
||||
{
|
||||
return entities.GetList();
|
||||
}
|
||||
|
||||
const std::vector<EntityID>& ComponentPoolBase::GetEntities() const
|
||||
const std::vector<EntityId>& ComponentPoolBase::GetEntities() const
|
||||
{
|
||||
return entities.GetList();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace Copium
|
||||
|
||||
virtual size_t Size() = 0;
|
||||
virtual void Pop() = 0;
|
||||
virtual bool Erase(EntityID entity) = 0;
|
||||
std::vector<EntityID>& GetEntities();
|
||||
const std::vector<EntityID>& GetEntities() const;
|
||||
virtual bool Erase(EntityId entity) = 0;
|
||||
std::vector<EntityId>& GetEntities();
|
||||
const std::vector<EntityId>& GetEntities() const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
using EntityID = uint32_t;
|
||||
using EntityId = uint32_t;
|
||||
const static uint32_t MAX_NUM_ENTITIES = std::numeric_limits<uint32_t>::max();
|
||||
const static uint32_t INVALID_ENTITY = 0;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Copium
|
||||
return entities.size();
|
||||
}
|
||||
|
||||
EntityID ECSManager::CreateEntity()
|
||||
EntityId ECSManager::CreateEntity()
|
||||
{
|
||||
CP_ASSERT(currentEntityId != MAX_NUM_ENTITIES, "No more entities available");
|
||||
entities.emplace(currentEntityId);
|
||||
@@ -35,7 +35,7 @@ namespace Copium
|
||||
return currentEntityId - 1;
|
||||
}
|
||||
|
||||
void ECSManager::DestroyEntity(EntityID entity)
|
||||
void ECSManager::DestroyEntity(EntityId entity)
|
||||
{
|
||||
auto it = entities.find(entity);
|
||||
CP_ASSERT(it != entities.end(), "Entity does not exist in ECSManager (entity=%u)", entity);
|
||||
@@ -46,12 +46,12 @@ namespace Copium
|
||||
}
|
||||
}
|
||||
|
||||
bool ECSManager::ValidEntity(EntityID entity)
|
||||
bool ECSManager::ValidEntity(EntityId entity)
|
||||
{
|
||||
return entities.find(entity) != entities.end();
|
||||
}
|
||||
|
||||
void ECSManager::Each(std::function<void(EntityID)> function)
|
||||
void ECSManager::Each(std::function<void(EntityId)> function)
|
||||
{
|
||||
for (auto e : entities)
|
||||
function(e);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Copium
|
||||
class ECSManager final
|
||||
{
|
||||
private:
|
||||
std::unordered_set<EntityID> entities;
|
||||
std::unordered_set<EntityId> entities;
|
||||
std::map<std::type_index, ComponentPoolBase*> componentPool;
|
||||
|
||||
std::unique_ptr<SystemPool> systemPool;
|
||||
@@ -34,26 +34,26 @@ namespace Copium
|
||||
|
||||
void UpdateSystems();
|
||||
|
||||
EntityID CreateEntity();
|
||||
void DestroyEntity(EntityID entity);
|
||||
EntityId CreateEntity();
|
||||
void DestroyEntity(EntityId entity);
|
||||
size_t GetEntityCount() const;
|
||||
bool ValidEntity(EntityID entity);
|
||||
void Each(std::function<void(EntityID)> function);
|
||||
bool ValidEntity(EntityId entity);
|
||||
void Each(std::function<void(EntityId)> function);
|
||||
|
||||
template <typename... Components>
|
||||
std::tuple<Components&...> AddComponents(EntityID entity, Components&&... components)
|
||||
std::tuple<Components&...> AddComponents(EntityId entity, Components&&... components)
|
||||
{
|
||||
return std::forward_as_tuple(AddComponent(entity, Components(components))...);
|
||||
}
|
||||
|
||||
template <typename Component, typename... Args>
|
||||
Component& AddComponent(EntityID entity, Args&&... args)
|
||||
Component& AddComponent(EntityId entity, Args&&... args)
|
||||
{
|
||||
return AddComponent(entity, Component{args...});
|
||||
}
|
||||
|
||||
template <typename Component>
|
||||
Component& AddComponent(EntityID entity, const Component& component)
|
||||
Component& AddComponent(EntityId entity, const Component& component)
|
||||
{
|
||||
auto pool = GetComponentPool<Component>();
|
||||
|
||||
@@ -71,20 +71,20 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename Component>
|
||||
void RemoveComponent(EntityID entity)
|
||||
void RemoveComponent(EntityId entity)
|
||||
{
|
||||
auto pool = GetComponentPoolAssure<Component>();
|
||||
CP_ASSERT(pool->Erase(entity), "Entity did not contain component (entity=%u, Component=%s)", entity, typeid(Component).name());
|
||||
}
|
||||
|
||||
template <typename... Components>
|
||||
void RemoveComponents(EntityID entity)
|
||||
void RemoveComponents(EntityId entity)
|
||||
{
|
||||
(RemoveComponent<Components>(entity), ...);
|
||||
}
|
||||
|
||||
template <typename Component>
|
||||
Component& GetComponent(EntityID entity)
|
||||
Component& GetComponent(EntityId entity)
|
||||
{
|
||||
auto pool = GetComponentPoolAssure<Component>();
|
||||
Component* component = pool->FindComponent(entity);
|
||||
@@ -93,7 +93,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename Component>
|
||||
bool HasComponent(EntityID entity)
|
||||
bool HasComponent(EntityId entity)
|
||||
{
|
||||
auto pool = GetComponentPool<Component>();
|
||||
if (pool)
|
||||
@@ -102,13 +102,13 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename... Components>
|
||||
bool HasComponents(EntityID entity)
|
||||
bool HasComponents(EntityId entity)
|
||||
{
|
||||
return (HasComponent<Components>(entity) && ...);
|
||||
}
|
||||
|
||||
template <typename... Components>
|
||||
bool HasAnyComponent(EntityID entity)
|
||||
bool HasAnyComponent(EntityId entity)
|
||||
{
|
||||
return (HasComponent<Components>(entity) || ...);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename Component>
|
||||
void Each(std::function<void(EntityID, Component&)> function)
|
||||
void Each(std::function<void(EntityId, Component&)> function)
|
||||
{
|
||||
auto pool = GetComponentPool<Component>();
|
||||
if (pool)
|
||||
@@ -147,7 +147,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename Component, typename... Components, typename Func>
|
||||
EntityID Find(Func function)
|
||||
EntityId Find(Func function)
|
||||
{
|
||||
auto pool = GetComponentPool<Component>();
|
||||
if (pool)
|
||||
@@ -167,7 +167,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
template <typename Component>
|
||||
EntityID Find(std::function<bool(EntityID, Component&)> function)
|
||||
EntityId Find(std::function<bool(EntityId, Component&)> function)
|
||||
{
|
||||
auto pool = GetComponentPool<Component>();
|
||||
if (pool)
|
||||
|
||||
@@ -10,16 +10,16 @@ namespace Copium
|
||||
: manager{manager}, id{INVALID_ENTITY}
|
||||
{}
|
||||
|
||||
Entity::Entity(ECSManager* manager, EntityID id)
|
||||
Entity::Entity(ECSManager* manager, EntityId id)
|
||||
: manager{manager}, id{id}
|
||||
{}
|
||||
|
||||
Entity::operator EntityID() const
|
||||
Entity::operator EntityId() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
void Entity::operator=(EntityID entityId)
|
||||
void Entity::operator=(EntityId entityId)
|
||||
{
|
||||
id = entityId;
|
||||
}
|
||||
@@ -54,12 +54,12 @@ namespace Copium
|
||||
manager->DestroyEntity(id);
|
||||
}
|
||||
|
||||
void Entity::SetID(EntityID aId)
|
||||
void Entity::SetId(EntityId entityId)
|
||||
{
|
||||
id = aId;
|
||||
id = entityId;
|
||||
}
|
||||
|
||||
EntityID Entity::GetID() const
|
||||
EntityId Entity::GetId() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -11,23 +11,23 @@ namespace Copium
|
||||
|
||||
private:
|
||||
ECSManager* manager;
|
||||
EntityID id;
|
||||
EntityId id;
|
||||
|
||||
public:
|
||||
Entity();
|
||||
Entity(ECSManager* manager);
|
||||
Entity(ECSManager* manager, EntityID id);
|
||||
Entity(ECSManager* manager, EntityId id);
|
||||
|
||||
operator EntityID() const;
|
||||
void operator=(EntityID entityId);
|
||||
operator EntityId() const;
|
||||
void operator=(EntityId entityId);
|
||||
bool operator==(const Entity& entity);
|
||||
bool operator!=(const Entity& entity);
|
||||
operator bool() const;
|
||||
|
||||
void Invalidate();
|
||||
void Destroy();
|
||||
void SetID(EntityID aId);
|
||||
EntityID GetID() const;
|
||||
void SetId(EntityId entityId);
|
||||
EntityId GetId() const;
|
||||
ECSManager* GetManager() const;
|
||||
|
||||
static Entity Create(ECSManager* manager);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
bool EntitySet::Emplace(EntityID entity)
|
||||
bool EntitySet::Emplace(EntityId entity)
|
||||
{
|
||||
auto res = entitiesMap.emplace(entity, entitiesList.size());
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Copium
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EntitySet::Erase(EntityID entity)
|
||||
bool EntitySet::Erase(EntityId entity)
|
||||
{
|
||||
auto it = entitiesMap.find(entity);
|
||||
if (it == entitiesMap.end())
|
||||
@@ -42,7 +42,7 @@ namespace Copium
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t EntitySet::Find(EntityID entity)
|
||||
size_t EntitySet::Find(EntityId entity)
|
||||
{
|
||||
auto it = entitiesMap.find(entity);
|
||||
if (it == entitiesMap.end())
|
||||
@@ -55,9 +55,9 @@ namespace Copium
|
||||
return entitiesList.size();
|
||||
}
|
||||
|
||||
std::vector<EntityID>& EntitySet::GetList() { return entitiesList; }
|
||||
const std::vector<EntityID>& EntitySet::GetList() const { return entitiesList; }
|
||||
std::vector<EntityId>& EntitySet::GetList() { return entitiesList; }
|
||||
const std::vector<EntityId>& EntitySet::GetList() const { return entitiesList; }
|
||||
|
||||
std::vector<EntityID>::iterator EntitySet::begin() { return entitiesList.begin(); }
|
||||
std::vector<EntityID>::iterator EntitySet::end() { return entitiesList.end(); }
|
||||
std::vector<EntityId>::iterator EntitySet::begin() { return entitiesList.begin(); }
|
||||
std::vector<EntityId>::iterator EntitySet::end() { return entitiesList.end(); }
|
||||
}
|
||||
|
||||
@@ -10,18 +10,18 @@ namespace Copium
|
||||
class EntitySet
|
||||
{
|
||||
private:
|
||||
std::vector<EntityID> entitiesList;
|
||||
std::unordered_map<EntityID, size_t> entitiesMap; // Maps the entity id to a component index
|
||||
std::vector<EntityId> entitiesList;
|
||||
std::unordered_map<EntityId, size_t> entitiesMap; // Maps the entity id to a component index
|
||||
public:
|
||||
bool Emplace(EntityID entity);
|
||||
bool Erase(EntityID entity);
|
||||
bool Emplace(EntityId entity);
|
||||
bool Erase(EntityId entity);
|
||||
bool Pop();
|
||||
size_t Find(EntityID entity);
|
||||
size_t Find(EntityId entity);
|
||||
size_t Size() const;
|
||||
std::vector<EntityID>& GetList();
|
||||
const std::vector<EntityID>& GetList() const;
|
||||
std::vector<EntityId>& GetList();
|
||||
const std::vector<EntityId>& GetList() const;
|
||||
|
||||
std::vector<EntityID>::iterator begin();
|
||||
std::vector<EntityID>::iterator end();
|
||||
std::vector<EntityId>::iterator begin();
|
||||
std::vector<EntityId>::iterator end();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Copium
|
||||
public:
|
||||
void Run() override
|
||||
{
|
||||
manager->Each<Components...>([&](EntityID entityId, Components&... components) { RunEntity(Entity{manager, entityId}, components...); });
|
||||
manager->Each<Components...>([&](EntityId entityId, Components&... components) { RunEntity(Entity{manager, entityId}, components...); });
|
||||
}
|
||||
|
||||
virtual void RunEntity(Entity entity, Components&... components) = 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Copium
|
||||
VkRenderPass renderPass;
|
||||
if (metaFileClass.HasValue("framebuffer-uuid"))
|
||||
{
|
||||
Framebuffer& fb = AssetManager::LoadAsset<Framebuffer>(UUID{metaFileClass.GetValue("framebuffer-uuid")});
|
||||
Framebuffer& fb = AssetManager::LoadAsset<Framebuffer>(Uuid{metaFileClass.GetValue("framebuffer-uuid")});
|
||||
renderPass = fb.GetRenderPass();
|
||||
framebuffer = fb;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#include "copium/util/UUID.h"
|
||||
#include "copium/util/Uuid.h"
|
||||
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
std::random_device UUID::randomDevice{};
|
||||
std::mt19937 UUID::randomGenerator{randomDevice()};
|
||||
std::uniform_int_distribution<uint64_t> UUID::randomDistribution{std::numeric_limits<uint64_t>::min(), std::numeric_limits<uint64_t>::max()};
|
||||
std::random_device Uuid::randomDevice{};
|
||||
std::mt19937 Uuid::randomGenerator{randomDevice()};
|
||||
std::uniform_int_distribution<uint64_t> Uuid::randomDistribution{std::numeric_limits<uint64_t>::min(), std::numeric_limits<uint64_t>::max()};
|
||||
|
||||
UUID::UUID()
|
||||
Uuid::Uuid()
|
||||
: msb{randomDistribution(randomGenerator)}, lsb{randomDistribution(randomGenerator)}
|
||||
{}
|
||||
|
||||
UUID::UUID(uint64_t msb, uint64_t lsb)
|
||||
Uuid::Uuid(uint64_t msb, uint64_t lsb)
|
||||
: msb{msb}, lsb{lsb}
|
||||
{}
|
||||
|
||||
UUID::UUID(const std::string& uuidString)
|
||||
Uuid::Uuid(const std::string& uuidString)
|
||||
: msb{0}, lsb{0}
|
||||
{
|
||||
CP_ASSERT(uuidString.size() == 36, "Invalid UUID string size: %s", uuidString.c_str());
|
||||
CP_ASSERT(uuidString.size() == 36, "Invalid Uuid string size: %s", uuidString.c_str());
|
||||
for (int i = 0; i < 18; i++)
|
||||
{
|
||||
if (i == 8 || i == 13) // skip "-"
|
||||
@@ -37,7 +37,7 @@ namespace Copium
|
||||
}
|
||||
}
|
||||
|
||||
std::string UUID::ToString() const
|
||||
std::string Uuid::ToString() const
|
||||
{
|
||||
std::string string;
|
||||
string.reserve(36);
|
||||
@@ -55,36 +55,36 @@ namespace Copium
|
||||
return string;
|
||||
}
|
||||
|
||||
bool UUID::operator==(const UUID& rhs)
|
||||
bool Uuid::operator==(const Uuid& rhs)
|
||||
{
|
||||
return msb == rhs.msb && lsb == rhs.lsb;
|
||||
}
|
||||
|
||||
bool UUID::operator!=(const UUID& rhs)
|
||||
bool Uuid::operator!=(const Uuid& rhs)
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool UUID::operator<(const UUID& rhs)
|
||||
bool Uuid::operator<(const Uuid& rhs)
|
||||
{
|
||||
if (msb != rhs.msb)
|
||||
return msb < rhs.msb;
|
||||
return lsb < rhs.lsb;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const UUID& uuid)
|
||||
std::ostream& operator<<(std::ostream& os, const Uuid& uuid)
|
||||
{
|
||||
return os << uuid.ToString();
|
||||
}
|
||||
|
||||
uint8_t UUID::HexToDec(char c) const
|
||||
uint8_t Uuid::HexToDec(char c) const
|
||||
{
|
||||
if (c >= '0' && c <= '9') return c - '0';
|
||||
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
||||
CP_ABORT("Invalid char value: %c (%d)", c, (int)c);
|
||||
}
|
||||
|
||||
char UUID::DecToHex(uint8_t nibble) const
|
||||
char Uuid::DecToHex(uint8_t nibble) const
|
||||
{
|
||||
if (nibble >= 0 && nibble <= 9) return '0' + nibble;
|
||||
if (nibble >= 10 && nibble <= 15) return 'a' + nibble - 10;
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
class UUID
|
||||
class Uuid
|
||||
{
|
||||
private:
|
||||
uint64_t msb;
|
||||
@@ -15,18 +15,18 @@ namespace Copium
|
||||
static std::mt19937 randomGenerator;
|
||||
static std::uniform_int_distribution<uint64_t> randomDistribution;
|
||||
public:
|
||||
UUID();
|
||||
UUID(uint64_t msb, uint64_t lsb);
|
||||
Uuid();
|
||||
Uuid(uint64_t msb, uint64_t lsb);
|
||||
// Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
UUID(const std::string& uuidString);
|
||||
Uuid(const std::string& uuidString);
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
bool operator==(const UUID& rhs);
|
||||
bool operator!=(const UUID& rhs);
|
||||
bool operator<(const UUID& rhs);
|
||||
bool operator==(const Uuid& rhs);
|
||||
bool operator!=(const Uuid& rhs);
|
||||
bool operator<(const Uuid& rhs);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const UUID& uuid);
|
||||
friend std::ostream& operator<<(std::ostream& os, const Uuid& uuid);
|
||||
|
||||
private:
|
||||
uint8_t HexToDec(char c) const;
|
||||
Reference in New Issue
Block a user