model-converter/src/model/material.rs

37 lines
906 B
Rust

//! This module contains everything related to materials.
use std::collections::HashMap;
/// A 3D material.
#[derive(Clone)]
pub struct Material {
/// The name of the material.
pub name: String,
/// Map linking each texture map to its file path.
pub textures: HashMap<String, String>,
/// Instructions that are unknown.
///
/// They might be necessary for the export though.
pub unknown_instructions: Vec<String>,
}
impl Material {
/// Creates a material from its name, without texture.
pub fn new(name: &str) -> Material {
Material {
name: name.to_owned(),
textures: HashMap::new(),
unknown_instructions: vec![],
}
}
/// Adds a unknown instruction into the material.
pub fn add_unknown_instruction(&mut self, instruction: String) {
self.unknown_instructions.push(instruction);
}
}