Struct gl_utils::camera3d::Projection3d [−][src]
pub struct Projection3d {
pub viewport_width: u16,
pub viewport_height: u16,
pub inner: Projection3dInner,
}The 3D projection which can be either perspective or orthographic
Fields
viewport_width: u16
viewport_height: u16
inner: Projection3dInner
Methods
impl Projection3d[src]
impl Projection3dpub fn perspective(
viewport_width: u16,
viewport_height: u16,
fovy: Rad<f32>
) -> Self[src]
pub fn perspective(
viewport_width: u16,
viewport_height: u16,
fovy: Rad<f32>
) -> SelfCreate a new 3D perspective projection
Panics
Viewport width or height is zero:
// panics: let perspective = Projection3d::perspective (0, 240, cgmath::Deg (90.0).into());
If fovy is greater than or equal to $\pi$ radians:
// panics: let perspective = Projection3d::perspective (320, 240, cgmath::Rad (4.0));
If fovy is less than or equal to $0.0$ radians:
// panics: let perspective = Projection3d::perspective (320, 240, cgmath::Rad (0.0));
pub fn orthographic(
viewport_width: u16,
viewport_height: u16,
zoom: f32
) -> Self[src]
pub fn orthographic(
viewport_width: u16,
viewport_height: u16,
zoom: f32
) -> SelfCreate a new 3D orthographic projection
Panics
Viewport width or height is zero:
// panics: let perspective = Projection3d::perspective (0, 240, cgmath::Deg (90.0).into());
If zoom is less than or equal to $0.0$:
let ortho = Projection3d::orthographic (320, 240, 0.0); // panics
pub fn as_matrix(&self) -> &Matrix4<f32>[src]
pub fn as_matrix(&self) -> &Matrix4<f32>Returns a reference to the underlying projection matrix
pub fn is_orthographic(&self) -> bool[src]
pub fn is_orthographic(&self) -> boolpub fn is_perspective(&self) -> bool[src]
pub fn is_perspective(&self) -> boolpub fn to_orthographic(&mut self, zoom: f32)[src]
pub fn to_orthographic(&mut self, zoom: f32)Converts the inner projection type to an Orthographic projection with
the given zoom; if already an orthographic projection this will modify
the zoom
pub fn to_perspective(&mut self, fovy: Rad<f32>)[src]
pub fn to_perspective(&mut self, fovy: Rad<f32>)Converts the inner projection type to a Perspective projection with the
given vertical FOV; if already a perspective projection this will modify
the FOV
pub fn set_viewport_dimensions(
&mut self,
viewport_width: u16,
viewport_height: u16
)[src]
pub fn set_viewport_dimensions(
&mut self,
viewport_width: u16,
viewport_height: u16
)Sets the current viewport dimensions
Panics
Viewport width or height is zero:
let mut projection = Projection3d::perspective (320, 240, cgmath::Deg (90.0).into()); projection.set_viewport_dimensions (0, 240); // panics
pub fn scale_fovy_or_zoom(&mut self, scale: f32)[src]
pub fn scale_fovy_or_zoom(&mut self, scale: f32)Multiply the current perspective vertical FOV or orthographic zoom by the given scale factor.
Will not increase vertical FOV greater than $\pi$ radians, nor will it decrease the zoom or vertical FOV to zero.
Panics
Panics if scale factor is zero or negative:
let mut camera3d = Camera3d::new (320, 240); camera3d.projection3d.scale_fovy_or_zoom (-1.0); // panics
Auto Trait Implementations
impl Send for Projection3d
impl Send for Projection3dimpl Sync for Projection3d
impl Sync for Projection3d