Function push_composite_quad

Source
pub fn push_composite_quad(
    arena: &mut Vec<TexVertex>,
    surface: [f32; 2],
    dest: Rect,
    tint: [f32; 4],
) -> Range<u32>
Expand description

NDC quad for compositing an offscreen texture into destination rect.

Appends six vertices (two triangles) with UVs covering [0, 1] and returns their half-open u32 range. dest and surface are physical pixels.

§Panics

Debug builds panic if the arena length cannot fit in u32 during range arithmetic; such an arena is already too large for wgpu draw indices.

§Examples

use ailloli_ui_core::Rect;
use ailloli_ui_render_wgpu::cmd_bounds::push_composite_quad;
let mut vertices = Vec::new();
let range = push_composite_quad(&mut vertices, [100.0, 50.0],
    Rect::new(0.0, 0.0, 10.0, 10.0), [1.0; 4]);
assert_eq!(range, 0..6);
assert_eq!(vertices.len(), 6);