Dont reload textures if some already exist
This commit is contained in:
parent
92e1f1d0ec
commit
4a4ae65cc1
|
@ -545,9 +545,11 @@ impl Model {
|
||||||
/// Builds the SrgbTextures for rendering.
|
/// Builds the SrgbTextures for rendering.
|
||||||
pub fn build_texture_for_material(&mut self, material: &Material, renderer: &Renderer) {
|
pub fn build_texture_for_material(&mut self, material: &Material, renderer: &Renderer) {
|
||||||
if let Some((path, _)) = material.textures.get("map_Kd") {
|
if let Some((path, _)) = material.textures.get("map_Kd") {
|
||||||
let texture = renderer.make_texture(path);
|
if ! self.textures.contains_key(path) {
|
||||||
// Don't need to insert multiple times the same texture
|
let texture = renderer.make_texture(path);
|
||||||
self.textures.entry(path.to_owned()).or_insert(Rc::new(texture));
|
// Don't need to insert multiple times the same texture
|
||||||
|
self.textures.entry(path.to_owned()).or_insert(Rc::new(texture));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue