ability to set pre-generated particles in particle systems
@@ -296,6 +296,18 @@ impl ParticleSystem {
.set_value_and_mark_modified(factor)
}
+ /// Replaces the particles in the particle system with pre-generated set. It could be useful
+ /// to create procedural particle effects; when particles cannot be pre-made.
+ pub fn set_particles(&mut self, particles: Vec<Particle>) {
+ self.free_particles.clear();
+ self.particles = particles;
+ }
+
+ /// Returns a reference to a slice to the current set of particles, generated by the particle system.
+ pub fn particles(&self) -> &[Particle] {
+ &self.particles
+ }
+
/// Removes all generated particles.
pub fn clear_particles(&mut self) {
self.particles.clear();
