1
0
Files
BasaltMeter/BasaltPresenter/Plugins/AnimeLoader/ChickenNuggetAnimeLoader/main.cpp

44 lines
1.9 KiB
C++
Raw Normal View History

2026-01-09 16:40:30 +08:00
#include <basalt/export_macro.hpp>
#include <basalt/anime_loader.hpp>
#include <basalt/math.hpp>
namespace anime_loader = ::basalt::shared::anime_loader;
2026-01-09 16:49:06 +08:00
using anime_loader::AnimeLoaderConfig;
2026-01-09 16:40:30 +08:00
using anime_loader::IAnimeLoader;
using anime_loader::KeyFrame;
using ::basalt::shared::math::FloatPoint;
#define F(x) (static_cast<FloatPoint>(x))
class ChickenNuggetAnimeLoader : public IAnimeLoader {
public:
ChickenNuggetAnimeLoader() {}
virtual ~ChickenNuggetAnimeLoader() {}
2026-01-09 16:49:06 +08:00
public:
virtual void load(AnimeLoaderConfig&& config) override {
IAnimeLoader::load(std::move(config));
2026-01-10 20:29:50 +08:00
this->timeline.add_key_frame(60 * 0, KeyFrame{.position = {F(0), F(-10), F(10)}, .rotation = {F(0.382683), F(0), F(0), F(0.92388)}});
this->timeline.add_key_frame(60 * 1,
KeyFrame{.position = {F(-10), F(0), F(10)},
.rotation = {F(0.270598), F(-0.270598), F(-0.653282), F(0.653282)}});
this->timeline.add_key_frame(60 * 2,
KeyFrame{.position = {F(0), F(10), F(10)}, .rotation = {F(0), F(-0.382683), F(-0.92388), F(0)}});
this->timeline.add_key_frame(60 * 3,
KeyFrame{.position = {F(10), F(0), F(10)},
.rotation = {F(-0.270598), F(-0.270598), F(-0.653282), F(-0.653282)}});
this->timeline.add_key_frame(60 * 4,
KeyFrame{.position = {F(0), F(-10), F(10)},
.rotation = {F(0.382683), F(0), F(0), F(0.92388)}}); // Same as the first
2026-01-09 16:40:30 +08:00
}
};
BS_EXPORT void* BSCreateInstance() {
return static_cast<IAnimeLoader*>(new ChickenNuggetAnimeLoader());
}
BS_EXPORT void BSDestroyInstance(void* instance) {
delete dynamic_cast<ChickenNuggetAnimeLoader*>(static_cast<IAnimeLoader*>(instance));
}