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 {crate::layout::Plain, wgpu::PrimitiveTopology};

pub struct TopologyValue(PrimitiveTopology);

impl TopologyValue {
    pub(crate) fn into_inner(self) -> PrimitiveTopology {
        let Self(value) = self;
        value
    }
}

pub trait Topology {
    type Face: Clone + Plain;
    const VALUE: TopologyValue;
}

#[derive(Clone, Copy)]
pub struct PointList;

impl Topology for PointList {
    type Face = u16;
    const VALUE: TopologyValue = TopologyValue(PrimitiveTopology::PointList);
}

#[derive(Clone, Copy)]
pub struct LineList;

impl Topology for LineList {
    type Face = [u16; 2];
    const VALUE: TopologyValue = TopologyValue(PrimitiveTopology::LineList);
}

#[derive(Clone, Copy)]
pub struct LineStrip;

impl Topology for LineStrip {
    type Face = u16;
    const VALUE: TopologyValue = TopologyValue(PrimitiveTopology::LineStrip);
}

#[derive(Clone, Copy)]
pub struct TriangleList;

impl Topology for TriangleList {
    type Face = [u16; 3];
    const VALUE: TopologyValue = TopologyValue(PrimitiveTopology::TriangleList);
}

#[derive(Clone, Copy)]
pub struct TriangleStrip;

impl Topology for TriangleStrip {
    type Face = u16;
    const VALUE: TopologyValue = TopologyValue(PrimitiveTopology::TriangleStrip);
}