add 'random_sub_uv' particle setting
This commit is contained in:
@@ -10,9 +10,11 @@ dv::value ParticlesPreset::serialize() const {
|
||||
root["max_distance"] = maxDistance;
|
||||
root["spawn_interval"] = spawnInterval;
|
||||
root["lifetime"] = lifetime;
|
||||
root["lifetime_spread"] = lifetimeSpread;
|
||||
root["acceleration"] = dv::to_value(acceleration);
|
||||
root["explosion"] = dv::to_value(explosion);
|
||||
root["size"] = dv::to_value(size);
|
||||
root["random_sub_uv"] = randomSubUV;
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -23,6 +25,8 @@ void ParticlesPreset::deserialize(const dv::value& src) {
|
||||
src.at("max_distance").get(maxDistance);
|
||||
src.at("spawn_interval").get(spawnInterval);
|
||||
src.at("lifetime").get(lifetime);
|
||||
src.at("lifetime_spread").get(lifetimeSpread);
|
||||
src.at("random_sub_uv").get(randomSubUV);
|
||||
if (src.has("acceleration")) {
|
||||
dv::get_vec(src["acceleration"], acceleration);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ struct ParticlesPreset : public Serializable {
|
||||
float spawnInterval = 0.1f;
|
||||
/// @brief Particle life time
|
||||
float lifetime = 5.0f;
|
||||
/// @brief Life time spread divided by lifetime
|
||||
float lifetimeSpread = 0.2f;
|
||||
/// @brief Initial velocity
|
||||
glm::vec3 velocity {};
|
||||
/// @brief Velocity acceleration
|
||||
@@ -25,6 +27,8 @@ struct ParticlesPreset : public Serializable {
|
||||
glm::vec3 size {0.1f};
|
||||
/// @brief Texture name
|
||||
std::string texture = "";
|
||||
/// @brief Size of random sub-uv region
|
||||
float randomSubUV = 1.0f;
|
||||
|
||||
dv::value serialize() const override;
|
||||
void deserialize(const dv::value& src) override;
|
||||
|
||||
Reference in New Issue
Block a user