pub struct OrbitalCamera {
pub target: Vec3,
pub azimuth: f32,
pub elevation: f32,
pub distance: f32,
pub dist_min: f32,
pub dist_max: f32,
pub elev_min: f32,
pub elev_max: f32,
/* private fields */
}Expand description
Orbital camera — rotates around a target point at a configurable distance.
Controls:
azimuth: horizontal rotation angle (radians)elevation: vertical angle (radians, clamped to avoid gimbal flip)distance: how far from the target
Fields§
§target: Vec3§azimuth: f32§elevation: f32§distance: f32§dist_min: f32Min/max distance clamp.
dist_max: f32§elev_min: f32Min/max elevation clamp.
elev_max: f32Implementations§
Source§impl OrbitalCamera
impl OrbitalCamera
pub fn new(target: Vec3, distance: f32) -> Self
Sourcepub fn set_target(&mut self, pos: Vec3)
pub fn set_target(&mut self, pos: Vec3)
Set a new target (spring-animated follow).
Sourcepub fn rotate(&mut self, delta_azimuth: f32, delta_elevation: f32)
pub fn rotate(&mut self, delta_azimuth: f32, delta_elevation: f32)
Rotate by delta angles (e.g. from mouse drag).
Sourcepub fn tick(&mut self, dt: f32) -> (Vec3, Vec3)
pub fn tick(&mut self, dt: f32) -> (Vec3, Vec3)
Tick by dt. Returns the camera eye position (for look_at).
Sourcepub fn view_matrix(&mut self, dt: f32) -> Mat4
pub fn view_matrix(&mut self, dt: f32) -> Mat4
Compute view matrix from orbital parameters.
Trait Implementations§
Source§impl Clone for OrbitalCamera
impl Clone for OrbitalCamera
Source§fn clone(&self) -> OrbitalCamera
fn clone(&self) -> OrbitalCamera
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OrbitalCamera
impl RefUnwindSafe for OrbitalCamera
impl Send for OrbitalCamera
impl Sync for OrbitalCamera
impl Unpin for OrbitalCamera
impl UnsafeUnpin for OrbitalCamera
impl UnwindSafe for OrbitalCamera
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
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.