mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
rewrite spine model loading to async method
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "assets/shader_asset.hpp"
|
||||
#include "assets/shape_asset.hpp"
|
||||
#include "assets/sound_asset.hpp"
|
||||
#include "assets/spine_model_asset.hpp"
|
||||
#include "assets/sprite_asset.hpp"
|
||||
#include "assets/text_asset.hpp"
|
||||
#include "assets/texture_asset.hpp"
|
||||
@@ -34,9 +35,9 @@
|
||||
#include "components/model_renderer.hpp"
|
||||
#include "components/renderer.hpp"
|
||||
#include "components/scene.hpp"
|
||||
#include "components/sprite_renderer.hpp"
|
||||
#include "components/spine_renderer.hpp"
|
||||
#include "components/spine_player.hpp"
|
||||
#include "components/spine_renderer.hpp"
|
||||
#include "components/sprite_renderer.hpp"
|
||||
|
||||
#include "systems/flipbook_system.hpp"
|
||||
#include "systems/label_system.hpp"
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace e2d
|
||||
class shader_asset;
|
||||
class shape_asset;
|
||||
class sound_asset;
|
||||
class spine_model_asset;
|
||||
class sprite_asset;
|
||||
class text_asset;
|
||||
class texture_asset;
|
||||
@@ -46,9 +47,9 @@ namespace e2d
|
||||
class model_renderer;
|
||||
class renderer;
|
||||
class scene;
|
||||
class sprite_renderer;
|
||||
class spine_renderer;
|
||||
class spine_player;
|
||||
class spine_renderer;
|
||||
class sprite_renderer;
|
||||
|
||||
class flipbook_system;
|
||||
class label_system;
|
||||
|
||||
@@ -8,20 +8,26 @@
|
||||
|
||||
#include "_high.hpp"
|
||||
|
||||
struct spAnimationStateData;
|
||||
struct spSkeletonData;
|
||||
struct spAtlas;
|
||||
struct spSkeletonData;
|
||||
struct spAnimationStateData;
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class bad_spine_model_access final : public exception {
|
||||
public:
|
||||
const char* what() const noexcept final {
|
||||
return "bad spine model access";
|
||||
}
|
||||
};
|
||||
|
||||
class spine_model final {
|
||||
public:
|
||||
using animation_data_ptr = std::shared_ptr<spAnimationStateData>;
|
||||
using skeleton_data_ptr = std::shared_ptr<spSkeletonData>;
|
||||
using atlas_ptr = std::shared_ptr<spAtlas>;
|
||||
using skeleton_data_ptr = std::shared_ptr<spSkeletonData>;
|
||||
using animation_data_ptr = std::shared_ptr<spAnimationStateData>;
|
||||
public:
|
||||
spine_model() noexcept = default;
|
||||
spine_model() = default;
|
||||
~spine_model() noexcept = default;
|
||||
|
||||
spine_model(spine_model&& other) noexcept;
|
||||
@@ -36,21 +42,22 @@ namespace e2d
|
||||
spine_model& assign(spine_model&& other) noexcept;
|
||||
spine_model& assign(const spine_model& other);
|
||||
|
||||
spine_model& set_skeleton(skeleton_data_ptr data);
|
||||
spine_model& set_atlas(atlas_ptr atlas, bool premultiplied_alpha);
|
||||
spine_model& set_atlas(atlas_ptr atlas);
|
||||
spine_model& set_skeleton(skeleton_data_ptr skeleton);
|
||||
|
||||
spine_model& mix_animations(const str& from, const str& to, secf duration);
|
||||
spine_model& set_default_mix(secf duration);
|
||||
spine_model& set_animation_mix(
|
||||
const str& from,
|
||||
const str& to,
|
||||
secf duration);
|
||||
|
||||
const atlas_ptr& atlas() const noexcept;
|
||||
const animation_data_ptr& animation() const noexcept;
|
||||
const skeleton_data_ptr& skeleton() const noexcept;
|
||||
bool premultiplied_alpha() const noexcept;
|
||||
const animation_data_ptr& animation() const noexcept;
|
||||
private:
|
||||
animation_data_ptr animation_;
|
||||
skeleton_data_ptr skeleton_;
|
||||
atlas_ptr atlas_;
|
||||
bool premultiplied_alpha_ = false;
|
||||
skeleton_data_ptr skeleton_;
|
||||
animation_data_ptr animation_;
|
||||
};
|
||||
|
||||
void swap(spine_model& l, spine_model& r) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user