1
0

write shit

This commit is contained in:
2026-01-09 16:40:30 +08:00
parent 55ed60c643
commit 06bfe69c0e
14 changed files with 424 additions and 46 deletions

View File

@@ -1,13 +1,60 @@
#pragma once
#include "math.hpp"
#include <map>
#include <functional>
namespace basalt::shared::anime_loader {
//struct KeyFrame {
// math::Index frame_index;
// math::Matrix4x4 transform;
//};
//struct KeyFrameCompare {
// bool operator()(const KeyFrame& lhs, const KeyFrame& rhs) const { return lhs.time < rhs.time; }
//};
struct KeyFrame {
math::Vector3 position;
math::Quaternion rotation;
};
struct KeyFrameSpan {
math::FloatPoint prev_time; ///< 归一化的到前一帧的时间即两者加起来为1。
math::FloatPoint next_time; ///< 归一化的到后一帧的时间即两者加起来为1。
math::Vector3 prev_position; ///< 前一帧的摄像机坐标。
math::Vector3 next_position; ///< 后一帧的摄像机坐标。
math::Quaternion prev_rotation; ///< 前一帧的摄像机旋转。
math::Quaternion next_rotation; ///< 后一帧的摄像机旋转。
};
enum class AnimeLoaderStatus {
Ready,
Loaded,
};
/**
* @brief
* @details
* \li 摄像机的transform基于Blender坐标系。
* \li 摄像机的默认状态与Blender摄像机一致即初始指向-Z+Y Up。
*/
class IAnimeLoader {
public:
IAnimeLoader();
virtual ~IAnimeLoader();
public:
void load();
KeyFrameSpan tick();
protected:
virtual void internal_load();
protected:
AnimeLoaderStatus status;
math::Index time, last_index;
std::map<math::Index, KeyFrame> frames;
};
} // namespace basalt::shared::anime_loader