From f07a3583f49c0bd6c2334f8b016da07418d0cbf4 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sat, 31 Aug 2019 04:21:22 +0700 Subject: [PATCH] remove atlas pma flag --- headers/enduro2d/high/spine_model.hpp | 4 +--- samples/bin/library/spine_coin.json | 1 - .../high/assets/spine_model_asset.cpp | 22 ++++++------------- sources/enduro2d/high/spine_model.cpp | 9 +------- .../render_system_drawer.cpp | 2 +- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/headers/enduro2d/high/spine_model.hpp b/headers/enduro2d/high/spine_model.hpp index c482d459..41e28f1b 100644 --- a/headers/enduro2d/high/spine_model.hpp +++ b/headers/enduro2d/high/spine_model.hpp @@ -42,7 +42,7 @@ namespace e2d spine_model& assign(spine_model&& other) noexcept; spine_model& assign(const spine_model& other); - 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& set_default_mix(secf duration); @@ -54,12 +54,10 @@ namespace e2d const atlas_ptr& atlas() const noexcept; const skeleton_data_ptr& skeleton() const noexcept; const animation_data_ptr& animation() const noexcept; - bool premultiplied_alpha() const noexcept; private: atlas_ptr atlas_; skeleton_data_ptr skeleton_; animation_data_ptr animation_; - bool premultiplied_alpha_ = false; }; void swap(spine_model& l, spine_model& r) noexcept; diff --git a/samples/bin/library/spine_coin.json b/samples/bin/library/spine_coin.json index c6876a53..7df2f2c7 100644 --- a/samples/bin/library/spine_coin.json +++ b/samples/bin/library/spine_coin.json @@ -1,6 +1,5 @@ { "atlas" : "coin/coin-pma.atlas", - "premultiplied_alpha" : true, "skeleton" : "coin/coin-pro.skel", "skeleton_scale" : 1.0 } diff --git a/sources/enduro2d/high/assets/spine_model_asset.cpp b/sources/enduro2d/high/assets/spine_model_asset.cpp index 77df24d5..61ff571c 100644 --- a/sources/enduro2d/high/assets/spine_model_asset.cpp +++ b/sources/enduro2d/high/assets/spine_model_asset.cpp @@ -29,7 +29,6 @@ namespace "additionalProperties" : false, "properties" : { "atlas" : { "$ref" : "#/common_definitions/address" }, - "premultiplied_alpha" : { "type" : "boolean" }, "skeleton" : { "$ref" : "#/common_definitions/address" }, "skeleton_scale" : { "type" : "number" }, "default_animation_mix" : { "type" : "number" }, @@ -113,10 +112,11 @@ namespace { const str atlas_path = path::combine(parent_address, atlas_address); const str atlas_folder = path::parent_path(atlas_path); + return library.load_asset_async(atlas_path) .then([ &library, - parent_address = atlas_folder + atlas_folder ](const binary_asset::load_result& atlas_data){ auto atlas_internal = std::make_unique(); @@ -124,7 +124,7 @@ namespace spAtlas_create( reinterpret_cast(atlas_data->content().data()), math::numeric_cast(atlas_data->content().size()), - parent_address.c_str(), + atlas_folder.c_str(), atlas_internal.get()), spAtlas_dispose); @@ -138,7 +138,7 @@ namespace stdex::make_resolved_promise(atlas_data))); }) .then([ - parent_address = atlas_folder + atlas_folder ](const std::tuple< asset_group, binary_asset::load_result @@ -150,7 +150,7 @@ namespace spAtlas_create( reinterpret_cast(std::get<1>(results)->content().data()), math::numeric_cast(std::get<1>(results)->content().size()), - parent_address.c_str(), + atlas_folder.c_str(), atlas_internal.get()), spAtlas_dispose); @@ -280,13 +280,6 @@ namespace parse_animation_mix(mixes_json[i])); } } - - bool pma = false; - if ( root.HasMember("premultiplied_alpha") ) { - if ( !json_utils::try_parse_value(root["premultiplied_alpha"], pma) ) { - the().error("SPINE: Incorrect formating of 'premultiplied_alpha' property"); - } - } E2D_ASSERT(root.HasMember("atlas") && root["atlas"].IsString()); const str atlas_address = root["atlas"].GetString(); @@ -316,14 +309,13 @@ namespace }) .then([ default_animation_mix, - animation_mixes = std::move(animation_mixes), - pma + animation_mixes = std::move(animation_mixes) ](const std::tuple< spine_model::atlas_ptr, spine_model::skeleton_data_ptr >& results){ spine_model content; - content.set_atlas(std::get<0>(results), pma); + content.set_atlas(std::get<0>(results)); content.set_skeleton(std::get<1>(results)); content.set_default_mix(default_animation_mix); for ( const animation_mix& mix : animation_mixes ) { diff --git a/sources/enduro2d/high/spine_model.cpp b/sources/enduro2d/high/spine_model.cpp index ae815632..08af0451 100644 --- a/sources/enduro2d/high/spine_model.cpp +++ b/sources/enduro2d/high/spine_model.cpp @@ -35,7 +35,6 @@ namespace e2d void spine_model::swap(spine_model& other) noexcept { using std::swap; swap(atlas_, other.atlas_); - swap(premultiplied_alpha_, other.premultiplied_alpha_); swap(skeleton_, other.skeleton_); swap(animation_, other.animation_); } @@ -52,7 +51,6 @@ namespace e2d if ( this != &other ) { spine_model m; m.atlas_ = other.atlas_; - m.premultiplied_alpha_ = other.premultiplied_alpha_; m.skeleton_ = other.skeleton_; m.animation_ = other.animation_; swap(m); @@ -60,9 +58,8 @@ namespace e2d return *this; } - spine_model& spine_model::set_atlas(atlas_ptr atlas, bool premultiplied_alpha) { + spine_model& spine_model::set_atlas(atlas_ptr atlas) { atlas_ = std::move(atlas); - premultiplied_alpha_ = premultiplied_alpha; return *this; } @@ -121,10 +118,6 @@ namespace e2d const spine_model::animation_data_ptr& spine_model::animation() const noexcept { return animation_; } - - bool spine_model::premultiplied_alpha() const noexcept { - return premultiplied_alpha_; - } } namespace e2d diff --git a/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp b/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp index f5a7983d..61db0aef 100644 --- a/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp +++ b/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp @@ -267,7 +267,7 @@ namespace e2d::render_system_impl spSkeleton* skeleton = spine_r.skeleton().get(); spSkeletonClipping* clipper = spine_r.clipper().get(); const material_asset::ptr& src_mat = node_r.materials().front(); - const bool use_premultiplied_alpha = spine_r.model()->content().premultiplied_alpha(); + const bool use_premultiplied_alpha = false; if ( !skeleton || !clipper || !src_mat ) { return;