mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
spine_renderer united with spine_player
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include "components/renderer.hpp"
|
||||
#include "components/scene.hpp"
|
||||
#include "components/spine_player.hpp"
|
||||
#include "components/spine_renderer.hpp"
|
||||
#include "components/sprite_renderer.hpp"
|
||||
|
||||
#include "systems/flipbook_system.hpp"
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace e2d
|
||||
class renderer;
|
||||
class scene;
|
||||
class spine_player;
|
||||
class spine_renderer;
|
||||
class sprite_renderer;
|
||||
|
||||
class flipbook_system;
|
||||
|
||||
@@ -12,15 +12,25 @@
|
||||
#include "../assets/spine_model_asset.hpp"
|
||||
|
||||
struct spAnimationState;
|
||||
struct spSkeleton;
|
||||
struct spSkeletonClipping;
|
||||
struct spVertexEffect;
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class spine_player final {
|
||||
public:
|
||||
using animation_ptr = std::shared_ptr<spAnimationState>;
|
||||
using skeleton_ptr = std::shared_ptr<spSkeleton>;
|
||||
using clipping_ptr = std::shared_ptr<spSkeletonClipping>;
|
||||
using effect_ptr = std::shared_ptr<spVertexEffect>;
|
||||
public:
|
||||
spine_player() = default;
|
||||
spine_player(const spine_model_asset::ptr& model);
|
||||
|
||||
spine_player& model(const spine_model_asset::ptr& value) noexcept;
|
||||
spine_player& skin(const str& value) noexcept;
|
||||
spine_player& attachment(const str& slot, const str& name) noexcept;
|
||||
|
||||
spine_player& time_scale(float value) noexcept;
|
||||
[[nodiscard]] float time_scale() const noexcept;
|
||||
@@ -38,10 +48,16 @@ namespace e2d
|
||||
spine_player& clear() noexcept;
|
||||
|
||||
const animation_ptr& animation() const noexcept;
|
||||
const skeleton_ptr& skeleton() const noexcept;
|
||||
const clipping_ptr& clipper() const noexcept;
|
||||
const effect_ptr& effect() const noexcept;
|
||||
const spine_model_asset::ptr& model() const noexcept;
|
||||
private:
|
||||
animation_ptr animation_;
|
||||
spine_model_asset::ptr model_;
|
||||
skeleton_ptr skeleton_;
|
||||
clipping_ptr clipping_;
|
||||
effect_ptr effect_;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../assets/spine_model_asset.hpp"
|
||||
|
||||
struct spSkeleton;
|
||||
struct spSkeletonClipping;
|
||||
struct spVertexEffect;
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
|
||||
class spine_renderer final {
|
||||
public:
|
||||
using skeleton_ptr = std::shared_ptr<spSkeleton>;
|
||||
using clipping_ptr = std::shared_ptr<spSkeletonClipping>;
|
||||
using effect_ptr = std::shared_ptr<spVertexEffect>;
|
||||
public:
|
||||
spine_renderer() = default;
|
||||
spine_renderer(const spine_model_asset::ptr& model);
|
||||
|
||||
spine_renderer& model(const spine_model_asset::ptr& value) noexcept;
|
||||
spine_renderer& skin(const str& value) noexcept;
|
||||
spine_renderer& attachment(const str& slot, const str& name) noexcept;
|
||||
|
||||
const skeleton_ptr& skeleton() const noexcept;
|
||||
const clipping_ptr& clipper() const noexcept;
|
||||
const effect_ptr& effect() const noexcept;
|
||||
const spine_model_asset::ptr& model() const noexcept;
|
||||
private:
|
||||
skeleton_ptr skeleton_;
|
||||
clipping_ptr clipping_;
|
||||
effect_ptr effect_;
|
||||
spine_model_asset::ptr model_;
|
||||
};
|
||||
|
||||
template <>
|
||||
class factory_loader<spine_renderer> final : factory_loader<> {
|
||||
public:
|
||||
static const char* schema_source;
|
||||
|
||||
bool operator()(
|
||||
spine_renderer& component,
|
||||
const fill_context& ctx) const;
|
||||
|
||||
bool operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user