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

pub struct Image {
    pub bytes: Vec<u8>,
    pub width: u32,
    pub height: u32
}

pub struct CPUMaterial {
    pub name: String,
    pub color: Option<(f32, f32, f32, f32)>,
    pub texture_image: Option<Image>,
    pub diffuse_intensity: Option<f32>,
    pub specular_intensity: Option<f32>,
    pub specular_power: Option<f32>
}

impl Default for CPUMaterial {
    fn default() -> Self {
        Self {
            name: "default".to_string(),
            color: Some((1.0, 1.0, 1.0, 1.0)),
            texture_image: None,
            diffuse_intensity: Some(0.5),
            specular_intensity: Some(0.2),
            specular_power: Some(6.0)
        }
     }
}