Skip to main content

render_view

Function render_view 

Source
pub fn render_view<'a>(
    meshes: impl IntoIterator<Item = &'a Mesh>,
    w: u32,
    h: u32,
    vp: &M4,
    to_eye: V3,
    default_color: V3,
) -> RgbaImage
Expand description

Draws meshes as the viewer shows them: a w x h picture through the camera matrix vp (projection times view, clip depth 0..1), lit from to_eye (unit, towards the camera), meshes without a colour in default_color, on a transparent background. The viewer’s snapshot. render_view_lines adds the viewer’s lines.

The square rasterizer draws a square of the longer side with the picture’s window scaled into its middle, which is then cut out.