GPU Brickgrid dimensions are now defined by the renderer
This commit is contained in:
parent
0e1b844f96
commit
c4107c61ea
|
@ -37,14 +37,15 @@ pub struct BrickmapManager {
|
||||||
// - Cyclic brickmap cache with unloading
|
// - Cyclic brickmap cache with unloading
|
||||||
// - Brickworld system
|
// - Brickworld system
|
||||||
impl BrickmapManager {
|
impl BrickmapManager {
|
||||||
pub fn new(context: &render::Context) -> Self {
|
pub fn new(context: &render::Context, brickgrid_dims: glam::UVec3) -> Self {
|
||||||
let state_uniform = WorldState {
|
let state_uniform = WorldState {
|
||||||
brickmap_cache_dims: [32, 32, 32],
|
brickmap_cache_dims: [brickgrid_dims.x, brickgrid_dims.y, brickgrid_dims.z],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let brickmap_cache = vec![Brickmap::default(); usize::pow(32, 3)];
|
let brickmap_cache = vec![Brickmap::default(); usize::pow(32, 3)];
|
||||||
let brickgrid = vec![1u32; usize::pow(32, 3)];
|
let brickgrid =
|
||||||
|
vec![1u32; (brickgrid_dims.x * brickgrid_dims.y * brickgrid_dims.z) as usize];
|
||||||
|
|
||||||
let device = &context.device;
|
let device = &context.device;
|
||||||
let state_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
let state_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||||
|
|
|
@ -60,7 +60,8 @@ impl VoxelRenderer {
|
||||||
});
|
});
|
||||||
|
|
||||||
log::info!("Creating brickmap manager...");
|
log::info!("Creating brickmap manager...");
|
||||||
let brickmap_manager = super::brickmap::BrickmapManager::new(context);
|
let brickgrid_dims = glam::uvec3(64, 64, 64);
|
||||||
|
let brickmap_manager = super::brickmap::BrickmapManager::new(context, brickgrid_dims);
|
||||||
|
|
||||||
log::info!("Creating compute pipeline...");
|
log::info!("Creating compute pipeline...");
|
||||||
let cs_descriptor = wgpu::include_wgsl!("../../assets/shaders/voxel_volume.wgsl");
|
let cs_descriptor = wgpu::include_wgsl!("../../assets/shaders/voxel_volume.wgsl");
|
||||||
|
|
Loading…
Reference in New Issue