class Entity
Represents an entity instance.
File location: framework/cauldron/framework/inc/core/entity.h
Construction
Return type |
Description |
---|---|
Entity (const wchar_t* name, Entity* parent = nullptr)
Constructor. Sets the entity’s name and parent in the scene hierarchy (if present)
|
Methods
Return type |
Description |
---|---|
void |
SetTransform (const Mat4 & transform)
Sets the entity’s transform.
|
void |
SetPrevTransform (const Mat4 & transform)
Sets the entity’s previous transform.
|
Mat4 & |
GetTransform ()
Gets the entity’s current transform.
|
const Mat4 & |
GetTransform () const
|
Mat4 & |
Gets the entity’s previous transform.
|
const Mat4 & |
GetPrevTransform () const
|
void |
SetParent (Entity* parent)
Sets an entity’s parent entity.
|
Entity* |
GetParent ()
Gets an entity’s parent entity.
|
bool |
IsActive () const
Query entity status.
|
void |
SetActive (bool active)
Sets entity status.
|
const wchar_t* |
GetName () const
Gets the entity’s name.
|
void |
AddChildEntity (Entity* pEntity)
Adds a child entity to this entity (parent).
|
uint32_t |
GetChildCount () const
Returns the child count of an entity.
|
const std::vector<Entity*>& |
GetChildren () const
Returns the list of children from an entity.
|
void |
AddComponent (Component * pComponent)
Adds a component to the entity.
|
void |
RemoveComponent (Component * pComponent)
Removes a component from the entity.
|
bool |
HasComponent (const ComponentMgr * pManager) const
Checks if an entity has a specified component type (matched to “ComponentMgr“).
|
template <typename T> T* |
GetComponent (const ComponentMgr * pManager) const
Retrieves a component from an entity by type (matched to “ComponentMgr“).
|
Detailed description
Represents an entity instance. An entity is any node that is present in our scene representation. It can be a simple transform or contain multiple components adding various functionality support to the entity (i.e. Mesh, Lighting, Camera, Animation, etc.)
Construction
Entity
Constructor. Sets the entity’s name and parent in the scene hierarchy (if present)
Methods
SetTransform
void SetTransform (const Mat4 & transform)
Sets the entity’s transform.
SetPrevTransform
void SetPrevTransform (const Mat4 & transform)
Sets the entity’s previous transform.
GetTransform
Mat4 & GetTransform ()
Gets the entity’s current transform.
GetPrevTransform
Mat4 & GetPrevTransform ()
Gets the entity’s previous transform.
SetParent
Sets an entity’s parent entity.
GetParent
Gets an entity’s parent entity.
IsActive
Query entity status.
SetActive
Sets entity status.
GetName
Gets the entity’s name.
AddChildEntity
Adds a child entity to this entity (parent).
GetChildCount
Returns the child count of an entity.
GetChildren
Returns the list of children from an entity.
AddComponent
void AddComponent (Component * pComponent)
Adds a component to the entity.
RemoveComponent
void RemoveComponent (Component * pComponent)
Removes a component from the entity.
HasComponent
bool HasComponent (const ComponentMgr * pManager) const
Checks if an entity has a specified component type (matched to ComponentMgr
).
GetComponent
template <typename T> T* GetComponent (const ComponentMgr * pManager) const
Retrieves a component from an entity by type (matched to ComponentMgr
).