[−][src]Enum web_glitz::pipeline::graphics::Viewport
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:
-
With explicit values:
use web_glitz::pipeline::graphics::Viewport; let viewport = Viewport::Region((X_vp, Y_vp), width, height);
Where
X_vp,Y_vp,widthandheightcorrespond to the values used in the description above. -
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 thewidthandheightis 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
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
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnwindSafe for Viewport
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> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static, [src]
D: Borrow<T> + 'static,
T: Copy + 'static,
fn into_buffer<Rc>(Self, &Rc, BufferId, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static, [src]
Rc: RenderingContext + Clone + 'static,
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>,