SpiecsEngine
 
Loading...
Searching...
No Matches
Spices::RuntimeWorld Class Reference

RuntimeWorld Class. This class defines the specific behave of RuntimeWorld. More...

#include <RuntimeWorld.h>

Inheritance diagram for Spices::RuntimeWorld:
Spices::World

Public Member Functions

 RuntimeWorld ()=default
 Constructor Function.
 
virtual ~RuntimeWorld () override=default
 Destructor Function.
 
virtual void OnPreActivate () override
 This interface define the specific world behave before on activated.
 
virtual void OnActivate (TimeStep &ts) override
 This interface define the specific world behave on activated.
 
virtual void OnDeactivate () override
 This interface defines the specific world behave after on activated.
 

Private Types

enum  WorldMarkBits {
  Clean = 0x00000001 , MeshAddedToWorld = 0x00000002 , FrushStableFrame = 0x00000004 , NeedUpdateTLAS = 0x00000008 ,
  MAX = 0x7FFFFFFF
}
 
typedef uint32_t WorldMarkFlags
 

Private Member Functions

Entity CreateEntity (const std::string &name="None")
 Create a new empty entity in this world.
 
Entity CreateEntityWithUUID (UUID uuid, const std::string &name="None")
 Create a new empty entity with a uuid in this world.
 
void DestroyEntity (Entity &entity)
 Destroy a entity from this world.
 
entt::registry & GetRegistry ()
 Get Registry variable.
 
Entity QueryEntitybyID (uint32_t id)
 Get World Entity by id(entt::entity).
 
WorldMarkFlags GetMarker () const
 Get WorldMarkFlags this frame.
 
void Mark (WorldMarkFlags flags)
 Mark WorldMarkFlags with flags.
 
void ReserMark ()
 Reset WorldMarkFlags to Clean.
 
void ClearMarkerWithBits (WorldMarkFlags flags)
 Clear WorldMarkFlags with flags.
 
template<typename T , typename F >
void ViewComponent (F &&fn)
 View all component in this world.
 
template<typename T , typename F >
void ViewComponent (const std::vector< uint32_t > &ranges, F &&fn)
 View all component in this world in ranges.
 
template<typename T , typename F >
void ViewComponent (const std::vector< uint32_t > &ranges, uint32_t floor, uint32_t ceil, F &&fn)
 View all component in this world in ranges.
 
template<typename F >
void ViewRoot (F &&fn)
 View all root in this world.
 
template<typename T , typename... Args>
T & AddComponent (entt::entity e, Args &&... args)
 Template Function. Used for add specific component to entity.
 
template<typename T >
T & GetComponent (entt::entity e)
 Get Component owned by this entity.
 
template<typename T >
void RemoveComponent (entt::entity e)
 Remove Component owned from this entity.
 
template<typename T >
bool HasComponent (entt::entity e)
 If Component is owned by this entity or not.
 
void RemoveFromRoot (Entity &entity)
 Remove a entity from this world root.
 
void AddToRoot (Entity &entity)
 Add a entity to this world root.
 
bool IsRootEntity (Entity &entity)
 Determine if a entity is in root.
 
Entity CreateEmptyEntity (UUID uuid)
 
template<typename T >
void OnComponentAdded (Entity *entity, T &component)
 Called On any Component Added to this world.
 

Private Attributes

std::shared_mutex m_Mutex
 Mutex for world.
 
entt::registry m_Registry
 This variable handles all entity.
 
std::unordered_map< UUID, entt::entity > m_RootEntityMap
 This variable is a cache. @noto Not in use now.
 
WorldMarkFlags m_Marker = WorldMarkBits::Clean
 World State this frame.
 

Detailed Description

RuntimeWorld Class. This class defines the specific behave of RuntimeWorld.

Definition at line 17 of file RuntimeWorld.h.


The documentation for this class was generated from the following files: