pub struct ViewportRect {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}Expand description
Host-neutral viewport rectangle in physical or logical pixels.
Fields§
§x: f32§y: f32§width: f32§height: f32Implementations§
Source§impl ViewportRect
impl ViewportRect
pub fn new(x: f32, y: f32, width: f32, height: f32) -> Self
Sourcepub fn pixel_to_ndc(&self, pixel_pt: Vec2) -> Vec2
pub fn pixel_to_ndc(&self, pixel_pt: Vec2) -> Vec2
Converts a pixel coordinate within this viewport into Normalized Device Coordinates (NDC). NDC X: [-1.0, 1.0], Y: [-1.0, 1.0] (with Y-up).
Sourcepub fn ndc_to_pixel(&self, ndc_pt: Vec2) -> Vec2
pub fn ndc_to_pixel(&self, ndc_pt: Vec2) -> Vec2
Converts an NDC point back into viewport pixel coordinates.
Trait Implementations§
Source§impl Clone for ViewportRect
impl Clone for ViewportRect
impl Copy for ViewportRect
Source§impl Debug for ViewportRect
impl Debug for ViewportRect
Source§impl PartialEq for ViewportRect
impl PartialEq for ViewportRect
impl StructuralPartialEq for ViewportRect
Auto Trait Implementations§
impl Forget for ViewportRect
impl Freeze for ViewportRect
impl Move for ViewportRect
impl RefUnwindSafe for ViewportRect
impl Send for ViewportRect
impl Sync for ViewportRect
impl Unpin for ViewportRect
impl UnsafeUnpin for ViewportRect
impl UnwindSafe for ViewportRect
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