[][src]Trait euc::Pipeline

pub trait Pipeline where
    Self: Sized
{ type Vertex; type VsOut: Clone + Interpolate; type Pixel: Clone; fn vert(&self, vertex: &Self::Vertex) -> ([f32; 3], Self::VsOut);
fn frag(&self, vs_out: &Self::VsOut) -> Self::Pixel; fn get_depth_strategy(&self) -> DepthStrategy { ... }
fn draw<R: Rasterizer, T: Target<Item = Self::Pixel>>(
        &self,
        vertices: &[Self::Vertex],
        target: &mut T,
        supplement: <R as Rasterizer>::Supplement
    ) { ... } }

Represents the high-level structure of a rendering pipeline.

Conventionally, uniform data is stores as state within the type itself.

This governs the following things:

  • Vertex position and data calculation (computed by the vertex shader)
  • Determining whether each polygon is 'backfacing', and optionally skipping it
  • Rasterization (performed internally by euc)
  • Comparing the fragment depth against the depth buffer to determine whether it is occluded, and optionally skipping it
  • Fragment output calculation (computed by the fragment shader)

In the future, euc may extend its capabilities to include compute, geometry, and tesselation shaders.

Associated Types

type Vertex

The type of the vertex shader input data.

This usually consists of the vertex's position, normal, colour, texture coordinates, and other such per-vertex information. When vertex indexing is used, this tends to consist of the vertex index.

type VsOut: Clone + Interpolate

The type of the data that gets passed on from the vertex shader to the fragment shader.

This usually consists of the fragment's normal, colour, texture coordinates and other such per-fragment information.

type Pixel: Clone

The type of emitted pixels.

This type is emitted by the fragment shader and usually corresponds to the colour of the pixel.

Loading content...

Required methods

fn vert(&self, vertex: &Self::Vertex) -> ([f32; 3], Self::VsOut)

The vertex shader

fn frag(&self, vs_out: &Self::VsOut) -> Self::Pixel

The fragment shader

Loading content...

Provided methods

fn get_depth_strategy(&self) -> DepthStrategy

A method used to determine what depth buffer strategy should be used when determining fragment occlusion.

This method will be called at minimum only once per draw call, but may be called an arbitrary number of times.

fn draw<R: Rasterizer, T: Target<Item = Self::Pixel>>(
    &self,
    vertices: &[Self::Vertex],
    target: &mut T,
    supplement: <R as Rasterizer>::Supplement
)

Perform a draw call with the given uniform data, vertex array, output target and supplement type.

The supplement type is commonly used to represent additional surfaces required by the rasterizer, such as a depth buffer target.

Loading content...

Implementors

Loading content...