pub struct EditorCamera {Show 23 fields
pub focal_point: Vec3,
pub azimuth: f32,
pub elevation: f32,
pub distance: f32,
pub target_focal: Vec3,
pub target_az: f32,
pub target_el: f32,
pub target_dist: f32,
pub position: Vec3,
pub yaw: f32,
pub pitch: f32,
pub projection: Projection,
pub aspect: f32,
pub mode: CameraMode,
pub spring_k: f32,
pub spring_damp: f32,
pub orbit_speed: f32,
pub pan_speed: f32,
pub zoom_speed: f32,
pub fly_speed: f32,
pub trauma: f32,
pub trauma_decay: f32,
pub snap_align: bool,
/* private fields */
}Expand description
The main editor camera.
Fields§
§focal_point: Vec3§azimuth: f32§elevation: f32§distance: f32§target_focal: Vec3§target_az: f32§target_el: f32§target_dist: f32§position: Vec3§yaw: f32§pitch: f32§projection: Projection§aspect: f32§mode: CameraMode§spring_k: f32§spring_damp: f32§orbit_speed: f32§pan_speed: f32§zoom_speed: f32§fly_speed: f32§trauma: f32Trauma ∈ [0, 1]: shake magnitude. Decays over time.
trauma_decay: f32§snap_align: boolImplementations§
Source§impl EditorCamera
impl EditorCamera
pub fn new() -> Self
Sourcepub fn orbit_position(&self) -> Vec3
pub fn orbit_position(&self) -> Vec3
Current camera position in orbit mode.
Sourcepub fn view_matrix(&self) -> Mat4
pub fn view_matrix(&self) -> Mat4
Current view matrix (world → camera).
pub fn add_trauma(&mut self, amount: f32)
Sourcepub fn update(&mut self, dt: f32, fly_input: Option<&FreeFlyInput>) -> Mat4
pub fn update(&mut self, dt: f32, fly_input: Option<&FreeFlyInput>) -> Mat4
Advance camera by dt seconds. Returns the updated view matrix.
pub fn orbit_drag(&mut self, delta: Vec2)
pub fn pan_drag(&mut self, delta: Vec2)
pub fn scroll_zoom(&mut self, delta: f32)
pub fn dolly(&mut self, amount: f32)
pub fn frame_selection(&mut self, center: Vec3, radius: f32)
pub fn snap_to(&mut self, view: SnapView)
pub fn enter_free_fly(&mut self)
pub fn exit_free_fly(&mut self)
pub fn forward_vector(&self) -> Vec3
pub fn right_vector(&self) -> Vec3
pub fn up_vector(&self) -> Vec3
Sourcepub fn screen_to_ray(&self, ndc: Vec2) -> (Vec3, Vec3)
pub fn screen_to_ray(&self, ndc: Vec2) -> (Vec3, Vec3)
Compute a world-space ray from a normalised screen point (x, y) ∈ [-1,1].
pub fn status_line(&self) -> String
Trait Implementations§
Source§impl Clone for EditorCamera
impl Clone for EditorCamera
Source§impl Debug for EditorCamera
impl Debug for EditorCamera
Auto Trait Implementations§
impl Freeze for EditorCamera
impl RefUnwindSafe for EditorCamera
impl Send for EditorCamera
impl Sync for EditorCamera
impl Unpin for EditorCamera
impl UnsafeUnpin for EditorCamera
impl UnwindSafe for EditorCamera
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.