Commit 94e06586 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed particle config destruction order

parent ace0c9b9
Pipeline #2640 passed with stage
in 11 minutes and 44 seconds
......@@ -443,8 +443,8 @@ namespace mirrage::asset {
template <>
struct Loader<renderer::Particle_system_config> {
public:
static auto load(istream in) -> async::task<renderer::Particle_system_config>;
[[noreturn]] static void save(ostream, const renderer::Particle_system_config&)
auto load(istream in) -> async::task<renderer::Particle_system_config>;
[[noreturn]] void save(ostream, const renderer::Particle_system_config&)
{
MIRRAGE_FAIL("Save of Particle_system_config is not supported!");
}
......@@ -453,8 +453,8 @@ namespace mirrage::asset {
template <>
struct Loader<renderer::Particle_type_config> {
public:
static auto load(istream in) -> async::task<renderer::Particle_type_config>;
[[noreturn]] static void save(ostream, const renderer::Particle_type_config&)
auto load(istream in) -> async::task<renderer::Particle_type_config>;
[[noreturn]] void save(ostream, const renderer::Particle_type_config&)
{
MIRRAGE_FAIL("Save of Particle_type_config is not supported!");
}
......
......@@ -472,12 +472,16 @@ namespace mirrage::renderer {
assets.create_stateful_loader<Material>(device, assets, material_sampler, material_layout);
assets.create_stateful_loader<Model>(device, assets, draw_queue);
assets.create_stateful_loader<Particle_script>(device, storage_buffer, uniform_buffer);
assets.create_stateful_loader<Particle_system_config>();
assets.create_stateful_loader<Particle_type_config>();
}
~Asset_loaders()
{
assets.remove_stateful_loader<Particle_type_config>();
assets.remove_stateful_loader<Particle_system_config>();
assets.remove_stateful_loader<Particle_script>();
assets.remove_stateful_loader<Model>();
assets.remove_stateful_loader<Material>();
assets.remove_stateful_loader<Particle_script>();
}
};
......
......@@ -85,8 +85,8 @@ namespace mirrage::renderer {
, _loaded(_cfg.ready())
, _emitters(!_loaded ? Emitter_list{}
: util::build_vector(
_cfg->emitters.size(),
[&](auto idx) { return Particle_emitter(_cfg->emitters[idx]); }))
_cfg->emitters.size(),
[&](auto idx) { return Particle_emitter(_cfg->emitters[idx]); }))
, _effectors(!_loaded ? Effector_list{} : _cfg->effectors)
, _position(position)
, _rotation(rotation)
......@@ -203,13 +203,12 @@ namespace mirrage::asset {
{
auto r = renderer::Particle_system_config();
sf2::deserialize_json(
in,
[&](auto& msg, uint32_t row, uint32_t column) {
LOG(plog::error) << "Error parsing JSON from " << in.aid().str() << " at " << row << ":"
<< column << ": " << msg;
},
r);
sf2::deserialize_json(in,
[&](auto& msg, uint32_t row, uint32_t column) {
LOG(plog::error) << "Error parsing JSON from " << in.aid().str() << " at "
<< row << ":" << column << ": " << msg;
},
r);
auto loads = std::vector<async::task<void>>();
loads.reserve(r.emitters.size() * 2u);
......@@ -232,13 +231,12 @@ namespace mirrage::asset {
{
auto r = renderer::Particle_type_config();
sf2::deserialize_json(
in,
[&](auto& msg, uint32_t row, uint32_t column) {
LOG(plog::error) << "Error parsing JSON from " << in.aid().str() << " at " << row << ":"
<< column << ": " << msg;
},
r);
sf2::deserialize_json(in,
[&](auto& msg, uint32_t row, uint32_t column) {
LOG(plog::error) << "Error parsing JSON from " << in.aid().str() << " at "
<< row << ":" << column << ": " << msg;
},
r);
auto script = in.manager().load<renderer::Particle_script>(r.update_script_id);
r.update_script = script;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment