[−][src]Struct all_is_cubes::camera::ProjectionHelper
Tool for setting up and using a projection matrix. Stores viewport dimensions and aspect ratio, and derives a projection matrix.
Also stores an externally-provided view matrix (world space to camera space). If not needed, can be ignored.
Fields
cursor_ndc_position: Vector2<FreeCoordinate>
Position of mouse pointer or other input device in normalized device coordinates (range -1 to 1 upward and rightward). If there is no such input device, zero will be the center of the screen.
Implementations
impl ProjectionHelper
[src]
pub fn new(pixel_aspect_ratio: FreeCoordinate, viewport: Vector2<usize>) -> Self
[src]
pixel_aspect_ratio is the width divided by the height
pub fn viewport(&self) -> Vector2<usize>
[src]
pub fn set_viewport(&mut self, viewport: Vector2<usize>)
[src]
pub fn set_cursor_position(&mut self, position: Point2<usize>)
[src]
Set the current cursor position. In the same pixel units as set_viewport
.
pub fn set_view_matrix(&mut self, view: Matrix4<FreeCoordinate>)
[src]
pub fn normalize_pixel_x(&self, x: usize) -> FreeCoordinate
[src]
As per OpenGL normalized device coordinates, output ranges from -1 to 1.
pub fn normalize_pixel_y(&self, y: usize) -> FreeCoordinate
[src]
As per OpenGL normalized device coordinates, output ranges from -1 to 1.
pub fn projection(&self) -> Matrix4<FreeCoordinate>
[src]
Returns a projection matrix suitable for OpenGL use.
pub fn project_ndc_into_world(
&self,
ndc_x: FreeCoordinate,
ndc_y: FreeCoordinate
) -> Ray
[src]
&self,
ndc_x: FreeCoordinate,
ndc_y: FreeCoordinate
) -> Ray
Convert a screen position in normalized device coordinates (as produced by
normalize_pixel_x
& normalize_pixel_y
) into a ray in world space.
Uses the view transformation given by set_view_matrix
.
pub fn project_cursor_into_world(&self) -> Ray
[src]
Convert the cursor position into a ray in world space.
Uses the view transformation given by set_view_matrix
.
Trait Implementations
impl Clone for ProjectionHelper
[src]
fn clone(&self) -> ProjectionHelper
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for ProjectionHelper
[src]
impl Debug for ProjectionHelper
[src]
Auto Trait Implementations
impl RefUnwindSafe for ProjectionHelper
impl Send for ProjectionHelper
impl Sync for ProjectionHelper
impl Unpin for ProjectionHelper
impl UnwindSafe for ProjectionHelper
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,