feat: switch to gltf crate and remove easy_gltf
This is because easy_gltf did not expose texture information, which the gltf crate did.
This commit is contained in:
1 parent
2d8b895841
commit
639875b603
6 files changed
+78
-68
No files matched your search
@@ -0,0 +1,36 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct MaterialRegistry {
|
||||
materials: HashMap<String, Material>
|
||||
}
|
||||
|
||||
impl MaterialRegistry {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
materials: HashMap::new()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register(&mut self, id: String, material: Material) {
|
||||
self.materials.insert(id, material);
|
||||
}
|
||||
|
||||
pub fn get(&self, id: &String) -> Option<&Material> {
|
||||
self.materials.get(id)
|
||||
}
|
||||
}
|
||||
|
||||
/// Encapsulates all the information that makes up a PBR (physically based rendering) material.
|
||||
/// These materials should be stored in a [`MaterialRegistry`], with a unique key.
|
||||
pub struct Material {
|
||||
/// The base color of the material.
|
||||
pub base_color: [f32; 4],
|
||||
/// The metallic value of the material. This should be a number between 0 and 1.
|
||||
pub metallic: f32,
|
||||
/// The roughness value of the material. This should be a number between 0 and 1.
|
||||
pub roughness: f32,
|
||||
/// The path of the normal map for this material, if any.
|
||||
pub normal_map: Option<String>,
|
||||
/// The path of the base color's texture, if any.
|
||||
pub base_color_texture: Option<String>,
|
||||
}
|
||||
Reference in new issue
Block a user