pub struct Frame<N>{ /* private fields */ }
Expand description
Frame wrt camera eye and target.
Implementations§
Source§impl<N> Frame<N>
impl<N> Frame<N>
Sourcepub fn look_at(
target: OPoint<N, Const<3>>,
eye: &OPoint<N, Const<3>>,
up: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>,
) -> Frame<N>
pub fn look_at( target: OPoint<N, Const<3>>, eye: &OPoint<N, Const<3>>, up: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>, ) -> Frame<N>
Sets eye position inclusive its roll attitude and target position in world space.
Sourcepub fn set_eye(
&mut self,
eye: &OPoint<N, Const<3>>,
up: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>,
)
pub fn set_eye( &mut self, eye: &OPoint<N, Const<3>>, up: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>, )
Sets eye position inclusive its roll attitude in world space preserving target position.
Sourcepub fn set_target(&mut self, pos: OPoint<N, Const<3>>)
pub fn set_target(&mut self, pos: OPoint<N, Const<3>>)
Sets target position in world space preserving eye position inclusive its roll attitude.
Allows to track a moving object.
Sourcepub fn set_distance(&mut self, zat: N)
pub fn set_distance(&mut self, zat: N)
Sets distance between eye and target preserving target position.
Sourcepub fn scale(&mut self, rat: N)
pub fn scale(&mut self, rat: N)
Scales distance between eye and target by ratio preserving target position.
Sourcepub fn local_scale_around(&mut self, rat: N, pos: &OPoint<N, Const<3>>)
pub fn local_scale_around(&mut self, rat: N, pos: &OPoint<N, Const<3>>)
Scales distance between eye and point in camera space by ratio preserving target position.
Sourcepub fn scale_around(&mut self, rat: N, pos: &OPoint<N, Const<3>>)
pub fn scale_around(&mut self, rat: N, pos: &OPoint<N, Const<3>>)
Scales distance between eye and point in world space by ratio preserving target position.
Sourcepub fn local_slide(
&mut self,
vec: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>,
)
pub fn local_slide( &mut self, vec: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>, )
Slides camera eye and target by vector in camera space.
Sourcepub fn slide(
&mut self,
vec: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>,
)
pub fn slide( &mut self, vec: &Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>, )
Slides camera eye and target by vector in world space.
Sourcepub fn local_orbit(&mut self, rot: &Unit<Quaternion<N>>)
pub fn local_orbit(&mut self, rot: &Unit<Quaternion<N>>)
Orbits eye by rotation in camera space around target.
Sourcepub fn local_orbit_around(
&mut self,
rot: &Unit<Quaternion<N>>,
pos: &OPoint<N, Const<3>>,
)
pub fn local_orbit_around( &mut self, rot: &Unit<Quaternion<N>>, pos: &OPoint<N, Const<3>>, )
Orbits eye by rotation in camera space around point in camera space.
Sourcepub fn orbit(&mut self, rot: &Unit<Quaternion<N>>)
pub fn orbit(&mut self, rot: &Unit<Quaternion<N>>)
Orbits eye by rotation in world space around target.
Sourcepub fn orbit_around(
&mut self,
rot: &Unit<Quaternion<N>>,
pos: &OPoint<N, Const<3>>,
)
pub fn orbit_around( &mut self, rot: &Unit<Quaternion<N>>, pos: &OPoint<N, Const<3>>, )
Orbits eye by rotation in world space around point in world space.
Sourcepub fn look_around(
&mut self,
pitch: N,
yaw: N,
yaw_axis: &Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>,
)
pub fn look_around( &mut self, pitch: N, yaw: N, yaw_axis: &Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>, )
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.
Sourcepub fn local_pitch_axis(
&self,
) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
pub fn local_pitch_axis( &self, ) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
Positive x-axis in camera space pointing from left to right.
Sourcepub fn local_yaw_axis(
&self,
) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
pub fn local_yaw_axis( &self, ) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
Positive y-axis in camera space pointing from bottom to top.
Sourcepub fn local_roll_axis(
&self,
) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
pub fn local_roll_axis( &self, ) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
Positive z-axis in camera space pointing from back to front.
Sourcepub fn pitch_axis(
&self,
) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
pub fn pitch_axis( &self, ) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
Positive x-axis in world space pointing from left to right.
Sourcepub fn yaw_axis(
&self,
) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
pub fn yaw_axis( &self, ) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
Positive y-axis in world space pointing from bottom to top.
Sourcepub fn roll_axis(
&self,
) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
pub fn roll_axis( &self, ) -> Unit<Matrix<N, Const<3>, Const<1>, ArrayStorage<N, 3, 1>>>
Positive z-axis in world space pointing from back to front.
Sourcepub fn try_lerp_slerp(
&self,
other: &Frame<N>,
t: N,
epsilon: N,
) -> Option<Frame<N>>
pub fn try_lerp_slerp( &self, other: &Frame<N>, t: N, epsilon: N, ) -> Option<Frame<N>>
Attempts to interpolate between two frames using linear interpolation for the translation part, and spherical linear interpolation for the rotation part.
Returns None
if the angle between both rotations is 180 degrees (in which case the
interpolation is not well-defined).
§Arguments
self
: The initial frame to interpolate from.other
: The final frame to interpolate toward.t
: The interpolation parameter between 0 and 1.epsilon
: The value below which the sinus of the angle separating both quaternion must be to returnNone
.
Sourcepub fn renormalize(&mut self) -> N
pub fn renormalize(&mut self) -> N
Renormalizes eye rotation and returns its norm.
Sourcepub fn view(&self) -> Isometry<N, Unit<Quaternion<N>>, 3>
pub fn view(&self) -> Isometry<N, Unit<Quaternion<N>>, 3>
View transformation from camera to world space.
Sourcepub fn inverse_view(&self) -> Isometry<N, Unit<Quaternion<N>>, 3>
pub fn inverse_view(&self) -> Isometry<N, Unit<Quaternion<N>>, 3>
Inverse view transformation from world to camera space.
Uses less computations than Self::view()
.inverse()
.
Trait Implementations§
Source§impl<N> AbsDiffEq for Frame<N>
impl<N> AbsDiffEq for Frame<N>
Source§fn default_epsilon() -> <N as AbsDiffEq>::Epsilon
fn default_epsilon() -> <N as AbsDiffEq>::Epsilon
Source§fn abs_diff_eq(
&self,
other: &Frame<N>,
epsilon: <N as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_eq( &self, other: &Frame<N>, epsilon: <N as AbsDiffEq>::Epsilon, ) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
.Source§impl<'de, N> Deserialize<'de> for Frame<N>
impl<'de, N> Deserialize<'de> for Frame<N>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Frame<N>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Frame<N>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<N> RelativeEq for Frame<N>
impl<N> RelativeEq for Frame<N>
Source§fn default_max_relative() -> <N as AbsDiffEq>::Epsilon
fn default_max_relative() -> <N as AbsDiffEq>::Epsilon
Source§fn relative_eq(
&self,
other: &Frame<N>,
epsilon: <N as AbsDiffEq>::Epsilon,
max_relative: <N as AbsDiffEq>::Epsilon,
) -> bool
fn relative_eq( &self, other: &Frame<N>, epsilon: <N as AbsDiffEq>::Epsilon, max_relative: <N as AbsDiffEq>::Epsilon, ) -> bool
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
RelativeEq::relative_eq
.Source§impl<N> Serialize for Frame<N>
impl<N> Serialize for Frame<N>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<N> UlpsEq for Frame<N>
impl<N> UlpsEq for Frame<N>
Source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
impl<N> Copy for Frame<N>
impl<N> Eq for Frame<N>
impl<N> StructuralPartialEq for Frame<N>
Auto Trait Implementations§
impl<N> Freeze for Frame<N>where
N: Freeze,
impl<N> RefUnwindSafe for Frame<N>where
N: RefUnwindSafe,
impl<N> Send for Frame<N>
impl<N> Sync for Frame<N>
impl<N> Unpin for Frame<N>where
N: Unpin,
impl<N> UnwindSafe for Frame<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.