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 &

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*

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

Copied!

Entity (const wchar_t* name, Entity* parent = nullptr)

Constructor. Sets the entity’s name and parent in the scene hierarchy (if present)


Methods

SetTransform

Copied!

void SetTransform (const Mat4 & transform)

Sets the entity’s transform.


SetPrevTransform

Copied!

void SetPrevTransform (const Mat4 & transform)

Sets the entity’s previous transform.


GetTransform

Copied!

Mat4 & GetTransform ()

Gets the entity’s current transform.


GetPrevTransform

Copied!

Mat4 & GetPrevTransform ()

Gets the entity’s previous transform.


SetParent

Copied!

void SetParent (Entity* parent)

Sets an entity’s parent entity.


GetParent

Copied!

Entity* GetParent ()

Gets an entity’s parent entity.


IsActive

Copied!

bool IsActive () const

Query entity status.


SetActive

Copied!

void SetActive (bool active)

Sets entity status.


GetName

Copied!

const wchar_t* GetName () const

Gets the entity’s name.


AddChildEntity

Copied!

void AddChildEntity (Entity* pEntity)

Adds a child entity to this entity (parent).


GetChildCount

Copied!

uint32_t GetChildCount () const

Returns the child count of an entity.


GetChildren

Copied!

const std::vector<Entity*>& GetChildren () const

Returns the list of children from an entity.


AddComponent

Copied!

void AddComponent (Component * pComponent)

Adds a component to the entity.


RemoveComponent

Copied!

void RemoveComponent (Component * pComponent)

Removes a component from the entity.


HasComponent

Copied!

bool HasComponent (const ComponentMgr * pManager) const

Checks if an entity has a specified component type (matched to ComponentMgr).


GetComponent

Copied!

template <typename T>   T* GetComponent (const ComponentMgr * pManager) const

Retrieves a component from an entity by type (matched to ComponentMgr).