From bdfd1bd217b4a6b3aed859c7a41d771ace99074f Mon Sep 17 00:00:00 2001 From: Adam Kobzan Date: Tue, 17 Oct 2023 03:04:05 +0300 Subject: [PATCH] New blocks! fixing bugs too --- assets/UV_map_example.png | Bin 6068 -> 0 bytes assets/blocks.png | Bin 0 -> 19659 bytes src/block_reg.rs | 154 +++++++++++++++++++++----------------- src/chunk/mod.rs | 14 ++-- src/chunk/systems.rs | 4 +- src/inventory.rs | 9 +-- src/main.rs | 8 +- src/player/movement.rs | 10 ++- 8 files changed, 112 insertions(+), 87 deletions(-) delete mode 100644 assets/UV_map_example.png create mode 100644 assets/blocks.png diff --git a/assets/UV_map_example.png b/assets/UV_map_example.png deleted file mode 100644 index 4584e981aa1a6a2bae907d348a12cd83bb7d8186..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6068 zcmV;l7fa}gP)EX>4Tx04R}tkvmAkP!xv$rb?w&9qb_DkfA!+#TSmX3Pq?8YK2xEOm6yuCJjl7 zi=*ILaPYBMb#QUk)xlK|1Ro%-E>4OrQsTKup+&3*F8AZV=l{9)TtKLonPzpx08O{e zR3a{Bva4d?6+!f(A3jXW%rfRADT$8tbx(a%cTt|zx$n>FQ*#yrd?Im-8KzCVK|Hf* z8=Uuv!>lN)#OK80CS8#Dk?V@bZ=4G*3p_Jyrc?98VPdh+#!4HrqNx#25l2)_r+gvf zvC4UivsSLM<~{ifLpgnAnd`Jhkia6AAVGwJDoQBBMwE7)6bmUjk9Y77yMBpW3b{&P zmr&ZfVLMaJd5vJsGkoyON)lkk13}XY@^3VDJ_Qu6c87p5ycZNYkv6H^9Lm zFjk=K^$zduX`kD_Jb44g@QhY7cY(000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}000$>NklDw$?Y++c4)t9++56$!p zn1LDFBLcAr#+GqxizqS%T60%iDi# z!%ZSxX%KfD!39bVs2FYRi4@!g%V0qO&;lN3^yM7U1LIJL(GdbAJ4nVd5EOGz1q1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1; pub const GRASS: Block = 2; pub const STONE: Block = 3; -pub const LIGHT_MAGIC: Block = 4; -pub const DARK_MAGIC: Block = 5; -pub const TRANSPERENT: Block = 6; -pub const WOOD_DARK_GREY: Block = 7; -pub const PINK_LEAVES: Block = 8; +pub const BRICKS: Block = 4; +pub const LOG: Block = 5; +pub const WOOD: Block = 6; +pub const LEAVES: Block = 7; +pub const GLASS: Block = 8; +pub const GLOWSTONE: Block = 9; pub const VOXEL_DIMS: [f32; 3] = [1.0, 1.0, 1.0]; +const ATLAS_CORDS: [u32; 2] = [24, 24]; +const PADDING: f32 = 0.0625; + #[derive(Resource, Clone)] pub struct BlockRegistry { grass_block: Mesh, dirt_block: Mesh, stone_block: Mesh, - light_magic_block: Mesh, - dark_magic_block: Mesh, - transperent_block: Mesh, - wood_dark_grey_block: Mesh, - pink_leaves: Mesh, + bricks_block: Mesh, + log_block: Mesh, + wood_block: Mesh, + leaves_block: Mesh, + glass_block: Mesh, + glowstone_block: Mesh, } impl Default for BlockRegistry { @@ -33,7 +38,7 @@ impl Default for BlockRegistry { BlockRegistry { grass_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ (Top, [0, 0]), (Bottom, [2, 0]), @@ -42,12 +47,12 @@ impl Default for BlockRegistry { (Forward, [1, 0]), (Back, [1, 0]), ], - 0.1, + PADDING, Some(0.75), ), dirt_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ (Top, [2, 0]), (Bottom, [2, 0]), @@ -56,12 +61,12 @@ impl Default for BlockRegistry { (Forward, [2, 0]), (Back, [2, 0]), ], - 0.1, + PADDING, Some(0.75), ), stone_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ (Top, [3, 0]), (Bottom, [3, 0]), @@ -70,77 +75,91 @@ impl Default for BlockRegistry { (Forward, [3, 0]), (Back, [3, 0]), ], - 0.1, + PADDING, Some(0.75), ), - light_magic_block: generate_voxel_mesh( + bricks_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ - (Top, [2, 1]), - (Bottom, [2, 1]), - (Right, [2, 1]), - (Left, [2, 1]), - (Forward, [2, 1]), - (Back, [2, 1]), + (Top, [4, 0]), + (Bottom, [4, 0]), + (Right, [4, 0]), + (Left, [4, 0]), + (Forward, [4, 0]), + (Back, [4, 0]), ], - 0.1, + PADDING, Some(0.75), ), - dark_magic_block: generate_voxel_mesh( + log_block: generate_voxel_mesh( + VOXEL_DIMS, + ATLAS_CORDS, + [ + (Top, [5, 0]), + (Bottom, [5, 0]), + (Right, [6, 0]), + (Left, [6, 0]), + (Forward, [6, 0]), + (Back, [6, 0]), + ], + PADDING, + Some(0.90), + ), + wood_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ - (Top, [1, 1]), - (Bottom, [1, 1]), - (Right, [1, 1]), - (Left, [1, 1]), - (Forward, [1, 1]), - (Back, [1, 1]), + (Top, [7, 0]), + (Bottom, [7, 0]), + (Right, [7, 0]), + (Left, [7, 0]), + (Forward, [7, 0]), + (Back, [7, 0]), ], - 0.1, + PADDING, Some(0.75), ), - transperent_block: generate_voxel_mesh( + leaves_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ - (Top, [3, 1]), - (Bottom, [3, 1]), - (Right, [3, 1]), - (Left, [3, 1]), - (Forward, [3, 1]), - (Back, [3, 1]), + (Top, [8, 0]), + (Bottom, [8, 0]), + (Right, [8, 0]), + (Left, [8, 0]), + (Forward, [8, 0]), + (Back, [8, 0]), ], - 0.1, + PADDING, Some(0.75), ), - wood_dark_grey_block: generate_voxel_mesh( + glass_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ - (Top, [0, 2]), - (Bottom, [0, 2]), - (Right, [0, 2]), - (Left, [0, 2]), - (Forward, [0, 2]), - (Back, [0, 2]), + (Top, [9, 0]), + (Bottom, [9, 0]), + (Right, [9, 0]), + (Left, [9, 0]), + (Forward, [9, 0]), + (Back, [9, 0]), ], - 0.1, + PADDING, Some(0.75), ), - pink_leaves: generate_voxel_mesh( + glowstone_block: generate_voxel_mesh( VOXEL_DIMS, - [4, 4], + ATLAS_CORDS, [ - (Top, [1, 2]), - (Bottom, [1, 2]), - (Right, [1, 2]), - (Left, [1, 2]), - (Forward, [1, 2]), - (Back, [1, 2]), + (Top, [10, 0]), + (Bottom, [10, 0]), + (Right, [10, 0]), + (Left, [10, 0]), + (Forward, [10, 0]), + (Back, [10, 0]), ], - 0.1, + PADDING, Some(0.75), ), } @@ -168,7 +187,7 @@ impl VoxelRegistry for BlockRegistry { } fn is_covering(&self, voxel: &Self::Voxel, _side: prelude::Face) -> bool { - *voxel != AIR && *voxel != PINK_LEAVES && *voxel != TRANSPERENT + *voxel != AIR && *voxel != LEAVES && *voxel != GLASS } fn get_mesh(&self, voxel: &Self::Voxel) -> VoxelMesh<&Mesh> { @@ -177,11 +196,12 @@ impl VoxelRegistry for BlockRegistry { DIRT => VoxelMesh::NormalCube(&self.dirt_block), GRASS => VoxelMesh::NormalCube(&self.grass_block), STONE => VoxelMesh::NormalCube(&self.stone_block), - LIGHT_MAGIC => VoxelMesh::NormalCube(&self.light_magic_block), - DARK_MAGIC => VoxelMesh::NormalCube(&self.dark_magic_block), - TRANSPERENT => VoxelMesh::NormalCube(&self.transperent_block), - WOOD_DARK_GREY => VoxelMesh::NormalCube(&self.wood_dark_grey_block), - PINK_LEAVES => VoxelMesh::NormalCube(&self.pink_leaves), + BRICKS => VoxelMesh::NormalCube(&self.bricks_block), + LOG => VoxelMesh::NormalCube(&self.log_block), + WOOD => VoxelMesh::NormalCube(&self.wood_block), + LEAVES => VoxelMesh::NormalCube(&self.leaves_block), + GLASS => VoxelMesh::NormalCube(&self.glass_block), + GLOWSTONE => VoxelMesh::NormalCube(&self.glowstone_block), _ => VoxelMesh::Null, } } diff --git a/src/chunk/mod.rs b/src/chunk/mod.rs index d4ce555..9c62372 100644 --- a/src/chunk/mod.rs +++ b/src/chunk/mod.rs @@ -57,16 +57,18 @@ impl Plugin for ChunkPlugin { ( spawn_and_despawn_chunks, frame_chunk_update, - (update_closby_chunks, update_mesh_frame) - .run_if(in_state(InitialChunkLoadState::Complete)), + (update_closby_chunks).run_if(in_state(InitialChunkLoadState::Complete)), ), ); app.add_systems( PostUpdate, - (cull_sides_of_mesh.run_if( - in_state(InitialChunkLoadState::Complete) - .and_then(resource_changed::()), - ),), + ( + cull_sides_of_mesh.run_if( + in_state(InitialChunkLoadState::Complete) + .and_then(resource_changed::()), + ), + update_mesh_frame, + ), ); // Resources diff --git a/src/chunk/systems.rs b/src/chunk/systems.rs index 900183a..0241ea6 100644 --- a/src/chunk/systems.rs +++ b/src/chunk/systems.rs @@ -87,7 +87,9 @@ pub(crate) fn update_mesh_frame( .expect("Can't find chunk mesh in internal assets"); update_mesh(mesh_ref_mut, &mut chunk.meta_data, &*breg.clone()); if let Some(aabb) = mesh_ref_mut.compute_aabb() { - commands.entity(ent).insert(aabb).remove::(); + if let Some(mut comm) = commands.get_entity(ent) { + comm.insert(aabb).remove::(); + } } else { warn!("Couldn't compute Aabb for mesh after updating"); } diff --git a/src/inventory.rs b/src/inventory.rs index f859d43..d84b2ae 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -13,14 +13,7 @@ impl Default for Inventory { Inventory { current: 0, items: vec![ - STONE, - GRASS, - DIRT, - LIGHT_MAGIC, - DARK_MAGIC, - TRANSPERENT, - WOOD_DARK_GREY, - PINK_LEAVES, + GRASS, DIRT, STONE, BRICKS, LOG, WOOD, LEAVES, GLASS, GLOWSTONE, ], } } diff --git a/src/main.rs b/src/main.rs index 7c540c7..98c1244 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ pub use utils::*; // const FACTOR: usize = CHUNK_DIMS.0; // Render distance should be above 1. -pub const RENDER_DISTANCE: i32 = 8; +pub const RENDER_DISTANCE: i32 = 6; pub const GEN_SEED: u32 = 5; const CROSSHAIR_SIZE: f32 = 22.0; @@ -68,7 +68,7 @@ fn main() { .init_resource::() .insert_resource(AmbientLight { - brightness: 1.2, color: Color::ANTIQUE_WHITE}) + brightness: 0.75, color: Color::ANTIQUE_WHITE}) .insert_resource(CycleTimer(Timer::new( bevy::utils::Duration::from_millis(50), TimerMode::Repeating,))) @@ -102,7 +102,7 @@ fn setup( asset_server: Res, mut camera_query: Query<&mut Projection>, ) { - let texture_handle: Handle = asset_server.load("UV_map_example.png"); + let texture_handle: Handle = asset_server.load("blocks.png"); let mat = materials.add(StandardMaterial { base_color_texture: Some(texture_handle), reflectance: 0.0, @@ -114,7 +114,7 @@ fn setup( commands.spawn(LoadedChunks(0)); let mut projection = camera_query.get_single_mut().unwrap(); if let Projection::Perspective(ref mut perspective) = *projection { - perspective.fov = PI / 3.0; + perspective.fov = PI / 3.5; } } diff --git a/src/player/movement.rs b/src/player/movement.rs index 5207884..f04854f 100644 --- a/src/player/movement.rs +++ b/src/player/movement.rs @@ -126,13 +126,21 @@ pub(super) fn player_move( (HALF_CAGE_I as i32) as usize, (HALF_CAGE_I + dz as i32) as usize, ]; + let xzblock_cords = [ + (HALF_CAGE_I + dx as i32) as usize, + (HALF_CAGE_I as i32) as usize, + (HALF_CAGE_I + dz as i32) as usize, + ]; let xblock = one_d_cords(xblock_cords, CAGE_DIMS); let yblock = one_d_cords(yblock_cords, CAGE_DIMS); let zblock = one_d_cords(zblock_cords, CAGE_DIMS); + let xzblock = one_d_cords(xzblock_cords, CAGE_DIMS); let xblock = cage.blocks[xblock]; let yblock = cage.blocks[yblock]; let zblock = cage.blocks[zblock]; + let xzblock = cage.blocks[xzblock]; + if xblock == AIR { transform.translation.x = new_pos.x; } else if (pos.x - pos.x.round() + 0.5 * dx.signum() * -1.0).abs() > 0.5 { @@ -145,7 +153,7 @@ pub(super) fn player_move( transform.translation.y += velocity.y * (pos.y - pos.y.round() + 0.5 * dy.signum() * -1.0).powi(2); } - if zblock == AIR { + if zblock == AIR && xzblock == AIR { transform.translation.z = new_pos.z; } else if (pos.z - pos.z.round() + 0.5 * dz.signum() * -1.0).abs() > 0.5 { transform.translation.z +=