Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::Actor Class Reference

An Actor is similar to an EngineCore::Entity. An actor is an Entity with a transform. More...

#include <Actor.h>

Inheritance diagram for EngineCore::Actor:
Collaboration diagram for EngineCore::Actor:

Public Member Functions

 Actor (std::shared_ptr< SceneNode > sceneNode, Scene *owningScene)
 ~Actor ()
virtual void beginPlay ()
 Gets executed when the actor is spawned into the world.
void tick (double deltaTime) override
 Executed every frame.
virtual void endPlay ()
glm::vec3 getActorLocation () const
 Gets the actors location in the world.
glm::vec3 getActorRotation () const
 Gets the actors rotation in the world.
glm::vec3 getActorScale () const
 Scales the actor to world scale.
void setActorLocation (glm::vec3 newLocation)
 Set the new world location for this actor.
void setActorRotation (glm::vec3 newRotation)
 Sets the world rotation.
void rotateActor (glm::vec3 deltaRotation)
 Applies an incremental rotation to the actor using quaternion multiplication. Use this instead of getActorRotation() + setActorRotation() for continuous rotation to avoid euler angle instability/jiggling.
void setActorScale (glm::vec3 newScale)
 sets the world scale for this actor
glm::mat4 getWorldTransform () const
 Gets the model matrix.
MeshComponentregisterMeshComponent (MeshComponent *meshComponent)
void unregisterMeshComponent (MeshComponent *meshComponent)
std::vector< MeshComponent * > getMeshComponents () const
ScenegetOwningScene () const
 Get the pointer to the scene this entity is a part of.
std::shared_ptr< SceneNodegetSceneNode () const
 Getter for the scene graph node for this object.
Public Member Functions inherited from EngineCore::Entity
 Entity ()
virtual ~Entity ()
void enableTick (bool enable)
 Enables or disables ticking for this entity.
void tick (double deltaTime) override
 Executes every frame if tick is enabled.
template<typename T, typename... Args>
T * addComponent (Args &&... args)
 Adds a component to the entity. Checks for uniqueness if the component defines 'static constexpr bool IsUnique = true;'.
template<typename T>
T * getComponent () const
 Returns the first component of type T found.
template<typename T>
std::vector< T * > getComponents () const
 Returns all components of type T.
void removeComponent (LogicComponent *component)
 Removes a specific component instance.
template<typename T>
bool removeFirstComponent ()
 Removes the first component of type T found.
template<typename T>
bool hasComponent () const
 Checks if a component of type T exists.
bool canTick () const
 Tells you if the entity can execute its tick function.
bool canEverTick () const
 Tells if this entity can ever tick.
Public Member Functions inherited from EngineCore::ITickable
virtual ~ITickable ()=default
virtual void preTick ()
 Function which executes immediately before the execution of ITickable::preTick()
virtual void postTick ()
 Function which executes immediately after the execution of ITickable::postTick()

Public Attributes

std::vector< MeshComponent * > meshComponents

Protected Attributes

std::optional< std::shared_ptr< SceneNode > > sceneNode
Protected Attributes inherited from EngineCore::Entity
std::vector< std::shared_ptr< LogicComponent > > components
 List of all logical components.
entt::entity data = entt::null
bool allowTicking = false

Private Member Functions

void initComponents ()
void cleanupComponents ()

Private Attributes

Transform worldTransform
bool isTransformDirty = true
SceneowningScene = nullptr
std::weak_ptr< SceneComponentrootComponent
bool doesEverTick = false
std::shared_ptr< World > world

Friends

class Scene

Additional Inherited Members

Protected Member Functions inherited from EngineCore::Entity
uuids::uuid getUUID () const
 Getter for the UUID of this entity.
std::string getUuidString () const
 Getter for the UUID of this entity as a string.

Detailed Description

An Actor is similar to an EngineCore::Entity. An actor is an Entity with a transform.

Date
2025-09-17
Author
Konstantin Passig

Definition at line 24 of file Actor.h.

Constructor & Destructor Documentation

◆ Actor()

EngineCore::Actor::Actor ( std::shared_ptr< SceneNode > sceneNode,
Scene * owningScene )
explicit

Definition at line 13 of file Actor.cpp.

References EngineCore::Entity::Entity(), EngineCore::EngineManager::getEngineModule(), EngineCore::EngineManager::getInstance(), owningScene, Scene, and sceneNode.

Referenced by EngineCore::Rat::Rat(), and EngineCore::StaticMeshActor::StaticMeshActor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Actor()

EngineCore::Actor::~Actor ( )

Definition at line 17 of file Actor.cpp.

Member Function Documentation

◆ beginPlay()

void EngineCore::Actor::beginPlay ( )
virtual

Gets executed when the actor is spawned into the world.

Date
2025-09-18
Author
Konstantin Passig

Definition at line 20 of file Actor.cpp.

References EngineCore::Entity::components.

◆ cleanupComponents()

void EngineCore::Actor::cleanupComponents ( )
private

Definition at line 123 of file Actor.cpp.

References EngineCore::Entity::components, and TRACY_ZONE_SCOPED_NAMED.

◆ endPlay()

void EngineCore::Actor::endPlay ( )
virtual

Definition at line 39 of file Actor.cpp.

References EngineCore::Entity::components, EngineCore::Entity::data, Ecs::RegistryManager::get(), and sceneNode.

Referenced by EngineCore::Scene::destroyActor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActorLocation()

glm::vec3 EngineCore::Actor::getActorLocation ( ) const

Gets the actors location in the world.

Returns
vec3 | xyz | world location
Date
2025-09-17
Author
Konstantin Passig

Definition at line 50 of file Actor.cpp.

References Ecs::TransformOperators::getPosition(), sceneNode, and TRACY_ZONE_SCOPED_FUNCTION.

Here is the call graph for this function:

◆ getActorRotation()

glm::vec3 EngineCore::Actor::getActorRotation ( ) const

Gets the actors rotation in the world.

Returns
vec3 | pitch yaw roll | world rotation
Date
2025-09-18
Author
Konstantin Passig

Definition at line 58 of file Actor.cpp.

References Ecs::TransformOperators::getRotationEuler(), and sceneNode.

Here is the call graph for this function:

◆ getActorScale()

glm::vec3 EngineCore::Actor::getActorScale ( ) const

Scales the actor to world scale.

Returns
xyz
Author
Konstantin Passig
Date
06.12.2025

Definition at line 65 of file Actor.cpp.

References Ecs::TransformOperators::getScale(), and sceneNode.

Here is the call graph for this function:

◆ getMeshComponents()

std::vector< MeshComponent * > EngineCore::Actor::getMeshComponents ( ) const

Definition at line 115 of file Actor.cpp.

References meshComponents.

◆ getOwningScene()

Scene * EngineCore::Actor::getOwningScene ( ) const

Get the pointer to the scene this entity is a part of.

Returns
Scene pointer

Definition at line 131 of file Actor.cpp.

References owningScene, and Scene.

Here is the call graph for this function:

◆ getSceneNode()

std::shared_ptr< SceneNode > EngineCore::Actor::getSceneNode ( ) const

Getter for the scene graph node for this object.

Returns
Node from the scene graph

Definition at line 135 of file Actor.cpp.

References sceneNode.

◆ getWorldTransform()

glm::mat4 EngineCore::Actor::getWorldTransform ( ) const

Gets the model matrix.

Returns
model matrix
Author
Konstantin Passig
Date
06.12.2025

Definition at line 96 of file Actor.cpp.

References sceneNode.

◆ initComponents()

void EngineCore::Actor::initComponents ( )
private

Definition at line 119 of file Actor.cpp.

References FUNCTION_NOT_IMPLEMENTED_F.

◆ registerMeshComponent()

MeshComponent * EngineCore::Actor::registerMeshComponent ( MeshComponent * meshComponent)

Definition at line 103 of file Actor.cpp.

References meshComponents, and owningScene.

◆ rotateActor()

void EngineCore::Actor::rotateActor ( glm::vec3 deltaRotation)

Applies an incremental rotation to the actor using quaternion multiplication. Use this instead of getActorRotation() + setActorRotation() for continuous rotation to avoid euler angle instability/jiggling.

Parameters
deltaRotationeuler angles (degrees) to rotate by
Author
Konstantin Passig
Date
2025-01-16

Definition at line 84 of file Actor.cpp.

References sceneNode.

◆ setActorLocation()

void EngineCore::Actor::setActorLocation ( glm::vec3 newLocation)

Set the new world location for this actor.

Parameters
newLocationxyz
Author
Konstantin Passig
Date
05.12.2025

Definition at line 72 of file Actor.cpp.

References sceneNode.

◆ setActorRotation()

void EngineCore::Actor::setActorRotation ( glm::vec3 newRotation)

Sets the world rotation.

Parameters
newRotationeuler (yaw | pitch | roll)
Author
Konstantin Passig
Date
05.12.2025

Definition at line 78 of file Actor.cpp.

References sceneNode.

◆ setActorScale()

void EngineCore::Actor::setActorScale ( glm::vec3 newScale)

sets the world scale for this actor

Parameters
newScalexyz
Author
Konstantin Passig
Date
05.12.2025

Definition at line 90 of file Actor.cpp.

References sceneNode.

◆ tick()

void EngineCore::Actor::tick ( double deltaTime)
overridevirtual

Executed every frame.

Parameters
deltaTimetime between this frame and the last frame
Date
2025-09-18
Author
Konstantin Passig

Reimplemented from EngineCore::ITickable.

Definition at line 28 of file Actor.cpp.

References EngineCore::Entity::components, and EngineCore::Entity::tick().

Here is the call graph for this function:

◆ unregisterMeshComponent()

void EngineCore::Actor::unregisterMeshComponent ( MeshComponent * meshComponent)

Definition at line 109 of file Actor.cpp.

References meshComponents.

◆ Scene

friend class Scene
friend

Member Data Documentation

◆ doesEverTick

bool EngineCore::Actor::doesEverTick = false
private

Definition at line 156 of file Actor.h.

◆ isTransformDirty

bool EngineCore::Actor::isTransformDirty = true
private

Definition at line 147 of file Actor.h.

◆ meshComponents

std::vector<MeshComponent*> EngineCore::Actor::meshComponents

Definition at line 128 of file Actor.h.

Referenced by getMeshComponents(), registerMeshComponent(), and unregisterMeshComponent().

◆ owningScene

Scene* EngineCore::Actor::owningScene = nullptr
private

◆ rootComponent

std::weak_ptr<SceneComponent> EngineCore::Actor::rootComponent
private

Definition at line 154 of file Actor.h.

◆ sceneNode

std::optional<std::shared_ptr<SceneNode> > EngineCore::Actor::sceneNode
protected

◆ world

std::shared_ptr<World> EngineCore::Actor::world
private

Definition at line 158 of file Actor.h.

◆ worldTransform

Transform EngineCore::Actor::worldTransform
private

Definition at line 146 of file Actor.h.


The documentation for this class was generated from the following files:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Entity/Actor.h
  • /home/magerbeton/Documents/gl3-vulkan/Engine/src/Engine/Entity/Actor.cpp