From 95559d88875e159fd96dee50585dac09ccc60010 Mon Sep 17 00:00:00 2001 From: "Elijah C. Voigt" Date: Wed, 24 Apr 2024 22:04:01 -0700 Subject: [PATCH] Very small quality of life stuff, broke shadows Click to move through into + title Speed up animations by pressing down instead of jumping to end. (tweakable) --- assets/martian.tweak.toml | 24 ++++- assets/models/Martian Chess.glb | 4 +- src/display3d.rs | 166 +++++++++++++++++++++++++------- src/main.rs | 14 +++ src/prelude.rs | 3 +- 5 files changed, 169 insertions(+), 42 deletions(-) diff --git a/assets/martian.tweak.toml b/assets/martian.tweak.toml index d71b18e..b005af7 100644 --- a/assets/martian.tweak.toml +++ b/assets/martian.tweak.toml @@ -149,6 +149,21 @@ put_down = "/SFX/3D/3DPutDownPiece" idle = "/SFX/3D/3DPickup-Idle-PutdownWhirr" invalid = "/sfx/3D/3DInvalidMove" +#################### +# Color Settings +#################### +[color.grading] +exposure = 1.1 +gamma = 1.1 +pre_saturation = 1.0 +post_saturation = 1.0 + +[color.fog] +density = 0.0025 + +[color.bloom] +intensity = 0.1 + #################### # Display3d settings #################### @@ -205,4 +220,11 @@ pawn_red = "PawnRedPieceIdle" drone_blue = "DroneBluePieceIdle" drone_red = "DroneRedPieceIdle" queen_blue = "QueenBluePieceIdle" -queen_red = "QueenRedPieceIdle" \ No newline at end of file +queen_red = "QueenRedPieceIdle" + + +###################### +### Animation Settings +###################### +[animation] +fast_speed = 2.0 \ No newline at end of file diff --git a/assets/models/Martian Chess.glb b/assets/models/Martian Chess.glb index 668302c..ac1587f 100644 --- a/assets/models/Martian Chess.glb +++ b/assets/models/Martian Chess.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e3339671d576f8747d30e79ccdbf1d57acec55445804c88de37f273de743b270 -size 41604996 +oid sha256:076a9538c7312315acb0f52a6b0f8d4211673da420ef8a7d20155cbd08ebc1a1 +size 41602528 diff --git a/src/display3d.rs b/src/display3d.rs index 2dc5ce5..d11529f 100644 --- a/src/display3d.rs +++ b/src/display3d.rs @@ -1,5 +1,5 @@ use bevy::core_pipeline::{ - bloom::{BloomCompositeMode, BloomPrefilterSettings}, contrast_adaptive_sharpening::ContrastAdaptiveSharpeningSettings, experimental::taa::TemporalAntiAliasBundle, fxaa::{Fxaa, FxaaPlugin, Sensitivity} + contrast_adaptive_sharpening::ContrastAdaptiveSharpeningSettings, fxaa::Fxaa }; use crate::prelude::*; @@ -25,6 +25,21 @@ impl Plugin for Display3dPlugin { update_tweaks.run_if(resource_exists::), ), ) + // Systems related to color and camera + .add_systems( + Update, + ( + color_grading_tweak + .run_if(resource_exists::) + .run_if(on_event::>()), + fog_tweak + .run_if(resource_exists::) + .run_if(on_event::>()), + bloom_tweak + .run_if(resource_exists::) + .run_if(on_event::>()), + ) + ) .add_systems( Update, ( @@ -41,6 +56,7 @@ impl Plugin for Display3dPlugin { .run_if(state_changed::), update_pieces .run_if(resource_exists::) + .run_if(in_state(GameState::Play)) .run_if( any_component_changed::() .or_else(any_component_changed::()) @@ -66,7 +82,10 @@ impl Plugin for Display3dPlugin { capture_piece.run_if(any_with_component::), skip_animation .run_if(in_state(GameState::Play)) - .run_if(just_pressed(KeyCode::Enter).or_else(just_pressed(MouseButton::Left))), + .run_if(pressed(KeyCode::Enter).or_else(pressed(MouseButton::Left))), + un_skip_animation + .run_if(in_state(GameState::Play)) + .run_if(just_released(KeyCode::Enter).or_else(just_released(MouseButton::Left))), monitor_animations .run_if(in_state(GameState::Play)) .run_if(any_component_changed::()), @@ -91,23 +110,28 @@ impl Plugin for Display3dPlugin { ( // Toggle hidden/visible 3d entities manage_state_entities::(), - fixup_shadows, + // fixup_shadows, + color_grading_tweak + .run_if(resource_exists::), + fog_tweak + .run_if(resource_exists::), + bloom_tweak + .run_if(resource_exists::), + update_pieces.run_if(resource_exists::), ), ) .add_systems( OnEnter(GameState::Play), ( - update_pieces.run_if(resource_exists::), update_tweaks.run_if(resource_exists::), opening_animation .run_if(run_once()) .run_if(in_state(DisplayState::Display3d)), - fixup_shadows.after(update_pieces), ), ) .add_systems(OnEnter(GameState::Title), ( - intro_title_dissolve, fixup_shadows, + intro_title_dissolve, )) .add_systems(OnExit(GameState::Title), outro_title_dissolve) .add_systems( @@ -327,22 +351,16 @@ fn hydrate_camera( ..default() }, BloomSettings { - intensity: 0.05, - prefilter_settings: BloomPrefilterSettings { - threshold: 0.8, - threshold_softness: 0.5, - }, - composite_mode: BloomCompositeMode::Additive, + intensity: 0.0, ..default() }, FogSettings { color: Color::rgba(0.25, 0.25, 0.25, 1.0), falloff: FogFalloff::Exponential { - density: 0.025, + density: 0.0, }, ..default() }, - // ScreenSpaceAmbientOcclusionBundle { ..default() }, )); let assets_handle = tweak @@ -376,7 +394,7 @@ fn hydrate_camera( /// Update display3d tweaks in the game /// Triggered on entering 3d state and when the tweakfile is updated. fn update_tweaks( - mut camera_settings: Query<(Entity, &mut Skybox, &mut EnvironmentMapLight), With>, + mut camera_settings: Query<(&mut Skybox, &mut EnvironmentMapLight), With>, tweaks_file: Res, tweaks: Res>, ) { @@ -384,7 +402,7 @@ fn update_tweaks( warn!("Updating tweaks!"); camera_settings .iter_mut() - .for_each(|(entity, mut skybox, mut environment_map_light)| { + .for_each(|(mut skybox, mut environment_map_light)| { skybox.brightness = tweak.get::("display3d_skybox_brightness").unwrap(); environment_map_light.intensity = tweak .get::("display3d_environment_map_light_intensity") @@ -924,17 +942,27 @@ fn opening_animation(mut players: Query<&mut AnimationPlayer, (With, Wit // When called skips any running animations fn skip_animation( - mut players: Query<&mut AnimationPlayer>, - clips: Res>, - time: Res