diff --git a/assets/blocks/solid_water.png b/assets/blocks/solid_water.png new file mode 100644 index 0000000..7505981 Binary files /dev/null and b/assets/blocks/solid_water.png differ diff --git a/kubi-shared/src/block.rs b/kubi-shared/src/block.rs index dae5489..558e1df 100644 --- a/kubi-shared/src/block.rs +++ b/kubi-shared/src/block.rs @@ -25,6 +25,7 @@ pub enum BlockTexture { #[repr(u8)] pub enum Block { Air, + Marker, Stone, Dirt, Grass, @@ -47,6 +48,12 @@ impl Block { collision: CollisionType::None, raycast_collision: false, }, + Self::Marker => BlockDescriptor { + name: "marker", + render: RenderType::None, + collision: CollisionType::None, + raycast_collision: false, + }, Self::Stone => BlockDescriptor { name: "stone", render: RenderType::SolidBlock(CubeTexture::all(BlockTexture::Stone)), diff --git a/kubi-shared/src/worldgen.rs b/kubi-shared/src/worldgen.rs index 0de0826..954293e 100644 --- a/kubi-shared/src/worldgen.rs +++ b/kubi-shared/src/worldgen.rs @@ -63,7 +63,7 @@ pub fn generate_world(chunk_position: IVec3, seed: u64) -> (BlockData, Vec (BlockData, Vec (BlockData, Vec 0.4 { + let raw_ravine_value = ravine_nose_line.get_noise(noise_x, noise_y); + if (-0.0125..0.0125).contains(&(raw_ravine_value.powi(2))) { + is_surface = false; + height -= (100. * (0.0125 - raw_ravine_value.powi(2)) * (1. / 0.0125)).round() as i32; + } + } + } height }; //add to heightmap - heightmap[x as usize][z as usize] = height; - //place dirt - for y in 0..local_height(height, chunk_position) { - blocks[x][y][z] = Block::Dirt; - within_heightmap = true; - } - //place stone - for y in 0..local_height(height - 5 - (raw_heightmap_value * 5.) as i32, chunk_position) { - blocks[x][y][z] = Block::Stone; - within_heightmap = true; - } - //place grass - if let Some(y) = local_y_position(height, chunk_position) { - blocks[x][y][z] = Block::Grass; + if is_surface { + deco_heightmap[x as usize][z as usize] = Some(height); + //place dirt + for y in 0..local_height(height, chunk_position) { + blocks[x][y][z] = Block::Dirt; + within_heightmap = true; + } + //place stone + for y in 0..local_height(height - 5 - (raw_heightmap_value * 5.) as i32, chunk_position) { + blocks[x][y][z] = Block::Stone; + within_heightmap = true; + } + //place grass + if let Some(y) = local_y_position(height, chunk_position) { + blocks[x][y][z] = Block::Grass; + within_heightmap = true; + } + } else { + for y in 0..local_height(height, chunk_position) { + blocks[x][y][z] = Block::Stone; + within_heightmap = true; + } } } } @@ -128,15 +173,30 @@ pub fn generate_world(chunk_position: IVec3, seed: u64) -> (BlockData, Vec (BlockData, Vec (BlockData, Vec (BlockData, Vec