|
|
|
@ -25,6 +25,10 @@
|
|
|
|
|
|
|
|
|
|
namespace SHADE
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef SHFamilyID<SHComponent> ComponentFamily;
|
|
|
|
|
|
|
|
|
|
class SHComponentManager
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
@ -36,6 +40,8 @@ namespace SHADE
|
|
|
|
|
|
|
|
|
|
friend struct SHSceneNode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
@ -225,7 +231,7 @@ namespace SHADE
|
|
|
|
|
* \return
|
|
|
|
|
* none
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
static void AddComponent(EntityID entityID, uint32_t componentTypeID) noexcept
|
|
|
|
|
static void AddComponent(EntityID entityID, ComponentTypeID componentTypeID) noexcept
|
|
|
|
|
{
|
|
|
|
|
componentSet.GetSparseSet_ID(componentTypeID)->Add(EntityHandleGenerator::GetIndex(entityID));
|
|
|
|
|
|
|
|
|
@ -277,7 +283,7 @@ namespace SHADE
|
|
|
|
|
* \return bool
|
|
|
|
|
* True if the entity has a component of specified type.
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
static bool HasComponent_ID(EntityID entityID, uint32_t componentTypeID) noexcept;
|
|
|
|
|
static bool HasComponent_ID(EntityID entityID, ComponentTypeID componentTypeID) noexcept;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!*************************************************************************
|
|
|
|
@ -362,7 +368,7 @@ namespace SHADE
|
|
|
|
|
* \return
|
|
|
|
|
*
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
static void SwapInDenseByIndexHash_ID(EntityIndex index, EntityID hash, uint32_t componentTypeID) noexcept;
|
|
|
|
|
static void SwapInDenseByIndexHash_ID(EntityIndex index, EntityID hash, ComponentTypeID componentTypeID) noexcept;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -385,7 +391,7 @@ namespace SHADE
|
|
|
|
|
* \return
|
|
|
|
|
* The number of components in the component sparse set.
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
static EntityIndex ComponentCount_ID(uint32_t componentTypeID)
|
|
|
|
|
static EntityIndex ComponentCount_ID(ComponentTypeID componentTypeID)
|
|
|
|
|
{
|
|
|
|
|
return componentSet.GetSparseSet_ID(componentTypeID)->Count();
|
|
|
|
|
}
|
|
|
|
@ -402,9 +408,9 @@ namespace SHADE
|
|
|
|
|
static void SetActive(EntityID entityID, bool active) noexcept;
|
|
|
|
|
|
|
|
|
|
template<typename... T>
|
|
|
|
|
static std::enable_if_t<(... && std::is_base_of_v<SHComponent, T>), uint32_t> CreateComponentGroup(uint32_t numOwningComponents)
|
|
|
|
|
static std::enable_if_t<(... && std::is_base_of_v<SHComponent, T>), uint32_t> CreateComponentGroup(ComponentTypeID numOwningComponents)
|
|
|
|
|
{
|
|
|
|
|
std::vector<uint32_t> templateIDs{ (SHFamilyID<SHComponent>::GetID<T>())... };
|
|
|
|
|
std::vector<ComponentTypeID> templateIDs{ (ComponentFamily::GetID<T>())... };
|
|
|
|
|
|
|
|
|
|
for (auto& g : componentGroups)
|
|
|
|
|
{
|
|
|
|
@ -421,11 +427,11 @@ namespace SHADE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SHComponentGroup grp;
|
|
|
|
|
for (uint32_t i = 0; i < numOwningComponents; ++i)
|
|
|
|
|
for (ComponentTypeID i = 0; i < numOwningComponents; ++i)
|
|
|
|
|
{
|
|
|
|
|
grp.ownedComponentTypes.push_back(templateIDs[i]);
|
|
|
|
|
}
|
|
|
|
|
for (uint32_t i = 0; i < templateIDs.size(); ++i)
|
|
|
|
|
for (ComponentTypeID i = 0; i < templateIDs.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
grp.componentTypeIDs.push_back(templateIDs[i]);
|
|
|
|
|
}
|
|
|
|
|