mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-05 02:18:28 +00:00
Prepare for making camera tuning configurable
This commit is contained in:
parent
49edd1097d
commit
803c456d05
@ -4,8 +4,8 @@ use tracing::warn;
|
|||||||
use crate::{
|
use crate::{
|
||||||
camera::{Camera, FocusPoint},
|
camera::{Camera, FocusPoint},
|
||||||
graphics::{DrawConfig, Renderer},
|
graphics::{DrawConfig, Renderer},
|
||||||
InputEvent, MouseButton, NormalizedScreenPosition, RendererInitError,
|
CameraTuningConfig, InputEvent, MouseButton, NormalizedScreenPosition,
|
||||||
Screen, ScreenSize, DEFAULT_CAMERA_TUNING_CONFIG,
|
RendererInitError, Screen, ScreenSize, DEFAULT_CAMERA_TUNING_CONFIG,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The Fornjot model viewer
|
/// The Fornjot model viewer
|
||||||
@ -13,6 +13,7 @@ pub struct Viewer {
|
|||||||
current_screen_size: ScreenSize,
|
current_screen_size: ScreenSize,
|
||||||
new_screen_size: Option<ScreenSize>,
|
new_screen_size: Option<ScreenSize>,
|
||||||
most_recent_mouse_button: Option<MouseButton>,
|
most_recent_mouse_button: Option<MouseButton>,
|
||||||
|
camera_tuning_config: CameraTuningConfig,
|
||||||
camera: Camera,
|
camera: Camera,
|
||||||
cursor: Option<NormalizedScreenPosition>,
|
cursor: Option<NormalizedScreenPosition>,
|
||||||
draw_config: DrawConfig,
|
draw_config: DrawConfig,
|
||||||
@ -30,6 +31,7 @@ impl Viewer {
|
|||||||
current_screen_size: screen.size(),
|
current_screen_size: screen.size(),
|
||||||
new_screen_size: None,
|
new_screen_size: None,
|
||||||
most_recent_mouse_button: None,
|
most_recent_mouse_button: None,
|
||||||
|
camera_tuning_config: DEFAULT_CAMERA_TUNING_CONFIG,
|
||||||
camera: Camera::default(),
|
camera: Camera::default(),
|
||||||
cursor: None,
|
cursor: None,
|
||||||
draw_config: DrawConfig::default(),
|
draw_config: DrawConfig::default(),
|
||||||
@ -102,9 +104,9 @@ impl Viewer {
|
|||||||
let diff_x = cursor_new.x - cursor_old.x;
|
let diff_x = cursor_new.x - cursor_old.x;
|
||||||
let diff_y = cursor_new.y - cursor_old.y;
|
let diff_y = cursor_new.y - cursor_old.y;
|
||||||
let angle_x = -diff_y
|
let angle_x = -diff_y
|
||||||
* DEFAULT_CAMERA_TUNING_CONFIG.rotation_sensitivity;
|
* self.camera_tuning_config.rotation_sensitivity;
|
||||||
let angle_y = diff_x
|
let angle_y =
|
||||||
* DEFAULT_CAMERA_TUNING_CONFIG.rotation_sensitivity;
|
diff_x * self.camera_tuning_config.rotation_sensitivity;
|
||||||
|
|
||||||
Some(InputEvent::Rotation { angle_x, angle_y })
|
Some(InputEvent::Rotation { angle_x, angle_y })
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user