Add "add all csg" button

This commit is contained in:
2025-12-13 21:42:56 +00:00
parent 013e73254c
commit 7aff6caa7b
2 changed files with 8 additions and 5 deletions
+6 -3
View File
@@ -36,7 +36,7 @@ pub(crate) struct GState {
pub(crate) lights: Vec<Light>,
pub(crate) csg: Vec<Arc<RwLock<CSG>>>,
pub(crate) new_csg_needed: bool,
pub(crate) new_csgs_needed: u8,
pub(crate) fps: [f64; 128],
@@ -63,7 +63,7 @@ impl Default for GState {
lights: vec![],
csg: vec![],
new_csg_needed: false,
new_csgs_needed: 0,
fps: [0.0; 128],
@@ -228,7 +228,10 @@ pub(crate) fn gui_up(gui: &mut Gui, state: &mut GState) {
state.csg.remove(i);
}
if state.csg.len() < 32 && ui.small_button("add csg").clicked() {
state.new_csg_needed = true;
state.new_csgs_needed += 1;
}
if state.csg.len() < 32 && ui.small_button("add all csgs").clicked() {
state.new_csgs_needed = (32 - state.csg.len()) as u8;
}
ui.heading(format!("Lights ({})", state.lights.len()));
let mut lightdel = vec![];
+2 -2
View File
@@ -1560,7 +1560,7 @@ impl App {
gui_up(&mut rcx.gui, &mut self.gstate);
}
if self.gstate.new_csg_needed {
while self.gstate.new_csgs_needed > 0 {
self.thread_work_creation
.send(WorkItem::CreateCSG(
self.device.clone(),
@@ -1579,7 +1579,7 @@ impl App {
-1,
))
.unwrap();
self.gstate.new_csg_needed = false;
self.gstate.new_csgs_needed -= 1;
}
rcx.recreate_pipelines |= self.gstate.recreate_pipelines;