summaryrefslogtreecommitdiff
path: root/engine/src/renderer/mod.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-14 23:19:56 +0200
committerHampusM <hampus@hampusmat.com>2024-04-14 23:19:56 +0200
commitfffb401638ac08e395785eadb1ab0ae1d17613aa (patch)
treebe4ad64e2149b1a57349a83121ddd5e46f15881b /engine/src/renderer/mod.rs
parent2302a232de4132a25153071049d31bc59ae70b35 (diff)
feat(engine): create texture IDs automatically
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r--engine/src/renderer/mod.rs10
1 files changed, 5 insertions, 5 deletions
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);