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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
use gltf_derive::Validate;
use serde_derive::{Serialize, Deserialize};
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
use crate::{Extras, texture, validation::Validate, material::StrengthFactor};
#[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
pub struct Material {
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
#[serde(default, rename = "KHR_materials_pbrSpecularGlossiness", skip_serializing_if = "Option::is_none")]
pub pbr_specular_glossiness: Option<PbrSpecularGlossiness>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
pub struct PbrMetallicRoughness {}
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
#[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
#[serde(default, rename_all = "camelCase")]
pub struct PbrSpecularGlossiness {
pub diffuse_factor: PbrDiffuseFactor,
#[serde(skip_serializing_if = "Option::is_none")]
pub diffuse_texture: Option<texture::Info>,
pub specular_factor: PbrSpecularFactor,
pub glossiness_factor: StrengthFactor,
#[serde(skip_serializing_if = "Option::is_none")]
pub specular_glossiness_texture: Option<texture::Info>,
#[cfg_attr(feature = "extras", serde(skip_serializing_if = "Option::is_none"))]
pub extras: Extras,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
pub struct NormalTexture {}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
pub struct OcclusionTexture {}
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct PbrDiffuseFactor(pub [f32; 4]);
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
impl Default for PbrDiffuseFactor {
fn default() -> Self {
PbrDiffuseFactor([1.0, 1.0, 1.0, 1.0])
}
}
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
impl Validate for PbrDiffuseFactor {}
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct PbrSpecularFactor(pub [f32; 3]);
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
impl Default for PbrSpecularFactor {
fn default() -> Self {
PbrSpecularFactor([1.0, 1.0, 1.0])
}
}
#[cfg(feature = "KHR_materials_pbrSpecularGlossiness")]
impl Validate for PbrSpecularFactor {}