remove atlas pma flag

This commit is contained in:
2019-08-31 04:21:22 +07:00
parent 4289ea804f
commit f07a3583f4
5 changed files with 10 additions and 28 deletions

View File

@@ -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;

View File

@@ -1,6 +1,5 @@
{
"atlas" : "coin/coin-pma.atlas",
"premultiplied_alpha" : true,
"skeleton" : "coin/coin-pro.skel",
"skeleton_scale" : 1.0
}

View File

@@ -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<binary_asset>(atlas_path)
.then([
&library,
parent_address = atlas_folder
atlas_folder
](const binary_asset::load_result& atlas_data){
auto atlas_internal = std::make_unique<atlas_internal_state>();
@@ -124,7 +124,7 @@ namespace
spAtlas_create(
reinterpret_cast<const char*>(atlas_data->content().data()),
math::numeric_cast<int>(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<const char*>(std::get<1>(results)->content().data()),
math::numeric_cast<int>(std::get<1>(results)->content().size()),
parent_address.c_str(),
atlas_folder.c_str(),
atlas_internal.get()),
spAtlas_dispose);
@@ -281,13 +281,6 @@ namespace
}
}
bool pma = false;
if ( root.HasMember("premultiplied_alpha") ) {
if ( !json_utils::try_parse_value(root["premultiplied_alpha"], pma) ) {
the<debug>().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 ) {

View File

@@ -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

View File

@@ -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;