#[derive(Debug, Clone, Copy)]
pub struct Material {
pub base_color: [f32; 3],
pub ambient: f32,
pub diffuse: f32,
pub specular: f32,
pub shininess: f32,
pub metallic: f32,
pub roughness: f32,
pub opacity: f32,
pub texture_id: Option<u64>,
pub normal_map_id: Option<u64>,
pub ao_map_id: Option<u64>,
pub use_pbr: bool,
}
impl Default for Material {
fn default() -> Self {
Self {
base_color: [0.7, 0.7, 0.7],
ambient: 0.15,
diffuse: 0.75,
specular: 0.4,
shininess: 32.0,
metallic: 0.0,
roughness: 0.5,
opacity: 1.0,
texture_id: None,
normal_map_id: None,
ao_map_id: None,
use_pbr: false,
}
}
}
impl Material {
pub fn from_color(color: [f32; 3]) -> Self {
Self {
base_color: color,
..Default::default()
}
}
}