changed brick texture from being 32x32x32 1D to 32x32x32 2D (smaller indexes)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use rand::prelude::*;
|
||||
|
||||
use crate::renderer::buffers::{WORLD_SIZE, NUM_NODES};
|
||||
use crate::renderer::buffers::{NODE_TEX_SIZE, NODE_TEX_LEN};
|
||||
|
||||
pub struct Nodes {
|
||||
pub nodes: Box<[u32]>,
|
||||
@@ -16,7 +16,7 @@ impl Nodes {
|
||||
pub fn new(device: &wgpu::Device) -> Self {
|
||||
|
||||
// Create texture
|
||||
let size = wgpu::Extent3d { width: WORLD_SIZE as u32, height: WORLD_SIZE as u32, depth: WORLD_SIZE as u32 };
|
||||
let size = wgpu::Extent3d { width: NODE_TEX_SIZE as u32, height: NODE_TEX_SIZE as u32, depth: NODE_TEX_SIZE as u32 };
|
||||
let texture = device.create_texture(
|
||||
&wgpu::TextureDescriptor {
|
||||
size: size,
|
||||
@@ -69,7 +69,7 @@ impl Nodes {
|
||||
);
|
||||
|
||||
// Data
|
||||
let nodes = vec![0_u32; NUM_NODES].into_boxed_slice();
|
||||
let nodes = vec![0_u32; NODE_TEX_LEN].into_boxed_slice();
|
||||
println!("Node buffer size: {} MB", nodes.len() as f32 * 4.0 / 1024.0 / 1024.0);
|
||||
|
||||
// Done
|
||||
@@ -78,7 +78,7 @@ impl Nodes {
|
||||
|
||||
pub fn write(&mut self, queue: &wgpu::Queue) {
|
||||
// Convert 32 bit values to 8 bit
|
||||
let mut bytes = [0_u8; NUM_NODES*4];
|
||||
let mut bytes = [0_u8; NODE_TEX_LEN*4];
|
||||
LittleEndian::write_u32_into(&self.nodes, &mut bytes);
|
||||
|
||||
// Write
|
||||
|
||||
Reference in New Issue
Block a user