From 3f359f433ce9234fa6f74b49f7ac257bfa651186 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Sun, 5 May 2024 13:25:54 +0200 Subject: [PATCH] =?UTF-8?q?lifetime=20errors=20:=D1=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kubi/src/prefabs.rs | 4 ++-- kubi/src/rendering/world.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kubi/src/prefabs.rs b/kubi/src/prefabs.rs index b091c7b..5d521e5 100644 --- a/kubi/src/prefabs.rs +++ b/kubi/src/prefabs.rs @@ -36,7 +36,7 @@ impl AssetPaths for BlockTexture { } #[derive(Unique)] -pub struct Textures { +pub struct TexturePrefabs { pub block_diffuse_texture: wgpu::Texture, pub block_diffuse_bind_group: wgpu::BindGroup, } @@ -105,7 +105,7 @@ pub fn load_prefabs( } ] }); - storages.add_unique_non_send_sync(Textures { + storages.add_unique_non_send_sync(TexturePrefabs { block_diffuse_texture, block_diffuse_bind_group, }); diff --git a/kubi/src/rendering/world.rs b/kubi/src/rendering/world.rs index 5d0c57e..e3ec66d 100644 --- a/kubi/src/rendering/world.rs +++ b/kubi/src/rendering/world.rs @@ -2,7 +2,13 @@ use bytemuck::{Pod, Zeroable}; use glam::{IVec3, Vec3}; use shipyard::{AllStoragesView, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View}; use kubi_shared::{chunk::CHUNK_SIZE, transform::Transform}; -use crate::{camera::Camera, settings::GameSettings, world::{ChunkMeshStorage, ChunkStorage}}; +use wgpu::util::RenderEncoder; +use crate::{ + camera::Camera, + prefabs::TexturePrefabs, + settings::GameSettings, + world::{ChunkMeshStorage, ChunkStorage}, +}; use super::Renderer; #[derive(Clone, Copy, Pod, Zeroable)] @@ -36,6 +42,7 @@ pub fn init_trans_chunk_queue(storages: AllStoragesView) { pub fn draw_world( (render_pass, renderer): (&mut wgpu::RenderPass, &Renderer), + textures: UniqueView, chunks: UniqueView, meshes: NonSendSync>, transform: View, @@ -66,6 +73,7 @@ pub fn draw_world( //Draw chunk mesh if mesh.main.index.size() > 0 { //TODO + render_pass.set_bind_group(0, &textures.block_diffuse_bind_group, &[]); } //TODO trans chunks