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
use amethyst_core::specs::prelude::{Component, DenseVecStorage};
use tex::TextureHandle;
#[derive(Debug, Clone, PartialEq)]
pub struct TextureOffset {
pub u: (f32, f32),
pub v: (f32, f32),
}
impl Default for TextureOffset {
fn default() -> Self {
TextureOffset {
u: (0., 1.),
v: (0., 1.),
}
}
}
#[derive(Clone, PartialEq)]
pub struct Material {
pub albedo: TextureHandle,
pub albedo_offset: TextureOffset,
pub emission: TextureHandle,
pub emission_offset: TextureOffset,
pub normal: TextureHandle,
pub normal_offset: TextureOffset,
pub metallic: TextureHandle,
pub metallic_offset: TextureOffset,
pub roughness: TextureHandle,
pub roughness_offset: TextureOffset,
pub ambient_occlusion: TextureHandle,
pub ambient_occlusion_offset: TextureOffset,
pub caveat: TextureHandle,
pub caveat_offset: TextureOffset,
}
impl Component for Material {
type Storage = DenseVecStorage<Self>;
}
#[derive(Clone)]
pub struct MaterialDefaults(pub Material);