[][src]Struct nannou::frame::Frame

pub struct Frame { /* fields omitted */ }

A Frame to which the user can draw graphics before it is presented to the display.

Frames are delivered to the user for drawing via the user's view function.

See the RawFrame docs for more details on how the implementation works under the hood. The Frame type differs in that rather than drawing directly to the swapchain image the user may draw to an intermediary linear sRGBA image. There are several advantages of drawing to an intermediary image.

Methods

impl Frame[src]

pub const DEFAULT_MSAA_SAMPLES: u32[src]

The default number of multisample anti-aliasing samples used if the window with which the Frame is associated supports it.

pub fn image(&self) -> &Arc<AttachmentImage>[src]

The image to which all user graphics should be drawn this frame.

This is not the swapchain image, but rather an intermediary linear sRGBA image. This intermediary image is used in order to ensure consistent MSAA resolve behaviour across platforms, and to avoid the need for multiple implicit conversions to and from linear sRGBA for each graphics pipeline render pass that is used.

The exact format of the image is equal to Frame::image_format, which is equal to nannou::frame::COLOR_FORMAT.

If the number of MSAA samples specified is greater than 1 (which it is by default if supported by the platform), this will be a multisampled image. After the view function returns, this image will be resolved to a non-multisampled linear sRGBA image. After the image has been resolved if necessary, it will then be used as a shader input within a graphics pipeline used to draw the swapchain image.

pub fn image_is_new(&self) -> bool[src]

If the Frame's image is new because it is the first frame or because it was recently recreated to match the dimensions of the window's swapchain, this will return true.

This is useful for determining whether or not a user's framebuffer might need reconstruction in the case that it targets the frame's image.

pub fn image_format(&self) -> Format[src]

The color format of the Frame's intermediary linear sRGBA image (equal to COLOR_FORMAT).

pub fn image_msaa_samples(&self) -> u32[src]

The number of MSAA samples of the Frame's intermediary linear sRGBA image.

pub fn clear<C>(&self, color: C) where
    C: IntoLinSrgba<f32>, 
[src]

Clear the image with the given color.

Methods from Deref<Target = RawFrame>

pub fn swapchain_image_is_new(&self) -> bool[src]

Returns whether or not this is the first time this swapchain image has been presented.

This will be true following each occurrence at which the swapchain has been recreated, which may occur during resize, loop mode switch, etc.

It is important to call this each frame to determine whether or not framebuffers associated with the swapchain need to be recreated.

pub fn add_commands(&self) -> AddCommands[src]

Add commands to be executed by the GPU once the RawFrame is returned.

pub fn window_id(&self) -> Id[src]

The Id of the window whose vulkan surface is associated with this frame.

pub fn nth(&self) -> u64[src]

The nth frame for the associated window since the application started.

E.g. the first frame yielded will return 0, the second will return 1, and so on.

pub fn swapchain_image(&self) -> &Arc<SwapchainImage>[src]

The swapchain image that will be the target for this frame.

NOTE: You should avoid using the returned SwapchainImage outside of the view function as it may become invalid at any moment. The reason we expose the Arc is that some of the vulkano API (including framebuffer creation) requires it to avoid some severe ownsership issues.

pub fn swapchain_image_index(&self) -> usize[src]

The index associated with the swapchain image that will be the target for this frame.

pub fn queue(&self) -> &Arc<Queue>[src]

The queue on which the swapchain image will be drawn.

Trait Implementations

impl Deref for Frame[src]

type Target = RawFrame

The resulting type after dereferencing.

Auto Trait Implementations

impl !Send for Frame

impl Unpin for Frame

impl !Sync for Frame

impl !UnwindSafe for Frame

impl !RefUnwindSafe for Frame

Blanket Implementations

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

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

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.

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

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

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

impl<T> Content for T[src]

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

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T> SetParameter for T

impl<T> SetParameter for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,