61 lines
1.5 KiB
C
61 lines
1.5 KiB
C
![]() |
//
|
||
|
// Created by martin on 12.11.21.
|
||
|
//
|
||
|
|
||
|
#ifndef ANIMTESTBED_ANIMATIONCONTROLLER_H
|
||
|
#define ANIMTESTBED_ANIMATIONCONTROLLER_H
|
||
|
|
||
|
#include <ozz/animation/runtime/sampling_job.h>
|
||
|
|
||
|
#include "ozz/animation/runtime/animation.h"
|
||
|
#include "ozz/base/containers/vector.h"
|
||
|
#include "ozz/base/maths/soa_transform.h"
|
||
|
#include "ozz/base/maths/vec_float.h"
|
||
|
|
||
|
struct SkinnedMesh;
|
||
|
|
||
|
struct AnimationController {
|
||
|
explicit AnimationController(SkinnedMesh* skinned_mesh);
|
||
|
|
||
|
void SetBlendAnims(
|
||
|
ozz::animation::Animation* blend_anim_A,
|
||
|
ozz::animation::Animation* blend_anim_B) {
|
||
|
m_blend_anim_A = blend_anim_A;
|
||
|
m_blend_anim_B = blend_anim_B;
|
||
|
}
|
||
|
void ResetAnims() {
|
||
|
m_anim_time_A = 0.f;
|
||
|
m_anim_time_B = 0.f;
|
||
|
}
|
||
|
void Update(float dt);
|
||
|
void Evaluate();
|
||
|
|
||
|
void DrawDebugUi();
|
||
|
|
||
|
float m_current_time;
|
||
|
|
||
|
ozz::animation::Animation* m_blend_anim_A;
|
||
|
ozz::animation::Animation* m_blend_anim_B;
|
||
|
|
||
|
float m_time_scale_A;
|
||
|
float m_time_scale_B;
|
||
|
float m_anim_time_A;
|
||
|
float m_anim_time_B;
|
||
|
float m_anim_ratio_A;
|
||
|
float m_anim_ratio_B;
|
||
|
bool m_override_ratio_A;
|
||
|
bool m_override_ratio_B;
|
||
|
float m_blend_weight;
|
||
|
|
||
|
ozz::vector<ozz::math::SoaTransform> m_local_matrices_A;
|
||
|
ozz::vector<ozz::math::SoaTransform> m_local_matrices_B;
|
||
|
ozz::vector<ozz::math::SoaTransform> m_local_matrices_blended;
|
||
|
|
||
|
ozz::animation::SamplingCache m_sampling_cache_A;
|
||
|
ozz::animation::SamplingCache m_sampling_cache_B;
|
||
|
|
||
|
SkinnedMesh* m_skinned_mesh = nullptr;
|
||
|
};
|
||
|
|
||
|
#endif //ANIMTESTBED_ANIMATIONCONTROLLER_H
|