remove unsafe garbage, i'll just wait for pr 3626 instead

This commit is contained in:
griffi-gh 2023-07-21 02:19:19 +02:00
parent 12c54069f3
commit d26fcbdda3

View file

@ -1,6 +1,6 @@
use glam::{Vec3, Mat4, Quat, ivec3}; use glam::{Vec3, Mat4, Quat, ivec3};
use shipyard::{NonSendSync, UniqueView, UniqueViewMut, View, IntoIter, track, Unique, AllStoragesView}; use shipyard::{NonSendSync, UniqueView, UniqueViewMut, View, IntoIter, track, Unique, AllStoragesView};
use wgpu::{util::DeviceExt, RenderPass}; use wgpu::util::DeviceExt;
use crate::{ use crate::{
camera::Camera, camera::Camera,
player::MainPlayer, player::MainPlayer,
@ -148,7 +148,7 @@ pub fn init_gpu_data(
} }
pub fn draw_world ( pub fn draw_world (
render_pass: &mut RenderPass, render_pass: &mut wgpu::RenderPass,
renderer: UniqueView<Renderer>, renderer: UniqueView<Renderer>,
gpu_data: UniqueView<GpuData>, gpu_data: UniqueView<GpuData>,
chunks: UniqueView<ChunkStorage>, chunks: UniqueView<ChunkStorage>,
@ -167,10 +167,8 @@ pub fn draw_world(
//Draw chunk mesh //Draw chunk mesh
for (&position, chunk) in &chunks.chunks { for (&position, chunk) in &chunks.chunks {
// //! //TODO THIS IS PROBABLY UB let mesh = meshes.get(key).expect("Mesh index pointing to nothing");
// AND I DONT FUCKING CARE let gpu_data = gpu_data.as_ref();
let mesh = unsafe { yolo(meshes.get(key).expect("Mesh index pointing to nothing")) };
let gpu_data = unsafe { yolo(gpu_data.as_ref()) };
render_pass.set_pipeline(&gpu_data.pipeline); render_pass.set_pipeline(&gpu_data.pipeline);
render_pass.set_bind_group(0, &gpu_data.bind_group, &[]); render_pass.set_bind_group(0, &gpu_data.bind_group, &[]);
render_pass.set_vertex_buffer(0, mesh.vertex_buffer.slice(..)); render_pass.set_vertex_buffer(0, mesh.vertex_buffer.slice(..));