pub struct Frame { /* private fields */ }Expand description
Frame wrt camera eye and target.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn look_at(eye: Vec3, target: Vec3, up: Vec3) -> Frame
pub fn look_at(eye: Vec3, target: Vec3, up: Vec3) -> Frame
Sets eye position inclusive its roll attitude and target position in world space.
Sourcepub fn set_eye(&mut self, eye: Vec3, up: Vec3)
pub fn set_eye(&mut self, eye: Vec3, up: Vec3)
Sets eye position inclusive its roll attitude in world space preserving target position.
Sourcepub fn set_target(&mut self, pos: Vec3)
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.
Sourcepub const fn set_distance(&mut self, zat: f32)
pub const fn set_distance(&mut self, zat: f32)
Sets distance between eye and target preserving target position.
Sourcepub fn scale(&mut self, rat: f32)
pub fn scale(&mut self, rat: f32)
Scales distance between eye and target by ratio preserving target position.
Sourcepub fn local_scale_around(&mut self, rat: f32, pos: Vec3)
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.
Sourcepub fn scale_around(&mut self, rat: f32, pos: Vec3)
pub fn scale_around(&mut self, rat: f32, pos: Vec3)
Scales distance between eye and point in world space by ratio preserving target position.
Sourcepub fn local_slide(&mut self, vec: Vec3)
pub fn local_slide(&mut self, vec: Vec3)
Slides camera eye and target by vector in camera space.
Sourcepub fn local_orbit(&mut self, rot: Quat)
pub fn local_orbit(&mut self, rot: Quat)
Orbits eye by rotation in camera space around target.
Sourcepub fn local_orbit_around(&mut self, rot: Quat, pos: Vec3)
pub fn local_orbit_around(&mut self, rot: Quat, pos: Vec3)
Orbits eye by rotation in camera space around point in camera space.
Sourcepub fn orbit_around(&mut self, rot: Quat, pos: Vec3)
pub fn orbit_around(&mut self, rot: Quat, pos: Vec3)
Orbits eye by rotation in world space around point in world space.
Sourcepub fn look_around(&mut self, pitch: f32, yaw: f32, yaw_axis: Vec3)
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.
Sourcepub const fn local_pitch_axis(&self) -> Vec3
pub const fn local_pitch_axis(&self) -> Vec3
Positive x-axis in camera space pointing from left to right.
Sourcepub const fn local_yaw_axis(&self) -> Vec3
pub const fn local_yaw_axis(&self) -> Vec3
Positive y-axis in camera space pointing from bottom to top.
Sourcepub const fn local_roll_axis(&self) -> Vec3
pub const fn local_roll_axis(&self) -> Vec3
Positive z-axis in camera space pointing from back to front.
Sourcepub fn pitch_axis(&self) -> Vec3
pub fn pitch_axis(&self) -> Vec3
Positive x-axis in world space pointing from left to right.
Sourcepub fn lerp_slerp(&self, other: Frame, t: f32) -> Frame
pub fn lerp_slerp(&self, other: Frame, t: f32) -> Frame
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.
Sourcepub fn renormalize(&mut self) -> f32
pub fn renormalize(&mut self) -> f32
Renormalizes eye rotation and returns its norm.
Sourcepub fn inverse_view(&self) -> Rigid
pub fn inverse_view(&self) -> Rigid
Inverse view transformation from world to camera space.
Uses less computations than Self::view().inverse().
Sourcepub fn abs_diff_eq(&self, other: Frame, max_abs_diff: f32) -> bool
pub fn abs_diff_eq(&self, other: Frame, max_abs_diff: f32) -> bool
Whether all components are approximately equal within absolute difference max_abs_diff.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Frame
impl<'de> Deserialize<'de> for Frame
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Frame, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Frame, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Frame
impl Serialize for Frame
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,
impl Copy for Frame
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, 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>, which can then be
downcast into Box<dyn 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>, which 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> 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromTemplate for T
impl<T> FromTemplate for T
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§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<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
self.