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
use crate::BlenderMesh;
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(test, derive(Default))]
pub struct Material {
diffuse_color: [f32; 3],
specular_color: [f32; 3],
specular_intensity: f32,
alpha: f32,
}
impl Material {
#[inline]
pub fn diffuse_color(&self) -> &[f32; 3] {
&self.diffuse_color
}
#[inline]
pub fn specular_color(&self) -> &[f32; 3] {
&self.specular_color
}
#[inline]
pub fn specular_intensity(&self) -> f32 {
self.specular_intensity
}
#[inline]
pub fn alpha(&self) -> f32 {
self.alpha
}
}
impl BlenderMesh {
pub fn materials(&self) -> &HashMap<String, Material> {
&self.materials
}
}