works
This commit is contained in:
@@ -89,18 +89,23 @@ impl Content {
|
||||
|
||||
// Allocate new block
|
||||
if value == 0 {
|
||||
value = self.block_freeidx;
|
||||
value = self.block_freeidx + 1;
|
||||
self.node_buffer[index] = value as u32;
|
||||
self.block_freeidx += 1;
|
||||
self.block_freeidx = value;
|
||||
//println!("Alloc: {}", value);
|
||||
}
|
||||
|
||||
//println!("Index: {} Value: {}", index, value);
|
||||
|
||||
// Calculate position in block texture
|
||||
let y = (value % BLOCK_TEX_SIZE * BLOCK_SIZE) as u32;
|
||||
let z = (value / BLOCK_TEX_SIZE * BLOCK_SIZE) as u32;
|
||||
let y = ((value-1) % BLOCK_TEX_SIZE * BLOCK_SIZE) as u32;
|
||||
let z = ((value-1) / BLOCK_TEX_SIZE * BLOCK_SIZE) as u32;
|
||||
let block_origin = wgpu::Origin3d{ x:0, y, z };
|
||||
let block_size = wgpu::Extent3d{ width: BLOCK_SIZE as u32, height: BLOCK_SIZE as u32, depth: BLOCK_SIZE as u32 };
|
||||
let block_bytes : [u8;BLOCK_SIZE*BLOCK_SIZE*BLOCK_SIZE] = block.materials.try_into().unwrap();
|
||||
|
||||
//println!("Y: {} Z: {}", y, z);
|
||||
|
||||
// Write block
|
||||
queue.write_texture(
|
||||
wgpu::TextureCopyView { texture: &self.block_texture, mip_level: 0, origin: block_origin }, &block_bytes,
|
||||
|
||||
Reference in New Issue
Block a user