AnimTestbed/src/SkinnedMesh.h

62 lines
1.8 KiB
C++

//
// Created by martin on 12.11.21.
//
#ifndef ANIMTESTBED_SKINNEDMESH_H
#define ANIMTESTBED_SKINNEDMESH_H
// ozz-animation headers
#include <cmath> // fmodf
#include <memory> // std::unique_ptr, std::make_unique
#include "SyncTrack.h"
#include "ozz/animation/runtime/animation.h"
#include "ozz/animation/runtime/local_to_model_job.h"
#include "ozz/animation/runtime/sampling_job.h"
#include "ozz/animation/runtime/skeleton.h"
#include "ozz/base/containers/vector.h"
#include "ozz/base/io/archive.h"
#include "ozz/base/io/stream.h"
#include "ozz/base/log.h"
#include "ozz/base/maths/soa_transform.h"
#include "ozz/base/maths/vec_float.h"
struct SkinnedMesh {
SkinnedMesh() : m_sync_track_override(false), m_override_anim(0.f) {}
virtual ~SkinnedMesh();
bool LoadSkeleton(const char* filename);
bool LoadAnimation(const char* filename);
//bool LoadMesh (const char* filename);
void SetCurrentAnimation(int index);
const ozz::animation::Animation* GetCurrentAnimation() {
return m_current_animation;
};
float GetCurrentAnimationDuration() {
return m_current_animation->duration();
};
void CalcModelMatrices();
void DrawSkeleton();
void DrawJoint(int joint_index, int parent_joint_index);
void DrawDebugUi();
// void DrawSkinnedMesh();
ozz::vector<ozz::animation::Animation*> m_animations;
std::vector<std::string> m_animation_names;
std::vector<SyncTrack> m_animation_sync_track;
ozz::animation::Skeleton m_skeleton;
ozz::animation::Animation* m_current_animation;
ozz::animation::SamplingCache m_cache;
ozz::vector<ozz::math::SoaTransform> m_local_matrices;
ozz::vector<ozz::math::Float4x4> m_model_matrices;
bool m_sync_track_override;
int m_override_anim;
float m_override_ratio;
};
#endif //ANIMTESTBED_SKINNEDMESH_H