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
56
57
use crate::{parsers::parse_color, Color};
use serde::Deserialize;
#[derive(Deserialize, Debug, PartialEq, Clone)]
pub struct WangSet {
#[serde(rename(deserialize = "cornercolors"))]
pub corner_colors: Vec<WangColor>,
#[serde(rename(deserialize = "edgecolors"))]
pub edge_colors: Vec<WangColor>,
pub name: String,
pub tile: u32,
#[serde(rename(deserialize = "wangtiles"))]
pub wang_tiles: Vec<WangTile>,
}
#[derive(Deserialize, Debug, PartialEq, Clone)]
pub struct WangColor {
#[serde(deserialize_with = "parse_color")]
pub color: Color,
pub name: String,
pub probability: f32,
pub tile: u32,
}
#[derive(Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct WangTile {
#[serde(rename(deserialize = "dflip"))]
pub d_flip: bool,
#[serde(rename(deserialize = "hflip"))]
pub h_flip: bool,
#[serde(rename(deserialize = "vflip"))]
pub v_flip: bool,
#[serde(rename(deserialize = "tileid"))]
pub tile_id: u32,
#[serde(rename(deserialize = "wangid"))]
pub wang_id: Vec<u8>,
}