Loading anim/include/anim/animation.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ namespace anim { AnimationTrack<T>* add_track(std::string name, com::ContextPath const& target, std::string property_setter_name, Keyframes<T> keyframes) const Keyframes<T>& keyframes) { auto track = push_back<AnimationTrack<T>>(name, target, property_setter_name, keyframes); m_end_time = std::max(m_end_time, track->keyframes().back().time()); Loading anim/include/anim/animation_track.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ struct AnimationTrack : public IAnimationTrack { AnimationTrack(std::string animation_name, com::ContextPath const& target, std::string property_setter_name, Keyframes<T> keyframes) const Keyframes<T>& keyframes) : IAnimationTrack(animation_name, target) , m_property_setter_name(property_setter_name) , m_keyframes(keyframes) {} Loading Loading @@ -65,7 +65,7 @@ struct AnimationTrack : public IAnimationTrack { void update_keyframe(size_t index, Keyframe<T>&& newKeyframe) { if (index < m_keyframes.size()) { std::swap(m_keyframes[index], newKeyframe); sort_keyframes(); // sort_keyframes(); } } Loading anim/include/anim/interpolator.hpp +78 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #include <math/math.hpp> #include <array> #include <iostream> namespace anim { Loading Loading @@ -46,7 +47,15 @@ class Keyframe; // Base interpolator interface template <typename T> struct Interpolator { virtual ~Interpolator() = default; Interpolator() { std::cout << "Interpolator created at " << this << "\n"; std::cout.flush(); } virtual ~Interpolator() { std::cout << "Interpolator destroyed at " << this << "\n"; std::cout.flush(); }; // Get the type of interpolation this interpolator handles virtual InterpolationType getType() const = 0; Loading @@ -63,6 +72,17 @@ struct ValueInterpolator : public Interpolator<T> { // Concrete interpolator for linear interpolation template <typename T> struct ConstantInterpolator : public ValueInterpolator<T> { ConstantInterpolator() { std::cout << "ConstantInterpolator created at " << this << "\n"; std::cout.flush(); } virtual ~ConstantInterpolator() { std::cout << "ConstantInterpolator destroyed at " << this << "\n"; std::cout.flush(); }; InterpolationType getType() const override { return InterpolationType::CONSTANT; } T interpolate(const T& start, const T& end, scalar normalizedTime) const override Loading @@ -84,6 +104,42 @@ struct ConstantInterpolator : public ValueInterpolator<T> { // Concrete interpolator for linear interpolation template <typename T> struct LinearInterpolator : public ValueInterpolator<T> { LinearInterpolator() { std::cout << "LinearInterpolator created at " << this << std::endl; std::cout.flush(); } virtual ~LinearInterpolator() { std::cout << "LinearInterpolator destroyed at " << this << std::endl; std::cout.flush(); }; LinearInterpolator(const LinearInterpolator& other) { std::cout << "LinearInterpolator copied from " << &other << " at " << this << std::endl; std::cout.flush(); } LinearInterpolator& operator=(const LinearInterpolator& other) { if (this != &other) { std::cout << "LinearInterpolator assigned from " << &other << " to " << this << std::endl; std::cout.flush(); } return *this; } LinearInterpolator(LinearInterpolator&& other) noexcept { std::cout << "LinearInterpolator moved from " << &other << " to " << this << std::endl; std::cout.flush(); } LinearInterpolator& operator=(LinearInterpolator&& other) noexcept { if (this != &other) { std::cout << "LinearInterpolator move-assigned from " << &other << " to " << this << std::endl; std::cout.flush(); } return *this; } InterpolationType getType() const override { return InterpolationType::LINEAR; } T interpolate(const T& start, const T& end, scalar normalizedTime) const override Loading Loading @@ -115,7 +171,17 @@ struct BezierHandles { // Concrete interpolator for bezier curves template <typename T, BezierMethod Method = NEWTON_RAPHSON> struct BezierInterpolator : public Interpolator<T> { BezierInterpolator(const BezierHandles& handles = BezierHandles{}) : m_handles(handles) {} virtual ~BezierInterpolator() { std::cout << "BezierInterpolator destroyed at " << this << "\n"; std::cout.flush(); }; BezierInterpolator(const BezierHandles& handles = BezierHandles{}) : m_handles(handles) { std::cout << "BezierInterpolator created at " << this << "\n"; std::cout.flush(); } InterpolationType getType() const override { return InterpolationType::BEZIER; } scalar interpolateScalarBezier(scalar startTime, scalar startValue, scalar endTime, scalar endValue, scalar normalizedTime) const Loading Loading @@ -188,7 +254,16 @@ private: // Concrete interpolator for ease in/out template <typename T> struct EasingInterpolator : public ValueInterpolator<T> { EasingInterpolator(scalar easingFactor = -2.0f) : m_easingFactor(easingFactor) {} EasingInterpolator(scalar easingFactor = -2.0f) : m_easingFactor(easingFactor) { std::cout << "EasingInterpolator created at " << this << "\n"; std::cout.flush(); } virtual ~EasingInterpolator() { std::cout << "EasingInterpolator destroyed at " << this << "\n"; std::cout.flush(); }; InterpolationType getType() const override { return InterpolationType::EASING; } T interpolate(const T& start, const T& end, scalar normalizedTime) const override Loading anim/include/anim/keyframe.hpp +21 −5 Original line number Diff line number Diff line Loading @@ -18,28 +18,37 @@ public: Keyframe(scalar time, T value, std::unique_ptr<Interpolator<T>> interpolator = std::make_unique<LinearInterpolator<T>>()) : m_time(time) , m_value(value) , m_interpolator(std::move(interpolator)) {} , m_interpolator(std::move(interpolator)) { std::cout << "Keyframe created at " << this << std::endl; } Keyframe(scalar time, T value, BezierHandles handles) : m_time(time) , m_value(value) , m_interpolator(std::make_unique<BezierInterpolator<T>>(handles)) {} , m_interpolator(std::make_unique<BezierInterpolator<T>>(handles)) { std::cout << "Keyframe created at " << this << std::endl; } Keyframe(scalar time, T value, scalar easeTransition) : m_time(time) , m_value(value) , m_interpolator(std::make_unique<EasingInterpolator<T>>(easeTransition)) {} , m_interpolator(std::make_unique<EasingInterpolator<T>>(easeTransition)) { std::cout << "Keyframe created at " << this << std::endl; } Keyframe(const Keyframe& other) : m_time(other.m_time) , m_value(other.m_value) , m_interpolator(other.m_interpolator ? other.m_interpolator->clone() : nullptr) {} , m_interpolator(other.m_interpolator ? other.m_interpolator->clone() : nullptr) { std::cout << "Keyframe copied from " << &other << " at " << this << std::endl; } Keyframe& operator=(const Keyframe& other) { if (this != &other) { m_time = other.m_time; m_value = other.m_value; m_interpolator = other.m_interpolator ? other.m_interpolator->clone() : nullptr; std::cout << "Keyframe assigned from " << &other << " to " << this << std::endl; } return *this; } Loading @@ -47,17 +56,24 @@ public: Keyframe(Keyframe&& other) noexcept : m_time(other.m_time) , m_value(std::move(other.m_value)) , m_interpolator(std::move(other.m_interpolator)) {} , m_interpolator(std::move(other.m_interpolator)) { std::cout << "Keyframe moved from " << &other << " to " << this << std::endl; } Keyframe& operator=(Keyframe&& other) noexcept { if (this != &other) { m_time = other.m_time; m_value = std::move(other.m_value); m_interpolator = std::move(other.m_interpolator); std::cout << "Keyframe move-assigned from " << &other << " to " << this << std::endl; } return *this; } ~Keyframe() { std::cout << "Keyframe destroyed" << std::endl; }; // Getters scalar time() const { return m_time; } const T& value() const { return m_value; } Loading gfx/include/gfx/shader_system.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ struct ShaderSystem final : public com::Library { */ Shader *default_lit_textured_shader(const com::ContextPath &albedo_texture_path, const com::ContextPath &normal_texture_path); Shader *lit_skinning_shader(const com::ContextPath &path, const std::string &name); Shader *lit_skinning_shader(const com::ContextPath &path, const std::string &name, size_t num_of_joints = 80); /** * Generates an unlit shader with vertex colors. Loading Loading
anim/include/anim/animation.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ namespace anim { AnimationTrack<T>* add_track(std::string name, com::ContextPath const& target, std::string property_setter_name, Keyframes<T> keyframes) const Keyframes<T>& keyframes) { auto track = push_back<AnimationTrack<T>>(name, target, property_setter_name, keyframes); m_end_time = std::max(m_end_time, track->keyframes().back().time()); Loading
anim/include/anim/animation_track.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ struct AnimationTrack : public IAnimationTrack { AnimationTrack(std::string animation_name, com::ContextPath const& target, std::string property_setter_name, Keyframes<T> keyframes) const Keyframes<T>& keyframes) : IAnimationTrack(animation_name, target) , m_property_setter_name(property_setter_name) , m_keyframes(keyframes) {} Loading Loading @@ -65,7 +65,7 @@ struct AnimationTrack : public IAnimationTrack { void update_keyframe(size_t index, Keyframe<T>&& newKeyframe) { if (index < m_keyframes.size()) { std::swap(m_keyframes[index], newKeyframe); sort_keyframes(); // sort_keyframes(); } } Loading
anim/include/anim/interpolator.hpp +78 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #include <math/math.hpp> #include <array> #include <iostream> namespace anim { Loading Loading @@ -46,7 +47,15 @@ class Keyframe; // Base interpolator interface template <typename T> struct Interpolator { virtual ~Interpolator() = default; Interpolator() { std::cout << "Interpolator created at " << this << "\n"; std::cout.flush(); } virtual ~Interpolator() { std::cout << "Interpolator destroyed at " << this << "\n"; std::cout.flush(); }; // Get the type of interpolation this interpolator handles virtual InterpolationType getType() const = 0; Loading @@ -63,6 +72,17 @@ struct ValueInterpolator : public Interpolator<T> { // Concrete interpolator for linear interpolation template <typename T> struct ConstantInterpolator : public ValueInterpolator<T> { ConstantInterpolator() { std::cout << "ConstantInterpolator created at " << this << "\n"; std::cout.flush(); } virtual ~ConstantInterpolator() { std::cout << "ConstantInterpolator destroyed at " << this << "\n"; std::cout.flush(); }; InterpolationType getType() const override { return InterpolationType::CONSTANT; } T interpolate(const T& start, const T& end, scalar normalizedTime) const override Loading @@ -84,6 +104,42 @@ struct ConstantInterpolator : public ValueInterpolator<T> { // Concrete interpolator for linear interpolation template <typename T> struct LinearInterpolator : public ValueInterpolator<T> { LinearInterpolator() { std::cout << "LinearInterpolator created at " << this << std::endl; std::cout.flush(); } virtual ~LinearInterpolator() { std::cout << "LinearInterpolator destroyed at " << this << std::endl; std::cout.flush(); }; LinearInterpolator(const LinearInterpolator& other) { std::cout << "LinearInterpolator copied from " << &other << " at " << this << std::endl; std::cout.flush(); } LinearInterpolator& operator=(const LinearInterpolator& other) { if (this != &other) { std::cout << "LinearInterpolator assigned from " << &other << " to " << this << std::endl; std::cout.flush(); } return *this; } LinearInterpolator(LinearInterpolator&& other) noexcept { std::cout << "LinearInterpolator moved from " << &other << " to " << this << std::endl; std::cout.flush(); } LinearInterpolator& operator=(LinearInterpolator&& other) noexcept { if (this != &other) { std::cout << "LinearInterpolator move-assigned from " << &other << " to " << this << std::endl; std::cout.flush(); } return *this; } InterpolationType getType() const override { return InterpolationType::LINEAR; } T interpolate(const T& start, const T& end, scalar normalizedTime) const override Loading Loading @@ -115,7 +171,17 @@ struct BezierHandles { // Concrete interpolator for bezier curves template <typename T, BezierMethod Method = NEWTON_RAPHSON> struct BezierInterpolator : public Interpolator<T> { BezierInterpolator(const BezierHandles& handles = BezierHandles{}) : m_handles(handles) {} virtual ~BezierInterpolator() { std::cout << "BezierInterpolator destroyed at " << this << "\n"; std::cout.flush(); }; BezierInterpolator(const BezierHandles& handles = BezierHandles{}) : m_handles(handles) { std::cout << "BezierInterpolator created at " << this << "\n"; std::cout.flush(); } InterpolationType getType() const override { return InterpolationType::BEZIER; } scalar interpolateScalarBezier(scalar startTime, scalar startValue, scalar endTime, scalar endValue, scalar normalizedTime) const Loading Loading @@ -188,7 +254,16 @@ private: // Concrete interpolator for ease in/out template <typename T> struct EasingInterpolator : public ValueInterpolator<T> { EasingInterpolator(scalar easingFactor = -2.0f) : m_easingFactor(easingFactor) {} EasingInterpolator(scalar easingFactor = -2.0f) : m_easingFactor(easingFactor) { std::cout << "EasingInterpolator created at " << this << "\n"; std::cout.flush(); } virtual ~EasingInterpolator() { std::cout << "EasingInterpolator destroyed at " << this << "\n"; std::cout.flush(); }; InterpolationType getType() const override { return InterpolationType::EASING; } T interpolate(const T& start, const T& end, scalar normalizedTime) const override Loading
anim/include/anim/keyframe.hpp +21 −5 Original line number Diff line number Diff line Loading @@ -18,28 +18,37 @@ public: Keyframe(scalar time, T value, std::unique_ptr<Interpolator<T>> interpolator = std::make_unique<LinearInterpolator<T>>()) : m_time(time) , m_value(value) , m_interpolator(std::move(interpolator)) {} , m_interpolator(std::move(interpolator)) { std::cout << "Keyframe created at " << this << std::endl; } Keyframe(scalar time, T value, BezierHandles handles) : m_time(time) , m_value(value) , m_interpolator(std::make_unique<BezierInterpolator<T>>(handles)) {} , m_interpolator(std::make_unique<BezierInterpolator<T>>(handles)) { std::cout << "Keyframe created at " << this << std::endl; } Keyframe(scalar time, T value, scalar easeTransition) : m_time(time) , m_value(value) , m_interpolator(std::make_unique<EasingInterpolator<T>>(easeTransition)) {} , m_interpolator(std::make_unique<EasingInterpolator<T>>(easeTransition)) { std::cout << "Keyframe created at " << this << std::endl; } Keyframe(const Keyframe& other) : m_time(other.m_time) , m_value(other.m_value) , m_interpolator(other.m_interpolator ? other.m_interpolator->clone() : nullptr) {} , m_interpolator(other.m_interpolator ? other.m_interpolator->clone() : nullptr) { std::cout << "Keyframe copied from " << &other << " at " << this << std::endl; } Keyframe& operator=(const Keyframe& other) { if (this != &other) { m_time = other.m_time; m_value = other.m_value; m_interpolator = other.m_interpolator ? other.m_interpolator->clone() : nullptr; std::cout << "Keyframe assigned from " << &other << " to " << this << std::endl; } return *this; } Loading @@ -47,17 +56,24 @@ public: Keyframe(Keyframe&& other) noexcept : m_time(other.m_time) , m_value(std::move(other.m_value)) , m_interpolator(std::move(other.m_interpolator)) {} , m_interpolator(std::move(other.m_interpolator)) { std::cout << "Keyframe moved from " << &other << " to " << this << std::endl; } Keyframe& operator=(Keyframe&& other) noexcept { if (this != &other) { m_time = other.m_time; m_value = std::move(other.m_value); m_interpolator = std::move(other.m_interpolator); std::cout << "Keyframe move-assigned from " << &other << " to " << this << std::endl; } return *this; } ~Keyframe() { std::cout << "Keyframe destroyed" << std::endl; }; // Getters scalar time() const { return m_time; } const T& value() const { return m_value; } Loading
gfx/include/gfx/shader_system.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ struct ShaderSystem final : public com::Library { */ Shader *default_lit_textured_shader(const com::ContextPath &albedo_texture_path, const com::ContextPath &normal_texture_path); Shader *lit_skinning_shader(const com::ContextPath &path, const std::string &name); Shader *lit_skinning_shader(const com::ContextPath &path, const std::string &name, size_t num_of_joints = 80); /** * Generates an unlit shader with vertex colors. Loading