pub struct Camera {
pub transform: Transform,
pub fov: f32,
pub width: f32,
pub height: f32,
pub near: f32,
pub far: f32,
pub view: [[f32; 4]; 4],
pub projection: [[f32; 4]; 4],
}
Fields§
§transform: Transform
§fov: f32
§width: f32
§height: f32
§near: f32
§far: f32
§view: [[f32; 4]; 4]
§projection: [[f32; 4]; 4]
Implementations§
Source§impl Camera
impl Camera
pub fn new( position: Option<[f32; 3]>, rotation: Option<[f32; 3]>, fov: Option<f32>, aspect: Option<f32>, near: Option<f32>, far: Option<f32>, ) -> Self
pub fn default() -> Self
pub fn from_serializer(serializer: CameraSerializer) -> Self
pub fn to_serializer(&self) -> CameraSerializer
pub fn update_matrices(&mut self)
pub fn calculate_direction_vector(&self) -> [f32; 3]
pub fn get_view_matrix(&self) -> [[f32; 4]; 4]
pub fn get_projection_matrix(&self) -> [[f32; 4]; 4]
pub fn get_position(&self) -> [f32; 3]
pub fn get_rotation(&self) -> [f32; 3]
pub fn get_fov(&self) -> f32
pub fn get_aspect(&self) -> (f32, f32)
pub fn get_near(&self) -> f32
pub fn get_far(&self) -> f32
pub fn get_view(&self) -> [[f32; 4]; 4]
pub fn get_projection(&self) -> [[f32; 4]; 4]
pub fn set_position(&mut self, position: [f32; 3])
pub fn set_rotation(&mut self, rotation: [f32; 3])
pub fn set_fov(&mut self, fov: f32)
pub fn set_aspect(&mut self, width: f32, heigth: f32)
pub fn set_near(&mut self, near: f32)
pub fn set_far(&mut self, far: f32)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnwindSafe for Camera
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> Content for Twhere
T: Copy,
impl<T> Content for Twhere
T: Copy,
Source§unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
Prepares an output buffer, then turns this buffer into an
Owned
.
User-provided closure F
must only write to and not read from &mut Self
.Source§fn get_elements_size() -> usize
fn get_elements_size() -> usize
Returns the size of each element.
Source§fn to_void_ptr(&self) -> *const ()
fn to_void_ptr(&self) -> *const ()
Produces a pointer to the data.
Source§fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
Builds a pointer to this type from a raw pointer.
Source§fn is_size_suitable(size: usize) -> bool
fn is_size_suitable(size: usize) -> bool
Returns true if the size is suitable to store a type like this.
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
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.