[][src]Enum web_glitz::pipeline::graphics::Viewport

pub enum Viewport {
    Region((i32, i32)u32u32),
    Auto,
}

Describes the viewport used by by a [GraphicsPipeline].

The viewport defines the affine transformation of X and Y from normalized device coordinates to window coordinates.

Given a viewport with origin (X_vp, Y_vp), width width and height height; let X_nd and Y_nd be normalized device coordinates, then the corresponding window coordinates X_w and Y_w are computed as:

X_w = (X_nd + 1) * 0.5 * width + X_vp

Y_w = (X_nd + 1) * 0.5 * height + Y_vp

There are two ways to define a Viewport:

  1. With explicit values:

    use web_glitz::pipeline::graphics::Viewport;
    
    let viewport = Viewport::Region((X_vp, Y_vp), width, height);

    Where X_vp, Y_vp, width and height correspond to the values used in the description above.

  2. With automatic values:

    use web_glitz::pipeline::graphics::Viewport;
    
    let viewport = Viewport::Auto;

    In this case, the origin will always be (0, 0); determination of the width and height is deferred until draw time, where they taken to be the width and height of the [RenderTarget] that is being drawn to, such that the viewport will cover the [RenderTarget] exactly. Note that the width and height of the [RenderTarget] are determined by the attached images with the smallest width and height respectively.

Variants

Region((i32, i32)u32u32)
Auto

Trait Implementations

impl Clone for Viewport[src]

impl Debug for Viewport[src]

impl PartialEq<Viewport> for Viewport[src]

impl StructuralPartialEq for Viewport[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<D, T> IntoBuffer<T> for D where
    D: Borrow<T> + 'static,
    T: Copy + 'static, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.