Struct Viewport

Source
pub struct Viewport<'a, T> {
    pub x: f32,
    pub y: f32,
    pub mvp: Option<&'a [f32; 16]>,
    pub output: T,
    pub size: Size<u32>,
}
Expand description

The rendering output of a filter chain.

Viewport coordinates are relative to the coordinate system of the target runtime. For correct results, x and y should almost always be 0, and size should be the same as the size of the output texture.

Size uniforms will always be passed the full size of the output texture, regardless of the user-specified viewport size.

Fields§

§x: f32

The x offset to start rendering from. For correct results, this should almost always be 0 to indicate the origin.

§y: f32

The y offset to begin rendering from.

§mvp: Option<&'a [f32; 16]>

An optional pointer to an MVP to use when rendering to the viewport.

§output: T

The output handle to render the final image to.

§size: Size<u32>

The extent of the viewport size starting from the origin defined by x and y.

Implementations§

Source§

impl<'a, T: GetSize<u32>> Viewport<'a, T>

Source

pub fn new_render_target_sized_origin( output: T, mvp: Option<&'a [f32; 16]>, ) -> Result<Viewport<'a, T>, T::Error>

Create a new viewport from an output that can be sized.

This will create a viewport that spans the entire output texture, which will give correct results in the general case.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Viewport<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for Viewport<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Viewport<'a, T>
where T: Send,

§

impl<'a, T> Sync for Viewport<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Viewport<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for Viewport<'a, T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.