pub struct PyCamera {
pub position: [f64; 3],
pub target: [f64; 3],
pub up: [f64; 3],
pub fov_deg: f64,
pub near: f64,
pub far: f64,
pub aspect: f64,
}Expand description
3D camera with orbit, pan, zoom controls.
Fields§
§position: [f64; 3]Camera position in world space.
target: [f64; 3]Look-at target point.
up: [f64; 3]Up vector (usually [0, 1, 0]).
fov_deg: f64Vertical field of view in degrees.
near: f64Near clipping plane distance.
far: f64Far clipping plane distance.
aspect: f64Viewport aspect ratio (width / height).
Implementations§
Source§impl PyCamera
impl PyCamera
Sourcepub fn default_perspective() -> Self
pub fn default_perspective() -> Self
Default camera looking down the negative Z axis.
Sourcepub fn orbit(&mut self, delta_yaw: f64, delta_pitch: f64)
pub fn orbit(&mut self, delta_yaw: f64, delta_pitch: f64)
Orbit the camera around the target by delta_yaw and delta_pitch (radians).
Sourcepub fn zoom(&mut self, factor: f64)
pub fn zoom(&mut self, factor: f64)
Zoom by moving the camera closer to (factor < 1) or farther from (factor > 1) the target.
Sourcepub fn look_at(&mut self, target: [f64; 3])
pub fn look_at(&mut self, target: [f64; 3])
Point the camera directly at a given world position.
Sourcepub fn view_direction(&self) -> [f64; 3]
pub fn view_direction(&self) -> [f64; 3]
Compute the view direction (normalized).
Sourcepub fn distance_to_target(&self) -> f64
pub fn distance_to_target(&self) -> f64
Distance from camera to target.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PyCamera
impl<'de> Deserialize<'de> for PyCamera
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PyCamera
impl RefUnwindSafe for PyCamera
impl Send for PyCamera
impl Sync for PyCamera
impl Unpin for PyCamera
impl UnsafeUnpin for PyCamera
impl UnwindSafe for PyCamera
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.