Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
SkeletalMeshActor.h
1#pragma once
2#include "../Component/MeshComponent.h"
3#include "Engine/Animation/AnimationEvaluator.h"
4#include "Engine/Entity/Actor.h"
5#include "Engine/Files/AssetPath.h"
6
7#include <glm/gtc/quaternion.hpp>
8#include <string>
9#include <vector>
10
11namespace Engine::Entities
12{
16 class SkeletalMeshActor : public Actor
17 {
18 public:
25 const SpawnContext & context,
26 Asset::MeshPath meshPath
27 );
28
32 glm::vec3 getBonePosition(const std::string& boneName) const;
33
37 glm::quat getBoneRotation(const std::string& boneName) const;
38
42 glm::vec3 getBoneScale(const std::string& boneName) const;
43
47 void setBonePosition(const std::string& boneName, const glm::vec3& position);
48
52 void setBoneRotation(const std::string& boneName, const glm::quat& rotation);
53
57 void setBoneScale(const std::string& boneName, const glm::vec3& scale);
58
63
68
69 [[nodiscard]] std::shared_ptr<SceneNode> getSkeletalMeshNode() const;
70
74 [[nodiscard]] Assets::SkinHandle getSkinAsset() const;
75
76 protected:
77 void setMeshLocalTransform( const glm::mat4 & transform ) const;
78
79 private:
80 int32_t resolveBone(const std::string& boneName) const;
83
85 std::shared_ptr<SceneNode> meshSceneNode_;
86 std::vector<Animation::AnimationEvaluator::JointPose> currentPoses_;
87 bool posesInitialized_ = false;
88 };
89} // namespace EngineCore
Skeleton definition loaded from glTF skin data.
Definition SkinAsset.h:30
A component which can be attached as many times to an actor as one wants. It makes it possible to ren...
Actor(const SpawnContext &context)
Creates an actor from a scene spawn context.
void setBonePosition(const std::string &boneName, const glm::vec3 &position)
Setter.
std::vector< Animation::AnimationEvaluator::JointPose > currentPoses_
std::shared_ptr< SceneNode > getSkeletalMeshNode() const
int32_t resolveBone(const std::string &boneName) const
SkeletalMeshActor(const SpawnContext &context, Asset::MeshPath meshPath)
Creates a skeletal mesh actor from a mesh asset path.
Assets::Skin * getSkinPayload() const
glm::quat getBoneRotation(const std::string &boneName) const
Getter.
void setBoneScale(const std::string &boneName, const glm::vec3 &scale)
Setter.
void resetPosesToRest()
Resets all bone poses to their rest positions.
Assets::SkinHandle getSkinAsset() const
Returns the stable skin binding handle used by this actor's skeletal mesh.
void setBoneRotation(const std::string &boneName, const glm::quat &rotation)
Setter.
void setMeshLocalTransform(const glm::mat4 &transform) const
glm::vec3 getBoneScale(const std::string &boneName) const
Getter.
void applyBoneTransforms()
Applies current poses to the mesh component.
glm::vec3 getBonePosition(const std::string &boneName) const
Getter.
std::shared_ptr< SceneNode > meshSceneNode_
AssetHandle< SkinHandleTag > SkinHandle
Handle to skin binding data.
Identifies a named mesh-like asset inside an asset file.
Definition AssetPath.h:89
Scene ownership data passed to actor and component constructors during spawning.