mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Comment fixes and fmt
This commit is contained in:
parent
f1b166d15d
commit
2f47d09af4
@ -611,7 +611,11 @@ impl Hud {
|
||||
}
|
||||
// Crosshair
|
||||
let show_crosshair = (info.is_aiming || info.is_first_person) && !stats.is_dead;
|
||||
self.crosshair_opacity = Lerp::lerp(self.crosshair_opacity, if show_crosshair { 1.0 } else { 0.0 }, 5.0 * dt.as_secs_f32());
|
||||
self.crosshair_opacity = Lerp::lerp(
|
||||
self.crosshair_opacity,
|
||||
if show_crosshair { 1.0 } else { 0.0 },
|
||||
5.0 * dt.as_secs_f32(),
|
||||
);
|
||||
|
||||
if !self.show.help {
|
||||
Image::new(
|
||||
|
@ -185,10 +185,10 @@ impl Camera {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the distance of the camera from the target
|
||||
/// Get the distance of the camera from the focus
|
||||
pub fn get_distance(&self) -> f32 { self.dist }
|
||||
|
||||
/// Set the distance of the camera from the target (i.e., zoom).
|
||||
/// Set the distance of the camera from the focus (i.e., zoom).
|
||||
pub fn set_distance(&mut self, dist: f32) { self.tgt_dist = dist; }
|
||||
|
||||
pub fn update(&mut self, time: f64, dt: f32, smoothing_enabled: bool) {
|
||||
@ -206,11 +206,12 @@ impl Camera {
|
||||
let lerped_focus = Lerp::lerp(
|
||||
self.focus,
|
||||
self.tgt_focus,
|
||||
(delta as f32) / self.interp_time() * if matches!(self.mode, CameraMode::FirstPerson) {
|
||||
2.0
|
||||
} else {
|
||||
1.0
|
||||
},
|
||||
(delta as f32) / self.interp_time()
|
||||
* if matches!(self.mode, CameraMode::FirstPerson) {
|
||||
2.0
|
||||
} else {
|
||||
1.0
|
||||
},
|
||||
);
|
||||
|
||||
// Snap when close enough in x/y, but lerp otherwise
|
||||
@ -298,8 +299,8 @@ impl Camera {
|
||||
|
||||
/// Get the mode of the camera
|
||||
pub fn get_mode(&self) -> CameraMode {
|
||||
// Perfom a bit of a trick... don't report first-person until the camera has lerped close
|
||||
// enough to the player.
|
||||
// Perfom a bit of a trick... don't report first-person until the camera has
|
||||
// lerped close enough to the player.
|
||||
match self.mode {
|
||||
CameraMode::FirstPerson if self.dist < 0.5 => CameraMode::FirstPerson,
|
||||
CameraMode::FirstPerson => CameraMode::ThirdPerson,
|
||||
|
@ -239,9 +239,8 @@ impl Scene {
|
||||
CameraMode::ThirdPerson => 1.65,
|
||||
};
|
||||
|
||||
self.camera.set_focus_pos(
|
||||
player_pos + Vec3::unit_z() * (up - tilt.min(0.0).sin() * dist * 0.6),
|
||||
);
|
||||
self.camera
|
||||
.set_focus_pos(player_pos + Vec3::unit_z() * (up - tilt.min(0.0).sin() * dist * 0.6));
|
||||
|
||||
// Tick camera for interpolation.
|
||||
self.camera.update(
|
||||
|
@ -522,7 +522,10 @@ impl PlayState for SessionState {
|
||||
.unwrap_or(false);
|
||||
aimed
|
||||
},
|
||||
is_first_person: matches!(self.scene.camera().get_mode(), camera::CameraMode::FirstPerson),
|
||||
is_first_person: matches!(
|
||||
self.scene.camera().get_mode(),
|
||||
camera::CameraMode::FirstPerson
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user