Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Entities::SkeletalMeshActor Class Reference

Actor type for skinned/skeletal meshes (characters, animated objects) More...

#include <SkeletalMeshActor.h>

Inheritance diagram for Engine::Entities::SkeletalMeshActor:
Collaboration diagram for Engine::Entities::SkeletalMeshActor:

Public Member Functions

 SkeletalMeshActor (const std::shared_ptr< SceneNode > &node, Scene *owningScene, Asset::Path meshPath)
glm::vec3 getBonePosition (const std::string &boneName) const
 Getter.
glm::quat getBoneRotation (const std::string &boneName) const
 Getter.
glm::vec3 getBoneScale (const std::string &boneName) const
 Getter.
void setBonePosition (const std::string &boneName, const glm::vec3 &position)
 Setter.
void setBoneRotation (const std::string &boneName, const glm::quat &rotation)
 Setter.
void setBoneScale (const std::string &boneName, const glm::vec3 &scale)
 Setter.
void resetPosesToRest ()
 Resets all bone poses to their rest positions.
void applyBoneTransforms ()
 Applies current poses to the mesh component.
Public Member Functions inherited from Engine::Entities::Actor
 Actor (std::shared_ptr< SceneNode > sceneNode, Scene *owningScene)
 ~Actor () override=default
virtual void beginPlay ()
 Gets executed when the actor is spawned into the world.
void tick (double deltaTime) override
 Executed every frame.
virtual void endPlay ()
virtual std::string getActorName () const
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) const
 Set the new world location for this actor.
void setActorRotation (glm::vec3 newRotation) const
 Sets the world rotation.
void rotateActor (glm::vec3 deltaRotation) const
 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) const
 sets the world scale for this actor
glm::mat4 getWorldTransform () const
 Gets the model matrix.
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 Engine::Entities::Entity
 Entity ()
 ~Entity () override
void enableTick (bool enable)
 Enables or disables ticking for this entity.
void setTickPriority (int32_t priority)
int32_t getTickPriority () const
void tick (double deltaTime) override
 Executes every frame if tick is enabled.
template<typename T, typename... Args>
requires std::is_base_of_v<Components::Logic, T>
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>
requires std::is_base_of_v<Components::Logic, T>
T * getComponent () const
 Returns the first component of type T found.
template<typename T>
requires std::is_base_of_v<Components::Logic, T>
std::vector< T * > getComponents () const
 Returns all components of type T.
void removeComponent (Components::Logic *component)
 Removes a specific component instance.
template<typename T>
requires std::is_base_of_v<Components::Logic, T>
bool removeFirstComponent ()
 Removes the first component of type T found.
template<typename T>
requires std::is_base_of_v<Components::Logic, T>
bool hasComponent () const
 Checks if a component of type T exists.
const std::vector< std::unique_ptr< Components::Logic > > & getAllComponents () const
 Gets all components on this entity.
bool canTick () const
 Tells you if the entity can execute its tick function.
bool canEverTick () const
 Tells if this entity can ever tick.
entt::entity getEcsEntity () const
 Gets the ECS entity handle for this Entity.
Public Member Functions inherited from Engine::Core::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()

Private Member Functions

int32_t resolveBone (const std::string &boneName) const
void ensurePosesInitialized ()
Assets::SkingetSkin () const

Private Attributes

Components::MeshmeshComponent = nullptr
std::vector< Animation::AnimationEvaluator::JointPosecurrentPoses_
bool posesInitialized_ = false

Additional Inherited Members

Protected Member Functions inherited from Engine::Entities::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.
Protected Attributes inherited from Engine::Entities::Actor
std::optional< std::shared_ptr< SceneNode > > sceneNode
Protected Attributes inherited from Engine::Entities::Entity
std::vector< std::unique_ptr< Components::Logic > > components_
 List of all logical components.
entt::entity data_ = entt::null
bool allowTicking_ = false
int32_t tickPriority_ = 0

Detailed Description

Actor type for skinned/skeletal meshes (characters, animated objects)

Definition at line 16 of file SkeletalMeshActor.h.

Constructor & Destructor Documentation

◆ SkeletalMeshActor()

Engine::Entities::SkeletalMeshActor::SkeletalMeshActor ( const std::shared_ptr< SceneNode > & node,
Scene * owningScene,
Asset::Path meshPath )
explicit

References Engine::Entities::Actor::Scene.

Here is the call graph for this function:

Member Function Documentation

◆ applyBoneTransforms()

void Engine::Entities::SkeletalMeshActor::applyBoneTransforms ( )

Applies current poses to the mesh component.

◆ ensurePosesInitialized()

void Engine::Entities::SkeletalMeshActor::ensurePosesInitialized ( )
private

◆ getBonePosition()

glm::vec3 Engine::Entities::SkeletalMeshActor::getBonePosition ( const std::string & boneName) const

Getter.

◆ getBoneRotation()

glm::quat Engine::Entities::SkeletalMeshActor::getBoneRotation ( const std::string & boneName) const

Getter.

◆ getBoneScale()

glm::vec3 Engine::Entities::SkeletalMeshActor::getBoneScale ( const std::string & boneName) const

Getter.

◆ getSkin()

Assets::Skin * Engine::Entities::SkeletalMeshActor::getSkin ( ) const
private

◆ resetPosesToRest()

void Engine::Entities::SkeletalMeshActor::resetPosesToRest ( )

Resets all bone poses to their rest positions.

◆ resolveBone()

int32_t Engine::Entities::SkeletalMeshActor::resolveBone ( const std::string & boneName) const
private

◆ setBonePosition()

void Engine::Entities::SkeletalMeshActor::setBonePosition ( const std::string & boneName,
const glm::vec3 & position )

Setter.

◆ setBoneRotation()

void Engine::Entities::SkeletalMeshActor::setBoneRotation ( const std::string & boneName,
const glm::quat & rotation )

Setter.

◆ setBoneScale()

void Engine::Entities::SkeletalMeshActor::setBoneScale ( const std::string & boneName,
const glm::vec3 & scale )

Setter.

Member Data Documentation

◆ currentPoses_

std::vector<Animation::AnimationEvaluator::JointPose> Engine::Entities::SkeletalMeshActor::currentPoses_
private

Definition at line 71 of file SkeletalMeshActor.h.

◆ meshComponent

Components::Mesh* Engine::Entities::SkeletalMeshActor::meshComponent = nullptr
private

Definition at line 70 of file SkeletalMeshActor.h.

◆ posesInitialized_

bool Engine::Entities::SkeletalMeshActor::posesInitialized_ = false
private

Definition at line 72 of file SkeletalMeshActor.h.


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