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
58
59
60
61
62
63
64
65
66
67
68
69
// These are the json types that the Shadertoy API outputs
// This is manually derived

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct Shader {
    pub ver: String,
    pub info: ShaderInfo,
    pub renderpass: Vec<RenderPass>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct ShaderInfo {
    pub id: String,
    pub date: String,
    pub viewed: u64,
    pub name: String,
    pub username: String,
    pub description: String,
    pub likes: u64,
    pub published: u64,
    pub flags: u64,
    pub tags: Vec<String>,
    pub hasliked: u64,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct RenderPass {
    pub inputs: Vec<RenderPassInput>,
    pub outputs: Vec<RenderPassOutput>,
    pub code: String,
    pub name: String,
    pub description: String,

    #[serde(rename = "type")]
    pub pass_type: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct RenderPassInput {
    pub id: u64,
    pub src: String,
    pub ctype: String,
    pub channel: u64,
    pub sampler: Sampler,
    pub published: u64,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct RenderPassOutput {
    pub id: u64,
    pub channel: u64,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct Sampler {
    pub filter: String,
    pub wrap: String,
    pub vflip: String,
    pub srgb: String,
    //pub vflip: bool,
    //pub srgb: bool,
    pub internal: String,
}