1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use draw_state::state::*;
use DrawState;

static INSIDE_DRAW_STATE: &'static DrawState =
    &DrawState {
        primitive: Primitive {
            front_face: FrontFace::CounterClockwise,
            method: RasterMethod::Fill(
                CullFace::Nothing
            ),
            offset: None,
        },
        multi_sample: None,
        scissor: None,
        stencil: Some(Stencil {
                front: StencilSide {
                    fun: Comparison::Equal,
                    value: 1,
                    mask_read: 255,
                    mask_write: 0,
                    op_fail: StencilOp::Keep,
                    op_depth_fail: StencilOp::Keep,
                    op_pass: StencilOp::Keep,
                },
                back: StencilSide {
                    fun: Comparison::Equal,
                    value: 1,
                    mask_read: 255,
                    mask_write: 0,
                    op_fail: StencilOp::Keep,
                    op_depth_fail: StencilOp::Keep,
                    op_pass: StencilOp::Keep,
                },
            }),
        depth: None,
        blend: Some(Blend {
                color: BlendChannel {
                    equation: Equation::Add,
                    source: Factor::ZeroPlus(BlendValue::SourceAlpha),
                    destination: Factor::OneMinus(BlendValue::SourceAlpha),
                },
                alpha: BlendChannel {
                    equation: Equation::Add,
                    source: Factor::One,
                    destination: Factor::One,
                },
                value: [0.0, 0.0, 0.0, 0.0],
            }),
        color_mask: MASK_ALL,
    };

/// Returns a default draw state that does additive blending and no culling.
pub fn inside_draw_state() -> &'static DrawState {
    INSIDE_DRAW_STATE
}