add standard 'particles' atlas
This commit is contained in:
parent
b9b122dc83
commit
f1dc983766
@ -27,6 +27,7 @@
|
|||||||
],
|
],
|
||||||
"atlases": [
|
"atlases": [
|
||||||
"blocks",
|
"blocks",
|
||||||
"items"
|
"items",
|
||||||
|
"particles"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,25 +23,27 @@ ParticleSpawnShape ParticleSpawnShape_from(std::string_view s) {
|
|||||||
|
|
||||||
dv::value ParticlesPreset::serialize() const {
|
dv::value ParticlesPreset::serialize() const {
|
||||||
auto root = dv::object();
|
auto root = dv::object();
|
||||||
root["texture"] = texture;
|
if (frames.empty()) {
|
||||||
|
root["texture"] = texture;
|
||||||
|
} else {
|
||||||
|
auto& arr = root.list("animation");
|
||||||
|
for (const auto& frame : frames) {
|
||||||
|
arr.add(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
root["collision"] = collision;
|
root["collision"] = collision;
|
||||||
root["lighting"] = lighting;
|
root["lighting"] = lighting;
|
||||||
root["max_distance"] = maxDistance;
|
root["max_distance"] = maxDistance;
|
||||||
root["spawn_interval"] = spawnInterval;
|
root["spawn_interval"] = spawnInterval;
|
||||||
root["lifetime"] = lifetime;
|
root["lifetime"] = lifetime;
|
||||||
root["lifetime_spread"] = lifetimeSpread;
|
root["lifetime_spread"] = lifetimeSpread;
|
||||||
|
root["velocity"] = dv::to_value(velocity);
|
||||||
root["acceleration"] = dv::to_value(acceleration);
|
root["acceleration"] = dv::to_value(acceleration);
|
||||||
root["explosion"] = dv::to_value(explosion);
|
root["explosion"] = dv::to_value(explosion);
|
||||||
root["size"] = dv::to_value(size);
|
root["size"] = dv::to_value(size);
|
||||||
root["spawn_spread"] = dv::to_value(size);
|
root["spawn_spread"] = dv::to_value(size);
|
||||||
root["spawn_shape"] = to_string(spawnShape);
|
root["spawn_shape"] = to_string(spawnShape);
|
||||||
root["random_sub_uv"] = randomSubUV;
|
root["random_sub_uv"] = randomSubUV;
|
||||||
if (!frames.empty()) {
|
|
||||||
auto& arr = root.list("animation");
|
|
||||||
for (const auto& frame : frames) {
|
|
||||||
arr.add(frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +56,9 @@ void ParticlesPreset::deserialize(const dv::value& src) {
|
|||||||
src.at("lifetime").get(lifetime);
|
src.at("lifetime").get(lifetime);
|
||||||
src.at("lifetime_spread").get(lifetimeSpread);
|
src.at("lifetime_spread").get(lifetimeSpread);
|
||||||
src.at("random_sub_uv").get(randomSubUV);
|
src.at("random_sub_uv").get(randomSubUV);
|
||||||
|
if (src.has("velocity")) {
|
||||||
|
dv::get_vec(src["velocity"], velocity);
|
||||||
|
}
|
||||||
if (src.has("acceleration")) {
|
if (src.has("acceleration")) {
|
||||||
dv::get_vec(src["acceleration"], acceleration);
|
dv::get_vec(src["acceleration"], acceleration);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user