diff --git a/headers/enduro2d/high/_all.hpp b/headers/enduro2d/high/_all.hpp index 9b884826..747c9796 100644 --- a/headers/enduro2d/high/_all.hpp +++ b/headers/enduro2d/high/_all.hpp @@ -21,7 +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/spine_asset.hpp" #include "assets/sprite_asset.hpp" #include "assets/text_asset.hpp" #include "assets/texture_asset.hpp" @@ -59,6 +59,7 @@ #include "node.hpp" #include "node.inl" #include "prefab.hpp" +#include "spine.hpp" #include "sprite.hpp" #include "starter.hpp" #include "world.hpp" diff --git a/headers/enduro2d/high/_high.hpp b/headers/enduro2d/high/_high.hpp index c21f251a..e8c62d30 100644 --- a/headers/enduro2d/high/_high.hpp +++ b/headers/enduro2d/high/_high.hpp @@ -33,7 +33,7 @@ namespace e2d class shader_asset; class shape_asset; class sound_asset; - class spine_model_asset; + class spine_asset; class sprite_asset; class text_asset; class texture_asset; @@ -74,6 +74,7 @@ namespace e2d class model; class node; class prefab; + class spine; class sprite; class starter; class world; diff --git a/headers/enduro2d/high/assets/spine_model_asset.hpp b/headers/enduro2d/high/assets/spine_asset.hpp similarity index 81% rename from headers/enduro2d/high/assets/spine_model_asset.hpp rename to headers/enduro2d/high/assets/spine_asset.hpp index 8bfb86e0..bff4bbf6 100644 --- a/headers/enduro2d/high/assets/spine_model_asset.hpp +++ b/headers/enduro2d/high/assets/spine_asset.hpp @@ -9,13 +9,13 @@ #include "../_high.hpp" #include "../library.hpp" -#include "../spine_model.hpp" +#include "../spine.hpp" namespace e2d { - class spine_model_asset final : public content_asset { + class spine_asset final : public content_asset { public: - static const char* type_name() noexcept { return "spine_model_asset"; } + static const char* type_name() noexcept { return "spine_asset"; } static load_async_result load_async(const library& library, str_view address); }; } diff --git a/headers/enduro2d/high/components/spine_player.hpp b/headers/enduro2d/high/components/spine_player.hpp index f15e0b5e..e17cf2ec 100644 --- a/headers/enduro2d/high/components/spine_player.hpp +++ b/headers/enduro2d/high/components/spine_player.hpp @@ -9,8 +9,8 @@ #include "../_high.hpp" #include "../factory.hpp" +#include "../assets/spine_asset.hpp" #include "../assets/material_asset.hpp" -#include "../assets/spine_model_asset.hpp" struct spSkeleton; struct spSkeletonClipping; @@ -32,13 +32,14 @@ namespace e2d using animation_ptr = std::shared_ptr; public: spine_player() = default; - spine_player(const spine_model_asset::ptr& model); - - spine_player& model( - const spine_model_asset::ptr& value); + spine_player(const spine_asset::ptr& spine); + + spine_player& spine( + const spine_asset::ptr& value); spine_player& materials( flat_map&& value) noexcept; + spine_player& materials( const flat_map& value); @@ -48,18 +49,18 @@ namespace e2d bool has_skin(const str& name) const noexcept; bool has_animation(const str& name) const noexcept; + const spine_asset::ptr& spine() const noexcept; const clipping_ptr& clipper() const noexcept; const skeleton_ptr& skeleton() const noexcept; const animation_ptr& animation() const noexcept; - const spine_model_asset::ptr& model() const noexcept; material_asset::ptr find_material(str_hash name) const noexcept; const flat_map& materials() const noexcept; private: + spine_asset::ptr spine_; clipping_ptr clipping_; skeleton_ptr skeleton_; animation_ptr animation_; - spine_model_asset::ptr model_; flat_map materials_; }; @@ -71,7 +72,7 @@ namespace e2d bool operator()( spine_player& component, const fill_context& ctx) const; - + bool operator()( asset_dependencies& dependencies, const collect_context& ctx) const; diff --git a/headers/enduro2d/high/spine_model.hpp b/headers/enduro2d/high/spine.hpp similarity index 54% rename from headers/enduro2d/high/spine_model.hpp rename to headers/enduro2d/high/spine.hpp index 41e28f1b..7bf39e74 100644 --- a/headers/enduro2d/high/spine_model.hpp +++ b/headers/enduro2d/high/spine.hpp @@ -14,39 +14,39 @@ struct spAnimationStateData; namespace e2d { - class bad_spine_model_access final : public exception { + class bad_spine_access final : public exception { public: const char* what() const noexcept final { - return "bad spine model access"; + return "bad spine access"; } }; - class spine_model final { + class spine final { public: using atlas_ptr = std::shared_ptr; using skeleton_data_ptr = std::shared_ptr; using animation_data_ptr = std::shared_ptr; public: - spine_model() = default; - ~spine_model() noexcept = default; + spine() = default; + ~spine() noexcept = default; - spine_model(spine_model&& other) noexcept; - spine_model& operator=(spine_model&& other) noexcept; - - spine_model(const spine_model& other); - spine_model& operator=(const spine_model& other); + spine(spine&& other) noexcept; + spine& operator=(spine&& other) noexcept; + + spine(const spine& other); + spine& operator=(const spine& other); void clear() noexcept; - void swap(spine_model& other) noexcept; + void swap(spine& other) noexcept; - spine_model& assign(spine_model&& other) noexcept; - spine_model& assign(const spine_model& other); + spine& assign(spine&& other) noexcept; + spine& assign(const spine& other); - spine_model& set_atlas(atlas_ptr atlas); - spine_model& set_skeleton(skeleton_data_ptr skeleton); + spine& set_atlas(atlas_ptr atlas); + spine& set_skeleton(skeleton_data_ptr skeleton); - spine_model& set_default_mix(secf duration); - spine_model& set_animation_mix( + spine& set_default_mix(secf duration); + spine& set_animation_mix( const str& from, const str& to, secf duration); @@ -60,7 +60,7 @@ namespace e2d animation_data_ptr animation_; }; - void swap(spine_model& l, spine_model& r) noexcept; - bool operator==(const spine_model& l, const spine_model& r) noexcept; - bool operator!=(const spine_model& l, const spine_model& r) noexcept; + void swap(spine& l, spine& r) noexcept; + bool operator==(const spine& l, const spine& r) noexcept; + bool operator!=(const spine& l, const spine& r) noexcept; } diff --git a/samples/bin/library/prefabs/coin_prefab.json b/samples/bin/library/prefabs/coin_prefab.json index 9150a31e..2ada0a91 100644 --- a/samples/bin/library/prefabs/coin_prefab.json +++ b/samples/bin/library/prefabs/coin_prefab.json @@ -2,7 +2,7 @@ "prototype" : "spine_prefab.json", "components" : { "spine_player" : { - "model" : "../spines/coin_spine.json" + "spine" : "../spines/coin_spine.json" }, "spine_player_cmd" : { "commands" : [{ diff --git a/samples/bin/library/prefabs/dragon_prefab.json b/samples/bin/library/prefabs/dragon_prefab.json index af73e837..cb26173b 100644 --- a/samples/bin/library/prefabs/dragon_prefab.json +++ b/samples/bin/library/prefabs/dragon_prefab.json @@ -2,7 +2,7 @@ "prototype" : "spine_prefab.json", "components" : { "spine_player" : { - "model" : "../spines/dragon_spine.json" + "spine" : "../spines/dragon_spine.json" }, "spine_player_cmd" : { "commands" : [{ diff --git a/samples/bin/library/prefabs/raptor_prefab.json b/samples/bin/library/prefabs/raptor_prefab.json index 89bdfc7d..b44ab93d 100644 --- a/samples/bin/library/prefabs/raptor_prefab.json +++ b/samples/bin/library/prefabs/raptor_prefab.json @@ -2,7 +2,7 @@ "prototype" : "spine_prefab.json", "components" : { "spine_player" : { - "model" : "../spines/raptor_spine.json" + "spine" : "../spines/raptor_spine.json" }, "spine_player_cmd" : { "commands" : [{ diff --git a/sources/enduro2d/high/assets/spine_model_asset.cpp b/sources/enduro2d/high/assets/spine_asset.cpp similarity index 86% rename from sources/enduro2d/high/assets/spine_model_asset.cpp rename to sources/enduro2d/high/assets/spine_asset.cpp index 61ff571c..fbd5af9d 100644 --- a/sources/enduro2d/high/assets/spine_model_asset.cpp +++ b/sources/enduro2d/high/assets/spine_asset.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ -#include +#include #include #include @@ -17,13 +17,13 @@ namespace { using namespace e2d; - class spine_model_asset_loading_exception final : public asset_loading_exception { + class spine_asset_loading_exception final : public asset_loading_exception { const char* what() const noexcept final { - return "spine model asset loading exception"; + return "spine asset loading exception"; } }; - const char* spine_model_asset_schema_source = R"json({ + const char* spine_asset_schema_source = R"json({ "type" : "object", "required" : [ "atlas", "skeleton" ], "additionalProperties" : false, @@ -52,16 +52,16 @@ namespace } })json"; - const rapidjson::SchemaDocument& spine_model_asset_schema() { + const rapidjson::SchemaDocument& spine_asset_schema() { static std::mutex mutex; static std::unique_ptr schema; std::lock_guard guard(mutex); if ( !schema ) { rapidjson::Document doc; - if ( doc.Parse(spine_model_asset_schema_source).HasParseError() ) { - the().error("SPINE: Failed to parse spine model asset schema"); - throw spine_model_asset_loading_exception(); + if ( doc.Parse(spine_asset_schema_source).HasParseError() ) { + the().error("ASSETS: Failed to parse spine asset schema"); + throw spine_asset_loading_exception(); } json_utils::add_common_schema_definitions(doc); schema = std::make_unique(doc); @@ -82,19 +82,19 @@ namespace E2D_ASSERT(root.HasMember("from") && root["from"].IsString()); if ( !json_utils::try_parse_value(root["from"], mix.from) ) { the().error("SPINE: Incorrect formating of 'from' property"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } E2D_ASSERT(root.HasMember("to") && root["to"].IsString()); if ( !json_utils::try_parse_value(root["to"], mix.to) ) { the().error("SPINE: Incorrect formating of 'to' property"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } E2D_ASSERT(root.HasMember("duration") && root["duration"].IsNumber()); if ( !json_utils::try_parse_value(root["duration"], mix.duration) ) { the().error("SPINE: Incorrect formating of 'duration' property"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } return mix; @@ -105,7 +105,7 @@ namespace asset_dependencies loading; }; - stdex::promise load_atlas( + stdex::promise load_atlas( const library& library, const str& parent_address, const str& atlas_address) @@ -120,7 +120,7 @@ namespace ](const binary_asset::load_result& atlas_data){ auto atlas_internal = std::make_unique(); - spine_model::atlas_ptr atlas( + spine::atlas_ptr atlas( spAtlas_create( reinterpret_cast(atlas_data->content().data()), math::numeric_cast(atlas_data->content().size()), @@ -130,7 +130,7 @@ namespace if ( !atlas ) { the().error("SPINE: Failed to create preload atlas"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } return stdex::make_tuple_promise(std::make_tuple( @@ -146,7 +146,7 @@ namespace auto atlas_internal = std::make_unique(); atlas_internal->loaded = std::get<0>(results); - spine_model::atlas_ptr atlas( + spine::atlas_ptr atlas( spAtlas_create( reinterpret_cast(std::get<1>(results)->content().data()), math::numeric_cast(std::get<1>(results)->content().size()), @@ -156,13 +156,13 @@ namespace if ( !atlas ) { the().error("SPINE: Failed to create preloaded atlas"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } for ( const spAtlasPage* page = atlas->pages; page; page = page->next ) { if ( !page->rendererObject ) { the().error("SPINE: Failed to create preloaded atlas"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } } @@ -171,12 +171,12 @@ namespace }); } - stdex::promise load_skeleton_data( + stdex::promise load_skeleton_data( const library& library, const str& parent_address, const str& skeleton_address, f32 skeleton_scale, - const spine_model::atlas_ptr& atlas) + const spine::atlas_ptr& atlas) { return library.load_asset_async( path::combine(parent_address, skeleton_address)) @@ -196,12 +196,12 @@ namespace if ( !binary_skeleton ) { the().error("SPINE: Failed to create binary skeleton"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } binary_skeleton->scale = skeleton_scale; - spine_model::skeleton_data_ptr data_skeleton( + spine::skeleton_data_ptr data_skeleton( spSkeletonBinary_readSkeletonData( binary_skeleton.get(), reinterpret_cast(skeleton_data->content().data()), @@ -212,7 +212,7 @@ namespace the().error("SPINE: Failed to read binary skeleton data:\n" "--> Error: %0", binary_skeleton->error); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } return data_skeleton; @@ -227,12 +227,12 @@ namespace if ( !json_skeleton ) { the().error("SPINE: Failed to create json skeleton"); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } json_skeleton->scale = skeleton_scale; - spine_model::skeleton_data_ptr data_skeleton( + spine::skeleton_data_ptr data_skeleton( spSkeletonJson_readSkeletonData( json_skeleton.get(), reinterpret_cast(skeleton_data->content().data())), @@ -242,7 +242,7 @@ namespace the().error("SPINE: Failed to read json skeleton data:\n" "--> Error: %0", json_skeleton->error); - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); } return data_skeleton; @@ -250,7 +250,7 @@ namespace }); } - stdex::promise parse_spine_model( + stdex::promise parse_spine( const library& library, const str& parent_address, const rapidjson::Value& root) @@ -297,7 +297,7 @@ namespace atlas_address, skeleton_scale, skeleton_address - ](const spine_model::atlas_ptr& atlas){ + ](const spine::atlas_ptr& atlas){ return stdex::make_tuple_promise(std::make_tuple( stdex::make_resolved_promise(atlas), load_skeleton_data( @@ -311,10 +311,10 @@ namespace default_animation_mix, animation_mixes = std::move(animation_mixes) ](const std::tuple< - spine_model::atlas_ptr, - spine_model::skeleton_data_ptr + spine::atlas_ptr, + spine::skeleton_data_ptr >& results){ - spine_model content; + spine content; content.set_atlas(std::get<0>(results)); content.set_skeleton(std::get<1>(results)); content.set_default_mix(default_animation_mix); @@ -328,7 +328,7 @@ namespace namespace e2d { - spine_model_asset::load_async_result spine_model_asset::load_async( + spine_asset::load_async_result spine_asset::load_async( const library& library, str_view address) { return library.load_asset_async(address) @@ -339,7 +339,7 @@ namespace e2d ](const json_asset::load_result& spine_data){ return the().do_in_worker_thread([address, spine_data](){ const rapidjson::Document& doc = *spine_data->content(); - rapidjson::SchemaValidator validator(spine_model_asset_schema()); + rapidjson::SchemaValidator validator(spine_asset_schema()); if ( doc.Accept(validator) ) { return; @@ -358,14 +358,14 @@ namespace e2d the().error("ASSET: Failed to validate asset json"); } - throw spine_model_asset_loading_exception(); + throw spine_asset_loading_exception(); }) .then([&library, parent_address, spine_data](){ - return parse_spine_model( + return parse_spine( library, parent_address, *spine_data->content()); }) .then([](auto&& content){ - return spine_model_asset::create( + return spine_asset::create( std::forward(content)); }); }); diff --git a/sources/enduro2d/high/components/spine_player.cpp b/sources/enduro2d/high/components/spine_player.cpp index 5dda517c..9a6d6562 100644 --- a/sources/enduro2d/high/components/spine_player.cpp +++ b/sources/enduro2d/high/components/spine_player.cpp @@ -10,11 +10,11 @@ namespace e2d { - spine_player::spine_player(const spine_model_asset::ptr& model) { - this->model(model); + spine_player::spine_player(const spine_asset::ptr& spine) { + this->spine(spine); } - - spine_player& spine_player::model(const spine_model_asset::ptr& value) { + + spine_player& spine_player::spine(const spine_asset::ptr& value) { clipping_ptr new_clipping = clipping_ptr( spSkeletonClipping_create(), spSkeletonClipping_dispose); @@ -42,7 +42,7 @@ namespace e2d } } - model_ = value; + spine_ = value; clipping_ = std::move(new_clipping); skeleton_ = std::move(new_skeleton); animation_ = std::move(new_animation); @@ -69,7 +69,7 @@ namespace e2d } return *this; } - + spine_player& spine_player::attachment(const str& slot, const str& name) noexcept { if ( !spSkeleton_setAttachment(skeleton_.get(), slot.c_str(), name.c_str()) ) { the().error("SPINE_PLAYER: can't set attachment '%0' to slot '%1'", name, slot); @@ -78,17 +78,21 @@ namespace e2d } bool spine_player::has_skin(const str& name) const noexcept { - return model_ - && model()->content().skeleton() - && spSkeletonData_findSkin(model()->content().skeleton().get(), name.c_str()); - } - - bool spine_player::has_animation(const str& name) const noexcept { - return model_ - && model()->content().skeleton() - && spSkeletonData_findAnimation(model()->content().skeleton().get(), name.c_str()); + return spine_ + && spine()->content().skeleton() + && spSkeletonData_findSkin(spine()->content().skeleton().get(), name.c_str()); } + bool spine_player::has_animation(const str& name) const noexcept { + return spine_ + && spine()->content().skeleton() + && spSkeletonData_findAnimation(spine()->content().skeleton().get(), name.c_str()); + } + + const spine_asset::ptr& spine_player::spine() const noexcept { + return spine_; + } + const spine_player::clipping_ptr& spine_player::clipper() const noexcept { return clipping_; } @@ -100,10 +104,6 @@ namespace e2d const spine_player::animation_ptr& spine_player::animation() const noexcept { return animation_; } - - const spine_model_asset::ptr& spine_player::model() const noexcept { - return model_; - } material_asset::ptr spine_player::find_material(str_hash name) const noexcept { const auto iter = materials_.find(name); @@ -124,7 +124,7 @@ namespace e2d "required" : [], "additionalProperties" : false, "properties" : { - "model" : { "$ref": "#/common_definitions/address" }, + "spine" : { "$ref": "#/common_definitions/address" }, "materials" : { "$ref": "#/definitions/materials" }, "skin" : { "$ref": "#/common_definitions/name" }, "attachments" : { "$ref": "#/definitions/attachments" } @@ -156,23 +156,23 @@ namespace e2d } } })json"; - + bool factory_loader::operator()( spine_player& component, const fill_context& ctx) const { - if ( ctx.root.HasMember("model") ) { - auto model = ctx.dependencies.find_asset( - path::combine(ctx.parent_address, ctx.root["model"].GetString())); - if ( !model ) { - the().error("SPINE_PLAYER: Dependency 'model' is not found:\n" + if ( ctx.root.HasMember("spine") ) { + auto spine = ctx.dependencies.find_asset( + path::combine(ctx.parent_address, ctx.root["spine"].GetString())); + if ( !spine ) { + the().error("SPINE_PLAYER: Dependency 'spine' is not found:\n" "--> Parent address: %0\n" "--> Dependency address: %1", ctx.parent_address, - ctx.root["model"].GetString()); + ctx.root["spine"].GetString()); return false; } - component.model(model); + component.spine(spine); } if ( ctx.root.HasMember("materials") ) { @@ -209,7 +209,7 @@ namespace e2d } component.materials(std::move(materials)); } - + if ( ctx.root.HasMember("skin") ) { str skin; if ( !json_utils::try_parse_value(ctx.root["skin"], skin) ) { @@ -222,7 +222,7 @@ namespace e2d if ( ctx.root.HasMember("attachments") ) { const auto& attachments_json = ctx.root["attachments"]; E2D_ASSERT(attachments_json.IsArray()); - + for ( rapidjson::SizeType i = 0; i < attachments_json.Size(); ++i ) { E2D_ASSERT(attachments_json[i].IsObject()); const auto& attachment_json = attachments_json[i]; @@ -247,14 +247,14 @@ namespace e2d return true; } - + bool factory_loader::operator()( asset_dependencies& dependencies, const collect_context& ctx) const { - if ( ctx.root.HasMember("model") ) { - dependencies.add_dependency( - path::combine(ctx.parent_address, ctx.root["model"].GetString())); + if ( ctx.root.HasMember("spine") ) { + dependencies.add_dependency( + path::combine(ctx.parent_address, ctx.root["spine"].GetString())); } if ( ctx.root.HasMember("materials") ) { diff --git a/sources/enduro2d/high/spine_model.cpp b/sources/enduro2d/high/spine.cpp similarity index 65% rename from sources/enduro2d/high/spine_model.cpp rename to sources/enduro2d/high/spine.cpp index 08af0451..1fc798a9 100644 --- a/sources/enduro2d/high/spine_model.cpp +++ b/sources/enduro2d/high/spine.cpp @@ -4,52 +4,52 @@ * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ -#include +#include #include namespace e2d { - spine_model::spine_model(spine_model&& other) noexcept { + spine::spine(spine&& other) noexcept { assign(std::move(other)); } - spine_model& spine_model::operator=(spine_model&& other) noexcept { + spine& spine::operator=(spine&& other) noexcept { return assign(std::move(other)); } - - spine_model::spine_model(const spine_model& other) { + + spine::spine(const spine& other) { assign(other); } - spine_model& spine_model::operator=(const spine_model& other) { + spine& spine::operator=(const spine& other) { return assign(other); } - void spine_model::clear() noexcept { + void spine::clear() noexcept { atlas_.reset(); skeleton_.reset(); animation_.reset(); } - void spine_model::swap(spine_model& other) noexcept { + void spine::swap(spine& other) noexcept { using std::swap; swap(atlas_, other.atlas_); swap(skeleton_, other.skeleton_); swap(animation_, other.animation_); } - spine_model& spine_model::assign(spine_model&& other) noexcept { + spine& spine::assign(spine&& other) noexcept { if ( this != &other ) { swap(other); other.clear(); } return *this; } - - spine_model& spine_model::assign(const spine_model& other) { + + spine& spine::assign(const spine& other) { if ( this != &other ) { - spine_model m; + spine m; m.atlas_ = other.atlas_; m.skeleton_ = other.skeleton_; m.animation_ = other.animation_; @@ -58,12 +58,12 @@ namespace e2d return *this; } - spine_model& spine_model::set_atlas(atlas_ptr atlas) { + spine& spine::set_atlas(atlas_ptr atlas) { atlas_ = std::move(atlas); return *this; } - spine_model& spine_model::set_skeleton(skeleton_data_ptr skeleton) { + spine& spine::set_skeleton(skeleton_data_ptr skeleton) { animation_data_ptr animation; if ( skeleton ) { animation.reset( @@ -78,15 +78,15 @@ namespace e2d return *this; } - spine_model& spine_model::set_default_mix(secf duration) { + spine& spine::set_default_mix(secf duration) { if ( !animation_ ) { - throw bad_spine_model_access(); + throw bad_spine_access(); } animation_->defaultMix = duration.value; return *this; } - spine_model& spine_model::set_animation_mix( + spine& spine::set_animation_mix( const str& from, const str& to, secf duration) @@ -100,39 +100,39 @@ namespace e2d : nullptr; if ( !from_anim || !to_anim ) { - throw bad_spine_model_access(); + throw bad_spine_access(); } spAnimationStateData_setMix(animation_.get(), from_anim, to_anim, duration.value); return *this; } - const spine_model::atlas_ptr& spine_model::atlas() const noexcept { + const spine::atlas_ptr& spine::atlas() const noexcept { return atlas_; } - const spine_model::skeleton_data_ptr& spine_model::skeleton() const noexcept { + const spine::skeleton_data_ptr& spine::skeleton() const noexcept { return skeleton_; } - const spine_model::animation_data_ptr& spine_model::animation() const noexcept { + const spine::animation_data_ptr& spine::animation() const noexcept { return animation_; } } namespace e2d { - void swap(spine_model& l, spine_model& r) noexcept { + void swap(spine& l, spine& r) noexcept { l.swap(r); } - - bool operator==(const spine_model& l, const spine_model& r) noexcept { + + bool operator==(const spine& l, const spine& r) noexcept { return l.atlas() == r.atlas() && l.skeleton() == r.skeleton() && l.animation() == r.animation(); } - bool operator!=(const spine_model& l, const spine_model& r) noexcept { + bool operator!=(const spine& l, const spine& r) noexcept { return !(l == r); } } diff --git a/untests/sources/untests_core/render.cpp b/untests/sources/untests_core/render.cpp index 7a43875f..a282cfd7 100644 --- a/untests/sources/untests_core/render.cpp +++ b/untests/sources/untests_core/render.cpp @@ -35,10 +35,10 @@ TEST_CASE("render"){ } { const auto ss = render::sampler_state() - .wrap(render::sampler_wrap::clamp) + .wrap(render::sampler_wrap::clamp, render::sampler_wrap::mirror) .filter(render::sampler_min_filter::linear, render::sampler_mag_filter::nearest); REQUIRE(ss.s_wrap() == render::sampler_wrap::clamp); - REQUIRE(ss.t_wrap() == render::sampler_wrap::clamp); + REQUIRE(ss.t_wrap() == render::sampler_wrap::mirror); REQUIRE(ss.min_filter() == render::sampler_min_filter::linear); REQUIRE(ss.mag_filter() == render::sampler_mag_filter::nearest); }