|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
An Actor is similar to an EngineCore::Entity. An actor is an Entity with a transform. More...
#include <Actor.h>
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. | |
| MeshComponent * | registerMeshComponent (MeshComponent *meshComponent) |
| void | unregisterMeshComponent (MeshComponent *meshComponent) |
| std::vector< MeshComponent * > | getMeshComponents () const |
| Scene * | getOwningScene () const |
| Get the pointer to the scene this entity is a part of. | |
| std::shared_ptr< SceneNode > | getSceneNode () 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 |
| Scene * | owningScene = nullptr |
| std::weak_ptr< SceneComponent > | rootComponent |
| 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. | |
An Actor is similar to an EngineCore::Entity. An actor is an Entity with a transform.
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().
|
virtual |
Gets executed when the actor is spawned into the world.
Definition at line 20 of file Actor.cpp.
References EngineCore::Entity::components.
|
private |
Definition at line 123 of file Actor.cpp.
References EngineCore::Entity::components, and TRACY_ZONE_SCOPED_NAMED.
|
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().
| glm::vec3 EngineCore::Actor::getActorLocation | ( | ) | const |
Gets the actors location in the world.
Definition at line 50 of file Actor.cpp.
References Ecs::TransformOperators::getPosition(), sceneNode, and TRACY_ZONE_SCOPED_FUNCTION.
| glm::vec3 EngineCore::Actor::getActorRotation | ( | ) | const |
Gets the actors rotation in the world.
Definition at line 58 of file Actor.cpp.
References Ecs::TransformOperators::getRotationEuler(), and sceneNode.
| glm::vec3 EngineCore::Actor::getActorScale | ( | ) | const |
Scales the actor to world scale.
Definition at line 65 of file Actor.cpp.
References Ecs::TransformOperators::getScale(), and sceneNode.
| std::vector< MeshComponent * > EngineCore::Actor::getMeshComponents | ( | ) | const |
Definition at line 115 of file Actor.cpp.
References meshComponents.
| Scene * EngineCore::Actor::getOwningScene | ( | ) | const |
Get the pointer to the scene this entity is a part of.
Definition at line 131 of file Actor.cpp.
References owningScene, and Scene.
| std::shared_ptr< SceneNode > EngineCore::Actor::getSceneNode | ( | ) | const |
| glm::mat4 EngineCore::Actor::getWorldTransform | ( | ) | const |
|
private |
Definition at line 119 of file Actor.cpp.
References FUNCTION_NOT_IMPLEMENTED_F.
| MeshComponent * EngineCore::Actor::registerMeshComponent | ( | MeshComponent * | meshComponent | ) |
Definition at line 103 of file Actor.cpp.
References meshComponents, and owningScene.
| 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.
| deltaRotation | euler angles (degrees) to rotate by |
Definition at line 84 of file Actor.cpp.
References sceneNode.
| void EngineCore::Actor::setActorLocation | ( | glm::vec3 | newLocation | ) |
| void EngineCore::Actor::setActorRotation | ( | glm::vec3 | newRotation | ) |
| void EngineCore::Actor::setActorScale | ( | glm::vec3 | newScale | ) |
|
overridevirtual |
Executed every frame.
| deltaTime | time between this frame and the last frame |
Reimplemented from EngineCore::ITickable.
Definition at line 28 of file Actor.cpp.
References EngineCore::Entity::components, and EngineCore::Entity::tick().
| void EngineCore::Actor::unregisterMeshComponent | ( | MeshComponent * | meshComponent | ) |
Definition at line 109 of file Actor.cpp.
References meshComponents.
|
friend |
Definition at line 25 of file Actor.h.
References owningScene, Scene, and sceneNode.
Referenced by Actor(), getOwningScene(), EngineCore::Rat::Rat(), Scene, and EngineCore::StaticMeshActor::StaticMeshActor().
| std::vector<MeshComponent*> EngineCore::Actor::meshComponents |
Definition at line 128 of file Actor.h.
Referenced by getMeshComponents(), registerMeshComponent(), and unregisterMeshComponent().
|
private |
Definition at line 149 of file Actor.h.
Referenced by Actor(), getOwningScene(), EngineCore::Rat::Rat(), registerMeshComponent(), Scene, and EngineCore::StaticMeshActor::StaticMeshActor().
|
private |
|
protected |
Definition at line 131 of file Actor.h.
Referenced by Actor(), endPlay(), getActorLocation(), getActorRotation(), getActorScale(), getSceneNode(), getWorldTransform(), rotateActor(), Scene, setActorLocation(), setActorRotation(), and setActorScale().