Skip to content

Commit

Permalink
more particle cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
twof committed Dec 22, 2024
1 parent 89d5369 commit 484de2e
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions frontend/renderer/src/particle_renderer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::HashSet;
use std::hash::{Hash, Hasher};

use crate::geometry;

Expand Down Expand Up @@ -39,61 +38,6 @@ pub struct Particle {
creation_time: f32,
}

impl PartialEq for Particle {
fn eq(&self, other: &Particle) -> bool {
let positions = self.position;
let other_positions = other.position;
if !positions.eq(&other_positions) {
return false;
}

let velocity = self.velocity;
let other_velocity = other.velocity;
if !velocity.eq(&other_velocity) {
return false;
}

let color = self.color;
let other_color = other.color;
if !color.eq(&other_color) {
return false;
}

if self.lifetime - other.lifetime != 0.0 {
return false;
}

if self.creation_time - other.creation_time != 0.0 {
return false;
}

true
}
}

impl Eq for Particle {}
impl Hash for Particle {
fn hash<H: Hasher>(&self, state: &mut H) {
let position = self.position;
let velocity = self.velocity;
let color = self.color;
for position in &position {
state.write(&position.to_be_bytes());
}

for velocity in &velocity {
state.write(&velocity.to_be_bytes());
}

for color in &color {
state.write(&color.to_be_bytes());
}

state.write(&self.lifetime.to_be_bytes());
state.write(&self.creation_time.to_be_bytes());
}
}

#[derive(Debug)]
pub struct DrawSet {
projection_matrix: Matrix4<f32>,
Expand Down

0 comments on commit 484de2e

Please sign in to comment.