Render

Trait Render 

Source
pub trait Render<V: Vary> {
    type Clip;
    type Clips: Clip<Item = Self::Clip> + ?Sized;
    type Screen;

    // Required methods
    fn inline(ixd: Self, vs: &[ClipVert<V>]) -> Self::Clip;
    fn to_screen(clip: Self::Clip, tf: &Mat4x4<NdcToScreen>) -> Self::Screen;
    fn rasterize<F: FnMut(Scanline<V>)>(scr: Self::Screen, scanline_fn: F);

    // Provided methods
    fn depth(_clip: &Self::Clip) -> f32 { ... }
    fn is_backface(_: &Self::Screen) -> bool { ... }
}
Expand description

Renderable geometric primitive.

Required Associated Types§

Source

type Clip

The type of this primitive in clip space

Source

type Clips: Clip<Item = Self::Clip> + ?Sized

The type for which Clip is implemented.

Source

type Screen

The type of this primitive in screen space.

Required Methods§

Source

fn inline(ixd: Self, vs: &[ClipVert<V>]) -> Self::Clip

Maps the indexes of the argument to vertices.

Source

fn to_screen(clip: Self::Clip, tf: &Mat4x4<NdcToScreen>) -> Self::Screen

Transforms the argument from NDC to screen space.

Source

fn rasterize<F: FnMut(Scanline<V>)>(scr: Self::Screen, scanline_fn: F)

Rasterizes the argument by calling the function for each scanline.

Provided Methods§

Source

fn depth(_clip: &Self::Clip) -> f32

Returns the (average) depth of the argument.

Source

fn is_backface(_: &Self::Screen) -> bool

Returns whether the argument is facing away from the camera.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§