use crate::utils::GltfData;
use cgmath::*;
use image::RgbImage;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct Emissive {
pub texture: Option<Arc<RgbImage>>,
pub factor: Vector3<f32>,
}
impl Emissive {
pub(crate) fn load(gltf_mat: &gltf::Material, data: &mut GltfData) -> Self {
Self {
texture: gltf_mat
.emissive_texture()
.map(|texture| data.load_rgb_image(&texture.texture())),
factor: gltf_mat.emissive_factor().into(),
}
}
}
impl Default for Emissive {
fn default() -> Self {
Self {
texture: None,
factor: Vector3::zero(),
}
}
}