1use bevy::prelude::*;
2
3#[derive(Clone)]
4pub struct LightingConfig {
5 pub ambient_brightness: f32,
6 pub key_illuminance: f32,
7 pub fill_illuminance: f32,
8 pub back_illuminance: f32,
9 pub camera_illuminance: f32,
10 pub enable_fog: bool,
11}
12
13impl Default for LightingConfig {
14 fn default() -> Self {
15 Self {
16 ambient_brightness: 100.0,
17 key_illuminance: 5_000.0,
18 fill_illuminance: 1_000.0,
19 back_illuminance: 800.0,
20 camera_illuminance: 2_000.0,
21 enable_fog: false,
22 }
23 }
24}
25#[derive(Clone)]
26pub struct ColorConfig {
27 pub background: Color,
28 pub cell_color: Color,
29}
30
31impl Default for ColorConfig {
32 fn default() -> Self {
33 Self {
34 background: Color::srgb(0.98, 0.98, 0.98),
35 cell_color: Color::srgb(0.0, 0.0, 0.0),
36 }
37 }
38}
39
40#[derive(Clone)]
41pub struct RenderConfig {
42 pub atom_palette: String,
43 pub show_cell: bool,
44 pub show_axes: bool,
45 pub show_ui: bool,
46 pub supercell_repeat_a: u32,
47 pub supercell_repeat_b: u32,
48 pub supercell_repeat_c: u32,
49 pub ghost_repeated_images: bool,
50 pub ico_subdiv: u32,
51 pub show_orientation_widget: bool,
52 pub orientation_widget_size_px: u32,
53 pub orientation_widget_margin_px: u32,
54 pub orientation_widget_offset_x_px: u32,
55 pub orientation_widget_offset_y_px: u32,
56 pub orientation_widget_camera_scale: f32,
57}
58
59impl Default for RenderConfig {
60 fn default() -> Self {
61 Self {
62 atom_palette: "jmol".to_string(),
63 show_cell: true,
64 show_axes: true,
65 show_ui: false,
66 supercell_repeat_a: 0,
67 supercell_repeat_b: 0,
68 supercell_repeat_c: 0,
69 ghost_repeated_images: true,
70 ico_subdiv: 4,
71 show_orientation_widget: true,
72 orientation_widget_size_px: 100,
73 orientation_widget_margin_px: 0,
74 orientation_widget_offset_x_px: 0,
75 orientation_widget_offset_y_px: 0,
76 orientation_widget_camera_scale: 0.065,
77 }
78 }
79}
80
81#[derive(Clone, Resource, Default)]
82pub struct ViewerConfig {
83 pub color: ColorConfig,
84 pub lighting: LightingConfig,
85 pub render: RenderConfig,
86 pub initial_frame: usize,
87 pub window_width: Option<u32>,
88 pub window_height: Option<u32>,
89}