Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
AnimationAsset.h
1#pragma once
2
3#include "Engine/Core/Asset.h"
4#include "Engine/Files/AssetPath.h"
5
6#include <cstdint>
7#include <glm/glm.hpp>
8#include <glm/gtc/quaternion.hpp>
9#include <string>
10#include <vector>
11
16namespace Engine::Animation
17{
18
28
33 {
34 uint32_t jointIndex = 0;
38 enum class Path
39 {
43 };
46 std::vector<float> timestamps;
47 std::vector<glm::vec4> values;
48 };
49} // namespace Engine::Animation
50
52{
61 {
62 public:
67
71 [[nodiscard]] float getDuration() const
72 {
73 return duration_;
74 }
75
79 [[nodiscard]] const std::string & getName() const
80 {
81 return name_;
82 }
83
87 [[nodiscard]] const std::vector<Engine::Animation::AnimationChannel> & getChannels() const
88 {
89 return channels_;
90 }
91
104 void sample(
105 uint32_t channelIndex,
106 float time,
107 glm::vec3 & outTranslation,
108 glm::quat & outRotation,
109 glm::vec3 & outScale
110 ) const;
111
112 // TODO: check if these variables need to be public
113 std::string name_;
114 float duration_ = 0.0f;
115
116 std::vector<Engine::Animation::AnimationChannel> channels_;
117 };
118
125 class AnimationAssetManager : public Asset::AssetManager<Asset::MeshPath, Animation>
126 {
127 public:
132 };
133} // namespace Engine::Assets
Base class for asset wrappers. The data is stored in the private member variable 'data' in form of en...
Definition Asset.h:297
A manager which is used to look up existing assets and their loading state.
Definition Asset.h:358
AnimationAssetManager()=default
Creates an empty animation asset manager.
Animation()
Creates a loaded animation clip with no channels.
float getDuration() const
Gets the clip duration in seconds.
const std::string & getName() const
Gets the imported animation name.
void sample(uint32_t channelIndex, float time, glm::vec3 &outTranslation, glm::quat &outRotation, glm::vec3 &outScale) const
Sample a specific channel at the given time.
std::vector< Engine::Animation::AnimationChannel > channels_
Channels sampled by this clip.
const std::vector< Engine::Animation::AnimationChannel > & getChannels() const
Gets all animation channels in this clip.
std::string name_
Imported animation name.
float duration_
Clip duration in seconds.
Animation channel data and evaluation helpers.
InterpolationType
Interpolation method for animation keyframes.
@ STEP
Hold the previous keyframe value until the next keyframe.
@ LINEAR
Interpolate between neighboring keyframes.
@ CUBIC_SPLINE
Use glTF cubic spline keyframe data.
A single animation channel targeting one joint's transform property.
InterpolationType interpolation
Keyframe interpolation mode.
uint32_t jointIndex
Index of the targeted joint in the bound skeleton.
Path path
Target transform property.
std::vector< float > timestamps
Keyframe times in seconds.
Path
Transform property animated by this channel.
@ TRANSLATION
Channel animates local translation.
@ SCALE
Channel animates local scale.
@ ROTATION
Channel animates local rotation.
std::vector< glm::vec4 > values
vec3 for T/S (w unused), quat for R (xyzw)