Struct draw_state::DrawState [−] [src]

pub struct DrawState {
    pub primitive: Primitive,
    pub multi_sample: Option<MultiSample>,
    pub scissor: Option<Rect>,
    pub stencil: Option<Stencil>,
    pub depth: Option<Depth>,
    pub blend: Option<Blend>,
    pub color_mask: ColorMask,
}

An assembly of states that affect regular draw calls

Fields

primitive

How to rasterize geometric primitives.

multi_sample

Multi-sampling mode

scissor

Scissor mask to use. If set, no pixel outside of this rectangle (in screen space) will be written to as a result of rendering.

stencil

Stencil test to use. If None, no stencil testing is done.

depth

Depth test to use. If None, no depth testing is done.

blend

Blend function to use. If None, no blending is done.

color_mask

Color mask to use. Each flag indicates that the given color channel can be written to, and they can be OR'd together.

Methods

impl DrawState

fn new() -> DrawState

Create a default DrawState. Uses counter-clockwise winding, culls the backface of each primitive, and does no scissor/stencil/depth/blend/color masking.

fn get_target_mask(&self) -> Mask

Return a target mask that contains all the planes required by this state.

fn multi_sample(self) -> DrawState

Enable multi-sampled rasterization

fn stencil(self, fun: Comparison, value: Stencil) -> DrawState

Set the stencil test to a simple expression

fn depth(self, fun: Comparison, write: bool) -> DrawState

Set the depth test with the mask

fn scissor(self, x: u16, y: u16, w: u16, h: u16) -> DrawState

Set the scissor

fn blend(self, preset: BlendPreset) -> DrawState

Set the blend mode to one of the presets

Trait Implementations

Derived Implementations

impl Debug for DrawState

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl PartialEq for DrawState

fn eq(&self, __arg_0: &DrawState) -> bool

fn ne(&self, __arg_0: &DrawState) -> bool

impl Clone for DrawState

fn clone(&self) -> DrawState

fn clone_from(&mut self, source: &Self)

impl Copy for DrawState