add ParticlesPreset
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#include "ParticlesPreset.hpp"
|
||||
|
||||
#include "data/dv_util.hpp"
|
||||
|
||||
dv::value ParticlesPreset::serialize() const {
|
||||
auto root = dv::object();
|
||||
root["collision"] = collision;
|
||||
root["lighting"] = lighting;
|
||||
root["max_distance"] = maxDistance;
|
||||
root["acceleration"] = dv::to_value(acceleration);
|
||||
return root;
|
||||
}
|
||||
|
||||
void ParticlesPreset::deserialize(const dv::value& src) {
|
||||
src.at("collision").get(collision);
|
||||
src.at("lighting").get(lighting);
|
||||
if (src.has("acceleration")) {
|
||||
dv::get_vec(src["acceleration"], acceleration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
#include "interfaces/Serializable.hpp"
|
||||
|
||||
struct ParticlesPreset : public Serializable {
|
||||
/// @brief Collision detection
|
||||
bool collision = true;
|
||||
/// @brief Apply lighting
|
||||
bool lighting = true;
|
||||
/// @brief Max distance of actually spawning particles.
|
||||
float maxDistance = 32.0f;
|
||||
/// @brief Velocity acceleration
|
||||
glm::vec3 acceleration {0.0f, -16.0f, 0.0f};
|
||||
|
||||
dv::value serialize() const override;
|
||||
void deserialize(const dv::value& src) override;
|
||||
};
|
||||
Reference in New Issue
Block a user