50 lines
1.5 KiB
C
50 lines
1.5 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 "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 {
|
||
|
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 EvalAnimation(float in_time);
|
||
|
void DrawSkeleton();
|
||
|
void DrawJoint(int joint_index, int parent_joint_index);
|
||
|
|
||
|
void DrawUi();
|
||
|
// void DrawSkinnedMesh();
|
||
|
|
||
|
ozz::vector<ozz::animation::Animation*> m_animations;
|
||
|
std::vector<std::string> m_animation_names;
|
||
|
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;
|
||
|
};
|
||
|
|
||
|
#endif //ANIMTESTBED_SKINNEDMESH_H
|