veloren_common/figure/
mat_cell.rs

1use super::cell::Cell;
2use crate::vol::FilledVox;
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq)]
5pub enum Material {
6    Skin,
7    SkinDark,
8    SkinLight,
9    Hair,
10    EyeDark,
11    EyeLight,
12    EyeWhite,
13    /*HairLight,
14     *HairDark,
15     *Clothing, */
16}
17
18#[derive(Copy, Clone, Debug, PartialEq, Eq)]
19pub enum MatCell {
20    Mat(Material),
21    Normal(Cell),
22}
23
24impl FilledVox for MatCell {
25    fn default_non_filled() -> Self { MatCell::Normal(Cell::empty()) }
26
27    fn is_filled(&self) -> bool {
28        match self {
29            Self::Mat(_) => true,
30            Self::Normal(c) => c.is_filled(),
31        }
32    }
33}
34
35#[cfg(test)]
36mod test {
37    use super::*;
38
39    #[test]
40    fn met_cell_size() {
41        assert_eq!(5, std::mem::size_of::<MatCell>());
42        assert_eq!(1, std::mem::align_of::<MatCell>());
43    }
44}