From 69e7ae23db6110ad29d73038db7758f406f7dcae Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 2 May 2024 01:42:07 +0200 Subject: [PATCH] ~~scuffed sorting?~~ --- kubi/src/rendering/world.rs | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/kubi/src/rendering/world.rs b/kubi/src/rendering/world.rs index 8bc024e..3eec5da 100644 --- a/kubi/src/rendering/world.rs +++ b/kubi/src/rendering/world.rs @@ -1,21 +1,11 @@ use glam::{ivec3, IVec3, Mat4, Quat, Vec3}; use shipyard::{NonSendSync, UniqueView, UniqueViewMut, View, IntoIter, track}; use glium::{ - implement_vertex, uniform, - Surface, DrawParameters, - uniforms::{ - Sampler, - SamplerBehavior, - MinifySamplerFilter, - MagnifySamplerFilter, - SamplerWrapFunction - }, draw_parameters::{ - Depth, - DepthTest, - PolygonMode, - BackfaceCullingMode, - }, Blend + BackfaceCullingMode, Depth, DepthTest, PolygonMode + }, implement_vertex, uniform, uniforms::{ + MagnifySamplerFilter, MinifySamplerFilter, Sampler, SamplerBehavior, SamplerWrapFunction + }, Blend, DrawParameters, Smooth, Surface }; use crate::{ camera::Camera, @@ -122,13 +112,13 @@ pub fn draw_world( draw_parameters.blend = Blend::alpha_blending(); draw_parameters.backface_culling = BackfaceCullingMode::CullingDisabled; - draw_parameters.smooth = Some(glium::Smooth::DontCare); + draw_parameters.smooth = Some(Smooth::Fastest); - enqueue_trans.sort_by_key(|k| -( - (k.0.position + IVec3::splat((CHUNK_SIZE >> 1) as i32)).distance_squared(camera_position.as_ivec3()) - )); + // enqueue_trans.sort_by_key(|k| -( + // (k.0.position + IVec3::splat((CHUNK_SIZE >> 1) as i32)).distance_squared(camera_position.as_ivec3()) + // )); - for (chunk, mesh) in enqueue_trans { + for (chunk, mesh) in enqueue_trans.drain(..).rev() { let world_position = chunk.position.as_vec3() * CHUNK_SIZE as f32; target.0.draw( &mesh.trans_vertex_buffer,