pub struct Camera {
pub name: Cow<'static, str>,
pub aa_mode: AntiAliasingMode,
/* private fields */
}Fields§
§name: Cow<'static, str>§aa_mode: AntiAliasingModePer-camera anti-aliasing mode carrying its own payload.
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn projection_type(&self) -> ProjectionType
pub fn projection_type(&self) -> ProjectionType
Returns the projection type (perspective or orthographic).
Sourcepub fn ortho_size(&self) -> f32
pub fn ortho_size(&self) -> f32
Returns the orthographic size (half-height).
Sourcepub fn set_projection_type(&mut self, projection_type: ProjectionType)
pub fn set_projection_type(&mut self, projection_type: ProjectionType)
Sets the projection type and updates the projection matrix.
Sourcepub fn set_fov(&mut self, fov: f32)
pub fn set_fov(&mut self, fov: f32)
Sets the field of view in radians and updates the projection matrix.
Sourcepub fn set_fov_degrees(&mut self, fov_degrees: f32)
pub fn set_fov_degrees(&mut self, fov_degrees: f32)
Sets the field of view in degrees and updates the projection matrix.
Sourcepub fn set_aspect(&mut self, aspect: f32)
pub fn set_aspect(&mut self, aspect: f32)
Sets the aspect ratio and updates the projection matrix.
Sourcepub fn set_near(&mut self, near: f32)
pub fn set_near(&mut self, near: f32)
Sets the near clipping plane and updates the projection matrix.
Sourcepub fn set_far(&mut self, far: f32)
pub fn set_far(&mut self, far: f32)
Sets the far clipping plane and updates the projection matrix.
Sourcepub fn set_ortho_size(&mut self, ortho_size: f32)
pub fn set_ortho_size(&mut self, ortho_size: f32)
Sets the orthographic size and updates the projection matrix.
pub fn new_perspective(fov_degrees: f32, aspect: f32, near: f32) -> Camera
pub fn new_orthographic( ortho_size: f32, aspect: f32, near: f32, far: f32, ) -> Camera
Sourcepub fn set_viewport_size(&mut self, width: f32, height: f32)
pub fn set_viewport_size(&mut self, width: f32, height: f32)
Sets the viewport dimensions. TAA needs the true pixel resolution to convert Halton offsets into precise NDC-space sub-pixel jitter.
Sourcepub fn is_taa_enabled(&self) -> bool
pub fn is_taa_enabled(&self) -> bool
Returns true when the current AA mode is TAA.
Sourcepub fn msaa_samples(&self) -> u32
pub fn msaa_samples(&self) -> u32
Returns the MSAA sample count implied by the current AA mode.
Sourcepub fn set_aa_mode(&mut self, mode: AntiAliasingMode)
pub fn set_aa_mode(&mut self, mode: AntiAliasingMode)
Replaces the current anti-aliasing mode.
When switching away from TAA the jitter is cleared and the projection matrix reverts to the clean (unjittered) version.
Sourcepub fn step_frame(&mut self)
pub fn step_frame(&mut self)
Advances the TAA frame counter. Must be called once per frame before rendering so the Halton jitter sequence progresses.
pub fn update_projection_matrix(&mut self)
pub fn update_view_projection(&mut self, world_transform: &Affine3A)
pub fn extract_render_camera(&self) -> RenderCamera
Sourcepub fn fit_to_bbox(&mut self, bbox: &BoundingBox)
pub fn fit_to_bbox(&mut self, bbox: &BoundingBox)
Fits the camera to view a bounding box.
Adjusts the near plane and camera position so the bounding box is fully visible at a comfortable distance.
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 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,
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.