Adjustable reticle iteration done

This commit is contained in:
Franklin 2023-11-29 13:59:18 -04:00
parent 9b2176185e
commit 5114114f9a
4 changed files with 5 additions and 6 deletions

View File

@ -40,6 +40,7 @@ Multiplayer
- [x] Find some way to implement a shader for the optics (AFTER IMPLEMENTING NEW BULLET SYSTEM) - [x] Find some way to implement a shader for the optics (AFTER IMPLEMENTING NEW BULLET SYSTEM)
- [x] Optic glass material - [x] Optic glass material
- [x] Reticle render - [x] Reticle render
- [x] Reticle adjustment while on the field
- [ ] Parallax effect on reticle - [ ] Parallax effect on reticle
- [ ] Weapon Clipping - [ ] Weapon Clipping
- [x] Make the player's collider bigger towards the front - [x] Make the player's collider bigger towards the front

View File

@ -20,7 +20,7 @@ impl Optic {
} }
} }
/// Goes from 1-300 /// Goes from 5-500
pub fn default_reticle_brightness(&self) -> f32 { pub fn default_reticle_brightness(&self) -> f32 {
200.0 200.0
} }

View File

@ -30,7 +30,7 @@ pub fn update_reticle(
for firearm_state in firearm_state.iter() { for firearm_state in firearm_state.iter() {
if let Some(ref optic_data) = firearm_state.optic_data { if let Some(ref optic_data) = firearm_state.optic_data {
if let Some(mat) = materials.get_mut(reticle_material) { if let Some(mat) = materials.get_mut(reticle_material) {
mat.emissive = optic_sight_glass.0.reticle().get_color() * optic_data.reticle_brightness.clamp(1.0, 500.0); mat.emissive = optic_sight_glass.0.reticle().get_color() * optic_data.reticle_brightness;
} }
} }
} }

View File

@ -50,6 +50,7 @@ pub struct CaptureHandUsageQueryParams<'w, 's> {
children: Query<'w, 's, &'static Children>, children: Query<'w, 's, &'static Children>,
} }
#[allow(unused)]
#[allow(irrefutable_let_patterns)] #[allow(irrefutable_let_patterns)]
pub fn capture_hand_usage( pub fn capture_hand_usage(
mut resources: CaptureHandUsageResourcesParams, mut resources: CaptureHandUsageResourcesParams,
@ -220,10 +221,7 @@ pub fn capture_hand_usage(
if let Some(ref mut optic_data) = firearm_state.optic_data { if let Some(ref mut optic_data) = firearm_state.optic_data {
for mouse_wheel_event in scroll_events.iter() { for mouse_wheel_event in scroll_events.iter() {
let add_to_brightness = mouse_wheel_event.y * resources.time.delta_seconds() * 200.0; let add_to_brightness = mouse_wheel_event.y * resources.time.delta_seconds() * 200.0;
println!("Changed reticle bright by {}", add_to_brightness); optic_data.reticle_brightness = (optic_data.reticle_brightness + add_to_brightness).clamp(5.0, 500.0); // TODO: Clamp values correctly (introduce variables in optic or firearmstate stating min. and max. values)
// TODO: Clamp values correctly
optic_data.reticle_brightness = (optic_data.reticle_brightness + add_to_brightness).clamp(1.0, 500.0);
//println!("Changed reticle bright by {}", add_to_brightness);
} }
} }
} }