SpiecsEngine
 
Loading...
Searching...
No Matches

◆ ViewComponent() [2/3]

template<typename T , typename F >
void Spices::World::ViewComponent ( const std::vector< uint32_t > & ranges,
uint32_t floor,
uint32_t ceil,
F && fn )
inline

View all component in this world in ranges.

Template Parameters
TComponent.
Parameters
[in]rangesview ranges.
[in]floorranges floor.
[in]ceilranges ceil.
fnView function.

Definition at line 309 of file World.h.

310 {
312
313 std::shared_lock<std::shared_mutex> lock(m_Mutex);
314
315 assert(floor >= 0);
316 assert(ceil >= floor);
317 assert(ceil <= ranges.size() - 1);
318
319 for(int32_t i = floor; i < ceil; i++)
320 {
321 auto e = static_cast<entt::entity>(ranges[i]);
322 auto& comp = m_Registry.get<T>(e);
323
324 fn(e, comp);
325 }
326 }
#define SPICES_PROFILE_ZONE
entt::registry m_Registry
This variable handles all entity.
Definition World.h:250
std::shared_mutex m_Mutex
Mutex for world.
Definition World.h:245