Struct rustracer::camera::OrthogonalCamera
source · pub struct OrthogonalCamera {
aspect_ratio: f32,
tranformation: Transformation,
}
Expand description
A camera implementing an orthogonal 3D -> 2D projection.
This class implements an observer seeing the world through an orthogonal projection.
Fields§
§aspect_ratio: f32
Aspect Ratio.
tranformation: Transformation
Transformation
to apply to Ray
.
Implementations§
source§impl OrthogonalCamera
impl OrthogonalCamera
sourcepub fn new(aspect_ratio: f32, tranformation: Transformation) -> Self
pub fn new(aspect_ratio: f32, tranformation: Transformation) -> Self
Create a new orthographic camera.
The parameter aspect_ratio
defines how larger than the height is the image.
For full screen images, you should probably set aspect_ratio
to 16/9
,
as this is the most used aspect ratio used in modern monitors.
The transformation
parameter is an instance of the Transformation
.
Trait Implementations§
source§impl Clone for OrthogonalCamera
impl Clone for OrthogonalCamera
source§fn clone(&self) -> OrthogonalCamera
fn clone(&self) -> OrthogonalCamera
Returns a copy 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 OrthogonalCamera
impl Debug for OrthogonalCamera
source§impl Default for OrthogonalCamera
impl Default for OrthogonalCamera
source§fn default() -> OrthogonalCamera
fn default() -> OrthogonalCamera
Returns the “default value” for a type. Read more
source§impl FireRay for OrthogonalCamera
impl FireRay for OrthogonalCamera
source§fn fire_ray(&self, u: f32, v: f32) -> Ray
fn fire_ray(&self, u: f32, v: f32) -> Ray
Shoot a Ray
through the camera’s screen.
The coordinates (u, v)
specify the point on the screen where the ray crosses it.
Coordinates:
(0, 0)
represent the bottom-left corner(0, 1)
the top-left corner(1, 0)
the bottom-right corner(1, 1)
the top-right corner
(0, 1) (1, 1)
+------------------------------+
| |
| |
| |
+------------------------------+
(0, 0) (1, 0)
source§impl PartialEq for OrthogonalCamera
impl PartialEq for OrthogonalCamera
source§fn eq(&self, other: &OrthogonalCamera) -> bool
fn eq(&self, other: &OrthogonalCamera) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for OrthogonalCamera
impl StructuralPartialEq for OrthogonalCamera
Auto Trait Implementations§
impl RefUnwindSafe for OrthogonalCamera
impl Send for OrthogonalCamera
impl Sync for OrthogonalCamera
impl Unpin for OrthogonalCamera
impl UnwindSafe for OrthogonalCamera
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