Skip to content

Commit f3451fe

Browse files
committed
deleted a lot of stuff
1 parent 3f091e2 commit f3451fe

File tree

8 files changed

+307
-711
lines changed

8 files changed

+307
-711
lines changed

src/components/wall.rs

+35
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ use egui::{Align2, Color32, Pos2, Rect, TextFormat};
88
use serde::{Deserialize, Serialize};
99

1010
use super::gizmo::GizmoComponent;
11+
use crate::events::UpdateWalls;
1112
use crate::math::constants::{SIMULATION_HEIGHT, SIMULATION_WIDTH};
1213
use crate::math::rect::WRect;
1314
use crate::math::transformations::grid_to_image;
1415
use crate::render::gradient::Gradient;
16+
use crate::simulation::plugin::ComponentIDs;
1517
use crate::ui::state::{PlaceType, ToolType};
1618

1719
#[derive(Debug, Default, Clone)]
@@ -443,6 +445,23 @@ impl RectWall {
443445
.with_angle(-std::f32::consts::FRAC_PI_2),
444446
);
445447
}
448+
449+
pub fn spawn_initial_rectwalls(
450+
mut commands: Commands,
451+
mut component_ids: ResMut<ComponentIDs>,
452+
mut wall_update_ev: EventWriter<UpdateWalls>,
453+
) {
454+
commands.spawn(RectWall::new(
455+
25,
456+
25,
457+
50,
458+
50,
459+
false,
460+
1.,
461+
component_ids.get_new_wall_id(),
462+
));
463+
wall_update_ev.send(UpdateWalls);
464+
}
446465
}
447466

448467
#[derive(Component, Serialize, Deserialize, Clone, PartialEq, Copy)]
@@ -647,6 +666,22 @@ impl CircWall {
647666
);
648667
painter.add(TextShape::new(rect.min, galley, Color32::BLACK));
649668
}
669+
670+
pub fn spawn_initial_circwalls(
671+
mut commands: Commands,
672+
mut component_ids: ResMut<ComponentIDs>,
673+
mut wall_update_ev: EventWriter<UpdateWalls>,
674+
) {
675+
commands.spawn(CircWall::new(
676+
500,
677+
500,
678+
25,
679+
false,
680+
1.,
681+
component_ids.get_new_wall_id(),
682+
));
683+
wall_update_ev.send(UpdateWalls);
684+
}
650685
}
651686

652687
impl GizmoComponent for CircWall {

src/simulation/grid.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -335,20 +335,18 @@ impl Grid {
335335
ui_state: &UiState,
336336
time_since_start: f64,
337337
) {
338-
if ui_state.show_plots {
339-
for mut mic in microphones.iter_mut() {
340-
let x = mic.x;
341-
let y = mic.y;
342-
343-
mic.record.push([
344-
time_since_start,
345-
self.pressure[coords_to_index(
346-
x + ui_state.boundary_width,
347-
y + ui_state.boundary_width,
348-
ui_state.boundary_width,
349-
)] as f64,
350-
]);
351-
}
338+
for mut mic in microphones.iter_mut() {
339+
let x = mic.x;
340+
let y = mic.y;
341+
342+
mic.record.push([
343+
time_since_start,
344+
self.pressure[coords_to_index(
345+
x + ui_state.boundary_width,
346+
y + ui_state.boundary_width,
347+
ui_state.boundary_width,
348+
)] as f64,
349+
]);
352350
}
353351
}
354352

src/simulation/plugin.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ impl Plugin for GridPlugin {
2121
(calc_system, apply_system, update_system).chain(),
2222
);
2323

24-
#[cfg(debug_assertions)]
2524
{
2625
use bevy::app::Startup;
2726

2827
use crate::components::microphone::Microphone;
2928
use crate::components::source::Source;
29+
use crate::components::wall::{CircWall, RectWall};
3030
app.add_systems(
3131
Startup,
3232
(
3333
Source::spawn_initial_sources,
3434
Microphone::spawn_initial_microphones,
35+
RectWall::spawn_initial_rectwalls,
36+
CircWall::spawn_initial_circwalls,
3537
),
3638
);
3739
}

0 commit comments

Comments
 (0)