summaryrefslogtreecommitdiff
path: root/engine/src/draw_flags.rs
blob: df5eed1cf26b83a65909f773cde19f1c3d556610 (plain)
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
use ecs::Component;

use crate::util::builder;

builder! {
/// Flags for how a object should be drawn.
#[builder(name = Builder, derives = (Debug, Default, Clone))]
#[derive(Debug, Default, Clone, Component)]
#[non_exhaustive]
pub struct DrawFlags
{
    pub polygon_mode_config: PolygonModeConfig,
}
}

impl DrawFlags
{
    #[must_use]
    pub fn builder() -> Builder
    {
        Builder::default()
    }
}

#[derive(Debug, Default, Clone)]
pub struct PolygonModeConfig
{
    pub face: PolygonModeFace,
    pub mode: PolygonMode,
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum PolygonMode
{
    Point,
    Line,

    #[default]
    Fill,
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum PolygonModeFace
{
    Front,
    Back,

    #[default]
    FrontAndBack,
}

/// Component that makes a object not be drawn.
#[derive(Debug, Clone, Copy, Component)]
pub struct NoDraw;