From a6d89fb2e571df50fedffab4bc56e64dedc610c1 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Mon, 25 Mar 2024 16:32:23 +0000 Subject: [PATCH] Remove unused code --- src/voxel/brickworld/brickgrid.rs | 29 +++++++++++------------------ src/voxel/brickworld/util.rs | 6 ------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/voxel/brickworld/brickgrid.rs b/src/voxel/brickworld/brickgrid.rs index 1be50c1..e7dd5c6 100644 --- a/src/voxel/brickworld/brickgrid.rs +++ b/src/voxel/brickworld/brickgrid.rs @@ -1,9 +1,6 @@ use std::collections::HashSet; -use crate::{ - gfx::{BulkBufferBuilder, Context}, - math, -}; +use crate::gfx::{BulkBufferBuilder, Context}; #[derive(Debug, Clone, Copy, PartialEq)] pub enum BrickgridFlag { @@ -78,9 +75,15 @@ impl Brickgrid { } } - /// Panics if position maps to out of range index - // pub fn set(&mut self, pos: glam::UVec3, value: BrickgridElement) -> BrickgridElement { - // let index = math::to_1d_index(pos, self.dimensions); + pub fn get_buffer(&self) -> &wgpu::Buffer { + &self.buffer + } + + pub fn get_upload_buffer(&self) -> &wgpu::Buffer { + &self.upload_buffer + } + + /// Panics if index out of range pub fn set(&mut self, index: usize, value: BrickgridElement) -> BrickgridElement { let current = self.data[index]; self.data[index] = value; @@ -88,9 +91,7 @@ impl Brickgrid { current } - /// Panics if position maps to out of range index - // pub fn get(&mut self, pos: glam::UVec3) -> BrickgridElement { - // let index = math::to_1d_index(pos, self.dimensions); + /// Panics if index out of range pub fn get(&mut self, index: usize) -> BrickgridElement { self.data[index] } @@ -128,12 +129,4 @@ impl Brickgrid { ); } } - - pub fn get_buffer(&self) -> &wgpu::Buffer { - &self.buffer - } - - pub fn get_upload_buffer(&self) -> &wgpu::Buffer { - &self.upload_buffer - } } diff --git a/src/voxel/brickworld/util.rs b/src/voxel/brickworld/util.rs index 7da4453..91026f4 100644 --- a/src/voxel/brickworld/util.rs +++ b/src/voxel/brickworld/util.rs @@ -1,7 +1,5 @@ use crate::voxel::world::{Voxel, WorldManager}; -use super::brickgrid::BrickgridFlag; - pub fn cull_interior_voxels( world: &mut WorldManager, grid_pos: glam::IVec3, @@ -103,10 +101,6 @@ pub fn cull_interior_voxels( (bitmask_data, albedo_data) } -pub fn to_brickgrid_element(brickmap_cache_idx: u32, flags: BrickgridFlag) -> u32 { - (brickmap_cache_idx << 8) + flags as u32 -} - pub fn grid_pos_to_world_pos( world: &mut WorldManager, grid_pos: glam::IVec3,