Avoid redefining textures
This commit is contained in:
parent
0b6d39541f
commit
598365f913
|
@ -420,7 +420,8 @@ impl Model {
|
|||
pub fn build_texture_for_material(&mut self, material: &Material, renderer: &Renderer) {
|
||||
if let Some(path) = material.textures.get("map_Kd") {
|
||||
let texture = renderer.make_texture(path);
|
||||
self.textures.insert(path.to_owned(), Some(texture));
|
||||
// Don't need to insert multiple times the same texture
|
||||
self.textures.entry(path.to_owned()).or_insert(Some(texture));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue