From 8b0c61a061f6515c20f230bdcb2013cba9473e69 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 14 Apr 2024 23:20:33 +0200 Subject: chore: use automatic texture ID creation --- src/main.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 97c7615..03fb441 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ use engine::lighting::{LightSource, LightSourceBuilder}; use engine::material::Builder as MaterialBuilder; use engine::renderer::Extension as RendererExtension; use engine::shader::Program as ShaderProgram; -use engine::texture::{Id as TextureId, Map as TextureMap, Texture}; +use engine::texture::{List as TextureList, Texture}; use engine::transform::Transform; use engine::vector::{Vec2, Vec3}; use engine::vertex::Builder as VertexBuilder; @@ -126,16 +126,17 @@ fn main() -> Result<(), Box> transform.set_position(Vec3 { x: 1.6, y: 0.0, z: 0.0 }); + let texture = Texture::open(Path::new("vent.png"))?; + + let texture_id = texture.id(); + engine.spawn(( create_cube_mesh(cube_vertex_builder_cb), - TextureMap::from_iter([( - TextureId::new(0), - Texture::open(Path::new("vent.png"))?, - )]), + TextureList::from_iter([texture]), MaterialBuilder::new() - .ambient_map(TextureId::new(0)) - .diffuse_map(TextureId::new(0)) - .specular_map(TextureId::new(0)) + .ambient_map(texture_id) + .diffuse_map(texture_id) + .specular_map(texture_id) .build(), transform, ShaderProgram::new()?, -- cgit v1.2.3-18-g5258