From fffb401638ac08e395785eadb1ab0ae1d17613aa Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 14 Apr 2024 23:19:56 +0200 Subject: feat(engine): create texture IDs automatically --- engine/src/renderer/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engine/src/renderer') diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs index 304c38b..ef653a2 100644 --- a/engine/src/renderer/mod.rs +++ b/engine/src/renderer/mod.rs @@ -40,7 +40,7 @@ use crate::opengl::vertex_array::{PrimitiveKind, VertexArray}; use crate::opengl::{clear_buffers, enable, BufferClearMask, Capability}; use crate::projection::new_perspective; use crate::shader::Program as ShaderProgram; -use crate::texture::{Id as TextureId, Map as TextureMap, Texture}; +use crate::texture::{Id as TextureId, List as TextureMap, Texture}; use crate::transform::Transform; use crate::vector::{Vec2, Vec3}; use crate::vertex::Vertex; @@ -146,14 +146,14 @@ fn render( &shader_program_curr_bound, ); - for (texture_id, texture) in &texture_map.inner { + for texture in &texture_map.list { let gl_texture = gl_textures - .entry(*texture_id) + .entry(texture.id()) .or_insert_with(|| create_gl_texture(texture)); - let texture_unit = TextureUnit::from_texture_id(*texture_id) + let texture_unit = TextureUnit::from_texture_id(texture.id()) .unwrap_or_else(|| { - panic!("Texture id {texture_id} is a invalid texture unit"); + panic!("Texture id {} is a invalid texture unit", texture.id()); }); set_active_texture_unit(texture_unit); -- cgit v1.2.3-18-g5258