pub struct CameraExtrinsics {
pub position: Vec3,
pub look_dir: Vec3,
pub up_dir: Vec3,
}Expand description
Camera extrinsics parameters (position and orientation).
Fields§
§position: Vec3Camera position in world space.
look_dir: Vec3Look direction (normalized).
up_dir: Vec3Up direction (normalized).
Implementations§
Source§impl CameraExtrinsics
impl CameraExtrinsics
Sourcepub fn new(position: Vec3, look_dir: Vec3, up_dir: Vec3) -> Self
pub fn new(position: Vec3, look_dir: Vec3, up_dir: Vec3) -> Self
Creates new camera extrinsics from position and directions.
Sourcepub fn default_extrinsics() -> Self
pub fn default_extrinsics() -> Self
Creates extrinsics with camera at origin looking down -Z.
Sourcepub fn look_at(position: Vec3, target: Vec3, up: Vec3) -> Self
pub fn look_at(position: Vec3, target: Vec3, up: Vec3) -> Self
Creates extrinsics for a camera looking at a target point.
Sourcepub fn camera_frame(&self) -> (Vec3, Vec3, Vec3)
pub fn camera_frame(&self) -> (Vec3, Vec3, Vec3)
Gets the camera frame as (look, up, right).
Sourcepub fn view_matrix(&self) -> Mat4
pub fn view_matrix(&self) -> Mat4
Returns the view matrix (world to camera space).
Trait Implementations§
Source§impl Clone for CameraExtrinsics
impl Clone for CameraExtrinsics
Source§fn clone(&self) -> CameraExtrinsics
fn clone(&self) -> CameraExtrinsics
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 moreSource§impl Debug for CameraExtrinsics
impl Debug for CameraExtrinsics
Source§impl Default for CameraExtrinsics
impl Default for CameraExtrinsics
impl Copy for CameraExtrinsics
Auto Trait Implementations§
impl Freeze for CameraExtrinsics
impl RefUnwindSafe for CameraExtrinsics
impl Send for CameraExtrinsics
impl Sync for CameraExtrinsics
impl Unpin for CameraExtrinsics
impl UnsafeUnpin for CameraExtrinsics
impl UnwindSafe for CameraExtrinsics
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> 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>
Converts
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>
Converts
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> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().