sandbox
Loading...
Searching...
No Matches
animation.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_ANIMATIONS_ANIMATION_HPP_
3#define LIBSBX_ANIMATIONS_ANIMATION_HPP_
4
5#include <string>
6#include <vector>
7#include <filesystem>
8
9#include <libsbx/utility/hashed_string.hpp>
10
11#include <libsbx/math/vector3.hpp>
12#include <libsbx/math/quaternion.hpp>
13
15
16namespace sbx::animations {
17
18class animation {
19
20public:
21
22 struct bone_track {
23 spline<math::vector3> position_spline;
24 spline<math::quaternion> rotation_spline;
25 spline<math::vector3> scale_spline;
26 }; // struct bone_track
27
28 animation(const std::filesystem::path& path, const std::string& name);
29
30 auto track_map() const noexcept -> const std::unordered_map<utility::hashed_string, bone_track>&;
31
32 auto duration() const noexcept -> std::float_t;
33
34private:
35
36 std::string _name;
37 std::float_t _duration = 0.0f;
38 std::float_t _ticks_per_second = 25.0f;
39
40 std::unordered_map<utility::hashed_string, bone_track> _track_map;
41
42}; // class animation
43
44} // namespace sbx::animations
45
46#endif // LIBSBX_ANIMATIONS_ANIMATION_HPP_
Definition: animation.hpp:18
Time-ordered spline for interpolated animation values.
Definition: spline.hpp:65
Generic time-based spline container for animation sampling.
Definition: animation.hpp:22