mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-16 14:08:59 +07:00
remove atlas pma flag
This commit is contained in:
@@ -42,7 +42,7 @@ namespace e2d
|
|||||||
spine_model& assign(spine_model&& other) noexcept;
|
spine_model& assign(spine_model&& other) noexcept;
|
||||||
spine_model& assign(const spine_model& other);
|
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_skeleton(skeleton_data_ptr skeleton);
|
||||||
|
|
||||||
spine_model& set_default_mix(secf duration);
|
spine_model& set_default_mix(secf duration);
|
||||||
@@ -54,12 +54,10 @@ namespace e2d
|
|||||||
const atlas_ptr& atlas() const noexcept;
|
const atlas_ptr& atlas() const noexcept;
|
||||||
const skeleton_data_ptr& skeleton() const noexcept;
|
const skeleton_data_ptr& skeleton() const noexcept;
|
||||||
const animation_data_ptr& animation() const noexcept;
|
const animation_data_ptr& animation() const noexcept;
|
||||||
bool premultiplied_alpha() const noexcept;
|
|
||||||
private:
|
private:
|
||||||
atlas_ptr atlas_;
|
atlas_ptr atlas_;
|
||||||
skeleton_data_ptr skeleton_;
|
skeleton_data_ptr skeleton_;
|
||||||
animation_data_ptr animation_;
|
animation_data_ptr animation_;
|
||||||
bool premultiplied_alpha_ = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void swap(spine_model& l, spine_model& r) noexcept;
|
void swap(spine_model& l, spine_model& r) noexcept;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"atlas" : "coin/coin-pma.atlas",
|
"atlas" : "coin/coin-pma.atlas",
|
||||||
"premultiplied_alpha" : true,
|
|
||||||
"skeleton" : "coin/coin-pro.skel",
|
"skeleton" : "coin/coin-pro.skel",
|
||||||
"skeleton_scale" : 1.0
|
"skeleton_scale" : 1.0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ namespace
|
|||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"atlas" : { "$ref" : "#/common_definitions/address" },
|
"atlas" : { "$ref" : "#/common_definitions/address" },
|
||||||
"premultiplied_alpha" : { "type" : "boolean" },
|
|
||||||
"skeleton" : { "$ref" : "#/common_definitions/address" },
|
"skeleton" : { "$ref" : "#/common_definitions/address" },
|
||||||
"skeleton_scale" : { "type" : "number" },
|
"skeleton_scale" : { "type" : "number" },
|
||||||
"default_animation_mix" : { "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_path = path::combine(parent_address, atlas_address);
|
||||||
const str atlas_folder = path::parent_path(atlas_path);
|
const str atlas_folder = path::parent_path(atlas_path);
|
||||||
|
|
||||||
return library.load_asset_async<binary_asset>(atlas_path)
|
return library.load_asset_async<binary_asset>(atlas_path)
|
||||||
.then([
|
.then([
|
||||||
&library,
|
&library,
|
||||||
parent_address = atlas_folder
|
atlas_folder
|
||||||
](const binary_asset::load_result& atlas_data){
|
](const binary_asset::load_result& atlas_data){
|
||||||
auto atlas_internal = std::make_unique<atlas_internal_state>();
|
auto atlas_internal = std::make_unique<atlas_internal_state>();
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ namespace
|
|||||||
spAtlas_create(
|
spAtlas_create(
|
||||||
reinterpret_cast<const char*>(atlas_data->content().data()),
|
reinterpret_cast<const char*>(atlas_data->content().data()),
|
||||||
math::numeric_cast<int>(atlas_data->content().size()),
|
math::numeric_cast<int>(atlas_data->content().size()),
|
||||||
parent_address.c_str(),
|
atlas_folder.c_str(),
|
||||||
atlas_internal.get()),
|
atlas_internal.get()),
|
||||||
spAtlas_dispose);
|
spAtlas_dispose);
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ namespace
|
|||||||
stdex::make_resolved_promise(atlas_data)));
|
stdex::make_resolved_promise(atlas_data)));
|
||||||
})
|
})
|
||||||
.then([
|
.then([
|
||||||
parent_address = atlas_folder
|
atlas_folder
|
||||||
](const std::tuple<
|
](const std::tuple<
|
||||||
asset_group,
|
asset_group,
|
||||||
binary_asset::load_result
|
binary_asset::load_result
|
||||||
@@ -150,7 +150,7 @@ namespace
|
|||||||
spAtlas_create(
|
spAtlas_create(
|
||||||
reinterpret_cast<const char*>(std::get<1>(results)->content().data()),
|
reinterpret_cast<const char*>(std::get<1>(results)->content().data()),
|
||||||
math::numeric_cast<int>(std::get<1>(results)->content().size()),
|
math::numeric_cast<int>(std::get<1>(results)->content().size()),
|
||||||
parent_address.c_str(),
|
atlas_folder.c_str(),
|
||||||
atlas_internal.get()),
|
atlas_internal.get()),
|
||||||
spAtlas_dispose);
|
spAtlas_dispose);
|
||||||
|
|
||||||
@@ -280,13 +280,6 @@ namespace
|
|||||||
parse_animation_mix(mixes_json[i]));
|
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<debug>().error("SPINE: Incorrect formating of 'premultiplied_alpha' property");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
E2D_ASSERT(root.HasMember("atlas") && root["atlas"].IsString());
|
E2D_ASSERT(root.HasMember("atlas") && root["atlas"].IsString());
|
||||||
const str atlas_address = root["atlas"].GetString();
|
const str atlas_address = root["atlas"].GetString();
|
||||||
@@ -316,14 +309,13 @@ namespace
|
|||||||
})
|
})
|
||||||
.then([
|
.then([
|
||||||
default_animation_mix,
|
default_animation_mix,
|
||||||
animation_mixes = std::move(animation_mixes),
|
animation_mixes = std::move(animation_mixes)
|
||||||
pma
|
|
||||||
](const std::tuple<
|
](const std::tuple<
|
||||||
spine_model::atlas_ptr,
|
spine_model::atlas_ptr,
|
||||||
spine_model::skeleton_data_ptr
|
spine_model::skeleton_data_ptr
|
||||||
>& results){
|
>& results){
|
||||||
spine_model content;
|
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_skeleton(std::get<1>(results));
|
||||||
content.set_default_mix(default_animation_mix);
|
content.set_default_mix(default_animation_mix);
|
||||||
for ( const animation_mix& mix : animation_mixes ) {
|
for ( const animation_mix& mix : animation_mixes ) {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace e2d
|
|||||||
void spine_model::swap(spine_model& other) noexcept {
|
void spine_model::swap(spine_model& other) noexcept {
|
||||||
using std::swap;
|
using std::swap;
|
||||||
swap(atlas_, other.atlas_);
|
swap(atlas_, other.atlas_);
|
||||||
swap(premultiplied_alpha_, other.premultiplied_alpha_);
|
|
||||||
swap(skeleton_, other.skeleton_);
|
swap(skeleton_, other.skeleton_);
|
||||||
swap(animation_, other.animation_);
|
swap(animation_, other.animation_);
|
||||||
}
|
}
|
||||||
@@ -52,7 +51,6 @@ namespace e2d
|
|||||||
if ( this != &other ) {
|
if ( this != &other ) {
|
||||||
spine_model m;
|
spine_model m;
|
||||||
m.atlas_ = other.atlas_;
|
m.atlas_ = other.atlas_;
|
||||||
m.premultiplied_alpha_ = other.premultiplied_alpha_;
|
|
||||||
m.skeleton_ = other.skeleton_;
|
m.skeleton_ = other.skeleton_;
|
||||||
m.animation_ = other.animation_;
|
m.animation_ = other.animation_;
|
||||||
swap(m);
|
swap(m);
|
||||||
@@ -60,9 +58,8 @@ namespace e2d
|
|||||||
return *this;
|
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);
|
atlas_ = std::move(atlas);
|
||||||
premultiplied_alpha_ = premultiplied_alpha;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,10 +118,6 @@ namespace e2d
|
|||||||
const spine_model::animation_data_ptr& spine_model::animation() const noexcept {
|
const spine_model::animation_data_ptr& spine_model::animation() const noexcept {
|
||||||
return animation_;
|
return animation_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spine_model::premultiplied_alpha() const noexcept {
|
|
||||||
return premultiplied_alpha_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ namespace e2d::render_system_impl
|
|||||||
spSkeleton* skeleton = spine_r.skeleton().get();
|
spSkeleton* skeleton = spine_r.skeleton().get();
|
||||||
spSkeletonClipping* clipper = spine_r.clipper().get();
|
spSkeletonClipping* clipper = spine_r.clipper().get();
|
||||||
const material_asset::ptr& src_mat = node_r.materials().front();
|
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 ) {
|
if ( !skeleton || !clipper || !src_mat ) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user