From 25992c7667d87eb71655c121f52287dce434d955 Mon Sep 17 00:00:00 2001 From: ghostly_zsh Date: Sun, 6 Jul 2025 18:36:05 -0500 Subject: [PATCH] changed file structure a bit --- crates/unified/src/particle/mod.rs | 56 ------------------------------ crates/unified/src/particles.rs | 56 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 56 deletions(-) delete mode 100644 crates/unified/src/particle/mod.rs diff --git a/crates/unified/src/particle/mod.rs b/crates/unified/src/particle/mod.rs deleted file mode 100644 index 7937d0c7f0de1d4c01b5650add56b29ea925e413..0000000000000000000000000000000000000000 --- a/crates/unified/src/particle/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -use bevy::color::{Color, ColorCurve, LinearRgba}; -use bevy::math::cubic_splines::LinearSpline; -use bevy::math::Vec2; -use rand::Rng; -use serde::{Deserialize, Serialize}; - -#[derive(Deserialize, Serialize)] -pub struct ParticleEffect { - // -- lifetime / spawning -- // - - /// Particle lifetime in seconds - pub lifetime_seconds: RandF32, - /// Delay inbetween each batch of particles spawned - pub batch_spawn_delay_seconds: RandF32, - /// Number of distinct particles spawned per batch - pub particles_in_batch: RandF32, - - // -- velocity -- // - - /// Initial linear velocity added to the particle's velocity when it is spawned - pub initial_linear_velocity: RandVec2, - /// Initial angular velocity added to the particle's rotation when it is spawned - pub initial_angular_velocity: RandF32, - - // -- scale -- // - - // Scale curve over the lifetime of the particle - //pub scale: LinearSpline, - - // -- color -- // - - // Color curve over the lifetime of the particle - //pub color: LinearSpline, -} - -#[derive(Deserialize, Serialize)] -pub struct RandF32 { - pub value: f32, - pub randomness: f32 -} -impl RandF32 { - pub fn sample(&self, rng: &mut impl Rng) -> f32 { - rng.random_range(self.value-self.randomness .. self.value+self.randomness) - } -} - -#[derive(Deserialize, Serialize)] -pub struct RandVec2 { - pub x: RandF32, - pub y: RandF32, -} -impl RandVec2 { - pub fn sample(&self, rng: &mut impl Rng) -> Vec2 { - Vec2::new(self.x.sample(rng), self.y.sample(rng)) - } -} \ No newline at end of file diff --git a/crates/unified/src/particles.rs b/crates/unified/src/particles.rs index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..363b7c726f192d8531d7de4e0d9616788b9a13f1 100644 --- a/crates/unified/src/particles.rs +++ b/crates/unified/src/particles.rs @@ -0,0 +1,56 @@ +use bevy::color::{Color, ColorCurve, LinearRgba}; +use bevy::math::cubic_splines::LinearSpline; +use bevy::math::Vec2; +use rand::Rng; +use serde::{Deserialize, Serialize}; + +#[derive(Deserialize, Serialize)] +pub struct ParticleEffect { + // -- lifetime / spawning -- // + + /// Particle lifetime in seconds + pub lifetime_seconds: RandF32, + /// Delay inbetween each batch of particles spawned + pub batch_spawn_delay_seconds: RandF32, + /// Number of distinct particles spawned per batch + pub particles_in_batch: RandF32, + + // -- velocity -- // + + /// Initial linear velocity added to the particle's velocity when it is spawned + pub initial_linear_velocity: RandVec2, + /// Initial angular velocity added to the particle's rotation when it is spawned + pub initial_angular_velocity: RandF32, + + // -- scale -- // + + // Scale curve over the lifetime of the particle + //pub scale: LinearSpline, + + // -- color -- // + + // Color curve over the lifetime of the particle + //pub color: LinearSpline, +} + +#[derive(Deserialize, Serialize)] +pub struct RandF32 { + pub value: f32, + pub randomness: f32 +} +impl RandF32 { + pub fn sample(&self, rng: &mut impl Rng) -> f32 { + rng.random_range(self.value-self.randomness .. self.value+self.randomness) + } +} + +#[derive(Deserialize, Serialize)] +pub struct RandVec2 { + pub x: RandF32, + pub y: RandF32, +} +impl RandVec2 { + pub fn sample(&self, rng: &mut impl Rng) -> Vec2 { + Vec2::new(self.x.sample(rng), self.y.sample(rng)) + } +}