Don't skip generation of some chunks
This commit is contained in:
parent
ed46752c92
commit
95dd469f7a
|
@ -161,12 +161,6 @@ impl BrickmapManager {
|
|||
let chunk_y = data[i * 4 + 1];
|
||||
let chunk_z = data[i * 4 + 2];
|
||||
|
||||
let chunk_idx = (chunk_x
|
||||
+ chunk_y * world_dims[0]
|
||||
+ chunk_z * world_dims[0] * world_dims[1]) as usize;
|
||||
if chunk_idx % 3 == 0 || chunk_idx % 5 == 0 || chunk_idx % 7 == 0 {
|
||||
self.update_brickgrid_element(context, chunk_idx, 0)
|
||||
} else {
|
||||
// Generate full data
|
||||
let mut chunk = [(false, 0u32); 512];
|
||||
for z in 0..8 {
|
||||
|
@ -231,6 +225,10 @@ impl BrickmapManager {
|
|||
bitmask_data[offset + 1] = ((entry >> 32) & 0xFFFFFFFF).try_into().unwrap();
|
||||
}
|
||||
|
||||
let chunk_idx = (chunk_x
|
||||
+ chunk_y * world_dims[0]
|
||||
+ chunk_z * world_dims[0] * world_dims[1]) as usize;
|
||||
|
||||
// Update the brickgrid index
|
||||
let brickgrid_element = ((self.brickmap_cache_idx as u32) << 8) + 4;
|
||||
self.update_brickgrid_element(context, chunk_idx, brickgrid_element);
|
||||
|
@ -248,8 +246,7 @@ impl BrickmapManager {
|
|||
|
||||
// Update the brickmap
|
||||
self.brickmap_cache[self.brickmap_cache_idx].bitmask = bitmask_data;
|
||||
self.brickmap_cache[self.brickmap_cache_idx].shading_table_offset =
|
||||
shading_idx as u32;
|
||||
self.brickmap_cache[self.brickmap_cache_idx].shading_table_offset = shading_idx as u32;
|
||||
context.queue.write_buffer(
|
||||
&self.brickmap_buffer,
|
||||
(72 * self.brickmap_cache_idx) as u64,
|
||||
|
@ -257,7 +254,6 @@ impl BrickmapManager {
|
|||
);
|
||||
self.brickmap_cache_idx += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the request count on the gpu buffer
|
||||
let data = &[0, 0, 0, 0];
|
||||
|
|
Loading…
Reference in New Issue