Skip to main content

Frame

Struct Frame 

Source
pub struct Frame { /* private fields */ }
Expand description

Frame wrt camera eye and target.

Implementations§

Source§

impl Frame

Source

pub fn look_at(eye: Vec3, target: Vec3, up: Vec3) -> Self

Sets eye position inclusive its roll attitude and target position in world space.

Source

pub fn eye(&self) -> Vec3

Eye position in world space.

Source

pub fn set_eye(&mut self, eye: Vec3, up: Vec3)

Sets eye position inclusive its roll attitude in world space preserving target position.

Source

pub const fn target(&self) -> Vec3

Target position in world space.

Source

pub fn set_target(&mut self, pos: Vec3)

Sets target position in world space preserving eye position inclusive its roll attitude.

Allows to track a moving object.

Source

pub const fn distance(&self) -> f32

Distance between eye and target.

Source

pub const fn set_distance(&mut self, zat: f32)

Sets distance between eye and target preserving target position.

Source

pub fn scale(&mut self, rat: f32)

Scales distance between eye and target by ratio preserving target position.

Source

pub fn local_scale_around(&mut self, rat: f32, pos: Vec3)

Scales distance between eye and point in camera space by ratio preserving target position.

Source

pub fn scale_around(&mut self, rat: f32, pos: Vec3)

Scales distance between eye and point in world space by ratio preserving target position.

Source

pub fn local_slide(&mut self, vec: Vec3)

Slides camera eye and target by vector in camera space.

Source

pub fn slide(&mut self, vec: Vec3)

Slides camera eye and target by vector in world space.

Source

pub fn local_orbit(&mut self, rot: Quat)

Orbits eye by rotation in camera space around target.

Source

pub fn local_orbit_around(&mut self, rot: Quat, pos: Vec3)

Orbits eye by rotation in camera space around point in camera space.

Source

pub fn orbit(&mut self, rot: Quat)

Orbits eye by rotation in world space around target.

Source

pub fn orbit_around(&mut self, rot: Quat, pos: Vec3)

Orbits eye by rotation in world space around point in world space.

Source

pub fn look_around(&mut self, pitch: f32, yaw: f32, yaw_axis: Vec3)

Orbits target around eye by pitch and yaw preserving roll attitude aka first person view.

Use fixed Self::yaw_axis() by capturing it when entering first person view.

Source

pub const fn local_pitch_axis(&self) -> Vec3

Positive x-axis in camera space pointing from left to right.

Source

pub const fn local_yaw_axis(&self) -> Vec3

Positive y-axis in camera space pointing from bottom to top.

Source

pub const fn local_roll_axis(&self) -> Vec3

Positive z-axis in camera space pointing from back to front.

Source

pub fn pitch_axis(&self) -> Vec3

Positive x-axis in world space pointing from left to right.

Source

pub fn yaw_axis(&self) -> Vec3

Positive y-axis in world space pointing from bottom to top.

Source

pub fn roll_axis(&self) -> Vec3

Positive z-axis in world space pointing from back to front.

Source

pub fn lerp_slerp(&self, other: Self, t: f32) -> Self

Interpolates between two frames using linear interpolation for the translation part, and spherical linear interpolation along the shortest path for the rotation part.

§Arguments
  • self: The initial frame to interpolate from.
  • other: The final frame to interpolate toward.
  • t: The interpolation parameter between 0 and 1.
Source

pub fn renormalize(&mut self) -> f32

Renormalizes eye rotation and returns its norm.

Source

pub fn view(&self) -> Rigid

View transformation from camera to world space.

Source

pub fn inverse_view(&self) -> Rigid

Inverse view transformation from world to camera space.

Uses less computations than Self::view().inverse().

Source

pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool

Whether all components are approximately equal within absolute difference max_abs_diff.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Frame

Source§

fn default() -> Frame

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Frame

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Frame

Source§

fn eq(&self, other: &Frame) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Frame

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Frame

Source§

impl StructuralPartialEq for Frame

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,