pub struct Camera {Show 15 fields
pub fov: f32,
pub near: f32,
pub far: f32,
pub primary: bool,
pub orthographic: bool,
pub ortho_size: f32,
pub focal_length: f32,
pub dof: bool,
pub aperture: f32,
pub focus_distance: f32,
pub autofocus: bool,
pub focus_speed: f32,
pub exposure_comp: f32,
pub letterbox: f32,
pub effects: Vec<PostEffect>,
}Expand description
Perspective or orthographic scene camera. The first primary camera is selected for gameplay.
Fields§
§fov: f32Vertical perspective field of view in degrees. Ignored for orthographic cameras.
near: f32Near clipping distance in metres; must be positive for perspective projection.
far: f32Far clipping distance in metres; must exceed near.
primary: boolThe first primary camera is used to render the game.
orthographic: boolOrthographic projection (2D games). ortho_size is the visible height in world units.
ortho_size: f32Full vertical orthographic view height in metres.
focal_length: f32Lens focal length in millimetres on a 24 mm tall sensor; above 0 it replaces fov
(24 mm is a wide shot, 50 mm natural, 135 mm a telephoto).
dof: boolDepth of field: blur what is not at the focus distance.
aperture: f32Aperture as an f-number: 1.4 gives strong blur, 8 a deep focus, 22 almost none.
focus_distance: f32Distance in metres that is in focus (set live by autofocus).
autofocus: boolFocus on whatever is in the middle of the screen (needs colliders to hit).
focus_speed: f32How fast autofocus racks to a new target.
exposure_comp: f32Exposure compensation in stops (+1 doubles the light).
letterbox: f32Cinematic bars: target picture ratio such as 2.39 or 1.85 (0 = full screen).
effects: Vec<PostEffect>Camera shaders of this camera only, applied after the scene’s own effects while it is the active camera (security cam static, a character’s blurred view…).
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Camera
impl<'de> Deserialize<'de> for Camera
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreimpl<T> MaybeSync for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.