Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
updated to 0.2.3
Browse files Browse the repository at this point in the history
Adamkob12 committed Oct 14, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 807e3d4 commit 6eb5a8b
Showing 5 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@ edition = "2021"
[dependencies]
bevy = "0.11.3"
bevy_atmosphere = "0.7.0"
bevy_meshem = "0.2.2"
bevy_meshem = "0.2.3"
futures-lite = "1.13.0"
noise = "0.8.2"
35 changes: 22 additions & 13 deletions src/block_reg.rs
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ impl Default for BlockRegistry {
(Back, [1, 0]),
],
0.02,
Some(0.75),
),
dirt_block: generate_voxel_mesh(
VOXEL_DIMS,
@@ -56,6 +57,7 @@ impl Default for BlockRegistry {
(Back, [2, 0]),
],
0.02,
Some(0.75),
),
stone_block: generate_voxel_mesh(
VOXEL_DIMS,
@@ -69,6 +71,7 @@ impl Default for BlockRegistry {
(Back, [3, 0]),
],
0.02,
Some(0.75),
),
light_magic_block: generate_voxel_mesh(
VOXEL_DIMS,
@@ -82,6 +85,7 @@ impl Default for BlockRegistry {
(Back, [2, 1]),
],
0.02,
Some(0.75),
),
dark_magic_block: generate_voxel_mesh(
VOXEL_DIMS,
@@ -95,6 +99,7 @@ impl Default for BlockRegistry {
(Back, [1, 1]),
],
0.02,
Some(0.75),
),
transperent_block: generate_voxel_mesh(
VOXEL_DIMS,
@@ -108,6 +113,7 @@ impl Default for BlockRegistry {
(Back, [3, 1]),
],
0.02,
Some(0.75),
),
wood_dark_grey_block: generate_voxel_mesh(
VOXEL_DIMS,
@@ -121,6 +127,7 @@ impl Default for BlockRegistry {
(Back, [0, 2]),
],
0.02,
Some(0.75),
),
pink_leaves: generate_voxel_mesh(
VOXEL_DIMS,
@@ -134,6 +141,7 @@ impl Default for BlockRegistry {
(Back, [1, 2]),
],
0.02,
Some(0.75),
),
}
}
@@ -147,6 +155,7 @@ impl VoxelRegistry for BlockRegistry {
Mesh::ATTRIBUTE_POSITION,
Mesh::ATTRIBUTE_UV_0,
Mesh::ATTRIBUTE_NORMAL,
Mesh::ATTRIBUTE_COLOR,
]
}

@@ -158,22 +167,22 @@ impl VoxelRegistry for BlockRegistry {
[0.0, 0.0, 0.0]
}

fn is_voxel(&self, voxel: &Self::Voxel) -> bool {
*voxel != AIR
fn is_covering(&self, voxel: &Self::Voxel, _side: prelude::Face) -> bool {
*voxel != AIR && *voxel != PINK_LEAVES && *voxel != TRANSPERENT
}

fn get_mesh(&self, voxel: &Self::Voxel) -> Option<&Mesh> {
fn get_mesh(&self, voxel: &Self::Voxel) -> VoxelMesh<&Mesh> {
match *voxel {
AIR => None,
DIRT => Some(&self.dirt_block),
GRASS => Some(&self.grass_block),
STONE => Some(&self.stone_block),
LIGHT_MAGIC => Some(&self.light_magic_block),
DARK_MAGIC => Some(&self.dark_magic_block),
TRANSPERENT => Some(&self.transperent_block),
WOOD_DARK_GREY => Some(&self.wood_dark_grey_block),
PINK_LEAVES => Some(&self.pink_leaves),
_ => None,
AIR => VoxelMesh::Null,
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),
_ => VoxelMesh::Null,
}
}
}
4 changes: 4 additions & 0 deletions src/chunk/chunk_queue.rs
Original file line number Diff line number Diff line change
@@ -134,6 +134,10 @@ impl ChunkQueue {
&grid,
&*breg,
MeshingAlgorithm::Culling,
Some(PbsParameters {
pbs_value: 0.12,
pbs_smoothing: 0.5,
}),
)?;
Some((t, grid, cords))
});
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ fn main() {

.init_resource::<BlockRegistry>()
.insert_resource(AmbientLight {
brightness: 0.8, color: Color::WHITE,})
brightness: 1.15, color: Color::WHITE})
.insert_resource(CycleTimer(Timer::new(
bevy::utils::Duration::from_millis(50),
TimerMode::Repeating,)))
2 changes: 1 addition & 1 deletion src/sky.rs
Original file line number Diff line number Diff line change
@@ -59,6 +59,6 @@ pub fn daylight_cycle(

if let Some((mut light_trans, mut directional)) = query.single_mut().into() {
light_trans.rotation = Quat::from_rotation_x(-2.75);
directional.illuminance = 15000.0;
directional.illuminance = 8000.0;
}
}

0 comments on commit 6eb5a8b

Please sign in to comment.