tirbofish/dropbear
main / crates / eucalyptus-editor / src / editor / settings.rs · 2556 bytes
crates/eucalyptus-editor/src/editor/settings.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
pub mod editor;
pub mod project;
use crate::editor::{EditorTabViewer, StaticallyKept};
use eucalyptus_core::states::SCENES;
impl<'a> EditorTabViewer<'a> {
pub fn scene_settings(&mut self, _cfg: &mut StaticallyKept, ui: &mut egui::Ui) {
ui.label("Scene Settings");
let current_scene_name = self.current_scene_name.clone();
if let Some(scene_name) = current_scene_name {
let mut scenes = SCENES.write();
if let Some(scene) = scenes.iter_mut().find(|s| s.scene_name == scene_name) {
ui.label(format!("Scene: {}", scene.scene_name));
ui.separator();
let mut preloaded = scene.settings.preloaded;
if ui.checkbox(&mut preloaded, "Preload Assets").changed() {
scene.settings.preloaded = preloaded;
}
ui.label("Ensures scene assets are preloaded at game start");
let mut show_hitboxes = scene.settings.show_hitboxes;
if ui.checkbox(&mut show_hitboxes, "Render Hitboxes").changed() {
scene.settings.show_hitboxes = show_hitboxes;
}
ui.label("Renders collider wireframes for debugging");
let mut overlay_billboard = scene.settings.overlay_billboard;
if ui
.checkbox(&mut overlay_billboard, "Overlay Billboard UI")
.changed()
{
scene.settings.overlay_billboard = overlay_billboard;
}
ui.label("Renders billboard UI widgets for all entities");
let mut overlay_hud = scene.settings.overlay_hud;
if ui.checkbox(&mut overlay_hud, "Overlay HUD").changed() {
scene.settings.overlay_hud = overlay_hud;
}
ui.label("Renders the HUD UI overlay on top of the viewport");
ui.separator();
ui.label("Ambient Strength");
let mut ambient = scene.settings.ambient_strength;
if ui
.add(egui::Slider::new(&mut ambient, 0.0..=2.0).step_by(0.01))
.changed()
{
scene.settings.ambient_strength = ambient;
}
ui.label("Controls the intensity of ambient/IBL lighting");
} else {
ui.label("Scene not found");
}
} else {
ui.label("No scene currently loaded");
}
}
}