From 13a2e9f0a06d4f9a57c752d556e61c9d90e194d6 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Wed, 6 Dec 2023 20:24:23 -0800 Subject: [PATCH] Started light tweaks --- assets/martian.tweak.toml | 24 ++++++++++++++++-------- src/display3d.rs | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/assets/martian.tweak.toml b/assets/martian.tweak.toml index d5a1f58..0808376 100644 --- a/assets/martian.tweak.toml +++ b/assets/martian.tweak.toml @@ -41,6 +41,14 @@ invalid = "/sfx/3D/3DInvalidMove" ### msaa = "Off" +### +# Screen Space Ambient Occlusion +# https://docs.rs/bevy/0.11.3/bevy/pbr/enum.ScreenSpaceAmbientOcclusionQualityLevel.html +# Options: Off, Low, Medium, High, Ultra +# Requires: display3d.msaa = "Off" +### +ssoa.quality_level = "Off" + [display3d.models] assets_file = "models/Martian Chess.glb" skybox_file = "images/skybox.png" @@ -71,6 +79,14 @@ pawn_blue = "DroneBlue" dots_red = "Dots" dots_blue = "DotsBlue" +[display3d.lights] +# https://docs.rs/bevy/0.11.3/bevy/pbr/struct.SpotLight.html +spot_light_scale = 1.0 +# https://docs.rs/bevy/0.11.3/bevy/pbr/struct.PointLight.html +point_light_scale = 1.0 +# https://docs.rs/bevy/0.11.3/bevy/pbr/struct.DirectionalLight.html +directional_light_scale = 1.0 + ### # Fog # Only seems to affect objects and not skyboxes @@ -114,14 +130,6 @@ gamma = 1.0 pre_saturation = 1.0 post_saturation = 1.0 -### -# Screen Space Ambient Occlusion -# https://docs.rs/bevy/0.11.3/bevy/pbr/enum.ScreenSpaceAmbientOcclusionQualityLevel.html -# Requires: display3d.msaa = "Off" -### -[display3d.ssao] -# Options: Off, Low, Medium, High, Ultra -quality_level = "Off" #################### # Display2d settings diff --git a/src/display3d.rs b/src/display3d.rs index 1300136..2932b25 100644 --- a/src/display3d.rs +++ b/src/display3d.rs @@ -272,6 +272,14 @@ fn update_tweaks( With, >, tweaks: Res>, + mut lights: Query< + ( + Option<&mut SpotLight>, + Option<&mut PointLight>, + Option<&mut DirectionalLight>, + ), + Or<(With, With, With)>, + >, mut commands: Commands, server: Res, ) { @@ -302,6 +310,11 @@ fn update_tweaks( } }, ); + lights + .iter_mut() + .for_each(|(mut spot, mut point, mut direction)| { + // Depending on the light, set the scalar tweak + }); } } @@ -871,6 +884,8 @@ pub(crate) mod tweaks { pub msaa: MsaaTweaks, #[serde(default)] pub models: ModelTweaks, + #[serde(default)] + pub lights: LightTweaks, } #[derive(Debug, Deserialize, Default)] @@ -1110,4 +1125,11 @@ pub(crate) mod tweaks { pub dots_red: String, pub dots_blue: String, } + + #[derive(Debug, Deserialize, Default, Clone)] + pub(crate) struct LightTweaks { + pub spot_light_scale: f32, + pub point_light_scale: f32, + pub directional_light_scale: f32, + } }