Skip to main content

FrameComposer

Struct FrameComposer 

Source
pub struct FrameComposer<'frame> { /* private fields */ }
Expand description

One bounded, stably ordered surface frame under construction.

Calling FrameComposer::present performs all fallible geometry and ownership validation before acquiring the surface. A successful frame uses one clear, one command encoder, one queue submission, and one present.

Implementations§

Source§

impl<'frame> FrameComposer<'frame>

Source

pub fn draw_scene( &mut self, scene: &'frame Scene, camera: Camera2d, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds a streaming world-space scene through its own camera.

Source

pub fn draw_screen_scene( &mut self, scene: &'frame ScreenScene, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds a streaming logical-screen scene unaffected by world cameras.

Source

pub fn draw_prepared_scene( &mut self, scene: &'frame PreparedScene, camera: Camera2d, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds immutable prepared world-space geometry through its own camera.

Source

pub fn draw_prepared_screen_scene( &mut self, scene: &'frame PreparedScreenScene, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds immutable prepared logical-screen geometry.

Source

pub fn draw_dynamic_mesh( &mut self, mesh: &'frame DynamicMesh2d, camera: Camera2d, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds retained dynamic triangles through their own world camera.

Camera-dependent topology is validated by FrameComposer::present, which rejects triangles crossing the full target clip volume or having an ambiguous projected orientation. Item viewport/scissor clipping is axis-aligned fragment clipping and remains supported.

Source

pub fn draw_particle_field( &mut self, field: &'frame mut ParticleField2d, camera: Camera2d, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds a budgeted instanced particle field through its own world camera.

Source

pub fn draw_scalar_field( &mut self, texture: &'frame ScalarFieldTexture, color_map: &'frame ColorMap, (minimum, maximum): (f32, f32), sampling: ScalarFieldSampling, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds a retained scalar heatmap scaled into the optional viewport.

Source

pub fn draw_image( &mut self, image: &'frame Image2d, source: Option<ImageTexelRect>, tint: Color, sampling: ImageSampling, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds one image or atlas region scaled into the optional viewport.

With no viewport the image covers the complete logical surface. tint is normalized straight linear RGBA and multiplies decoded image color.

Source

pub fn draw_world_image( &mut self, image: &'frame Image2d, source: Option<ImageTexelRect>, rectangle: Rect, depth: f32, camera: Camera2d, tint: Color, sampling: ImageSampling, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds one image or atlas region on an axis-aligned world-space rectangle.

The rectangle follows the supplied camera’s zoom, rotation, and pseudo-depth projection. Its UV top edge maps to the rectangle’s maximum world Y edge. The optional frame viewport selects the camera viewport and the item remains constrained by that viewport and clip.

Source

pub fn draw_image_batch( &mut self, image: &'frame Image2d, batch: &'frame ImageBatch2d, sampling: ImageSampling, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds a retained atlas batch as one instanced draw when non-empty. Empty batches are valid frame items and emit no draw call.

Source

pub fn draw_glyph_run( &mut self, atlas: &'frame GlyphAtlas2d, run: &'frame GlyphRun2d, sampling: ImageSampling, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds one host-shaped retained glyph run as one instanced draw when non-empty.

Positions are local logical pixels. Mixed font fallback is represented by multiple runs submitted at the same order; stable insertion order is preserved between them. An empty run is valid and emits no draw call.

Source

pub fn draw_render_target( &mut self, target: &'frame RenderTarget2d, blend_mode: BlendMode, opacity: f32, options: FramePassOptions, ) -> Result<(), FrameComposerError>

Adds an offscreen target, scaled into the optional logical viewport.

Source

pub const fn planned_statistics(&self) -> FrameStatistics

Returns conservative work accepted so far without presenting it.

Source

pub fn present(self) -> Result<FrameReport, FrameComposerError>

Validates, orders, encodes, submits, and presents the complete frame.

Auto Trait Implementations§

§

impl<'frame> !RefUnwindSafe for FrameComposer<'frame>

§

impl<'frame> !UnwindSafe for FrameComposer<'frame>

§

impl<'frame> Freeze for FrameComposer<'frame>

§

impl<'frame> Send for FrameComposer<'frame>

§

impl<'frame> Sync for FrameComposer<'frame>

§

impl<'frame> Unpin for FrameComposer<'frame>

§

impl<'frame> UnsafeUnpin for FrameComposer<'frame>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,