sandbox
Loading...
Searching...
No Matches
spline.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
28#ifndef LIBSBX_ANIMATIONS_SPLINE_HPP_
29#define LIBSBX_ANIMATIONS_SPLINE_HPP_
30
31#include <vector>
32#include <algorithm>
33
34#include <libsbx/utility/assert.hpp>
35
36#include <libsbx/math/vector3.hpp>
37#include <libsbx/math/quaternion.hpp>
39
40#include <libsbx/core/engine.hpp>
41
42namespace sbx::animations {
43
64template<typename Type>
65class spline {
66
67public:
68
80 auto add(const std::float_t timestamp, const Type& value) -> void;
81
95 auto sample(const std::float_t time) const -> Type;
96
102 auto size() const noexcept -> std::size_t;
103
104private:
105
106 std::vector<std::float_t> _timestamps;
107 std::vector<Type> _values;
108
109}; // class spline
110
111} // namespace sbx::animations
112
113#include <libsbx/animations/spline.ipp>
114
115#endif // LIBSBX_ANIMATIONS_SPLINE_HPP_
Time-ordered spline for interpolated animation values.
Definition: spline.hpp:65
auto sample(const std::float_t time) const -> Type
Sample the spline at a given time.
Definition: spline.ipp:13
auto size() const noexcept -> std::size_t
Retrieve the number of keyframes stored.
Definition: spline.ipp:37
auto add(const std::float_t timestamp, const Type &value) -> void
Add a keyframe to the spline.
Definition: spline.ipp:7
Mathematical constants.