46 lines
931 B
C++
46 lines
931 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
#include <glm/glm.hpp>
|
|
#include <assimp/scene.h>
|
|
#include <functional>
|
|
#include "animdata.hpp"
|
|
#include "bone.hpp"
|
|
|
|
struct Bone;
|
|
|
|
struct AssimpNodeData {
|
|
glm::mat4 transformation;
|
|
std::string name;
|
|
int children_count;
|
|
std::vector<AssimpNodeData> children;
|
|
};
|
|
|
|
struct Animation {
|
|
float $duration{0.0f};
|
|
int $ticks_per_sec{0};
|
|
std::vector<Bone> $bones;
|
|
AssimpNodeData $root_node;
|
|
std::unordered_map<std::string, BoneInfo> $bone_info_map;
|
|
|
|
Animation() = default;
|
|
|
|
Animation(Model *model);
|
|
|
|
~Animation() {}
|
|
|
|
Bone* FindBone(const std::string& name);
|
|
|
|
float GetTicksPerSecond();
|
|
|
|
float GetDuration();
|
|
|
|
const AssimpNodeData& GetRootNode();
|
|
|
|
const std::unordered_map<std::string, BoneInfo>& GetBoneIDMap();
|
|
|
|
void ReadMissingBones(const aiAnimation* animation, Model& model);
|
|
|
|
void ReadHierarchyData(AssimpNodeData& dest, const aiNode* src);
|
|
};
|