mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-25 05:08:21 -06:00
changes to binary transparency meshing
This commit is contained in:
parent
80635cd596
commit
5f855bdaf1
|
@ -124,7 +124,7 @@ impl Block {
|
||||||
name: "water",
|
name: "water",
|
||||||
render: RenderType::BinaryTransparency(CubeTexture::all(BlockTexture::WaterSolid)),
|
render: RenderType::BinaryTransparency(CubeTexture::all(BlockTexture::WaterSolid)),
|
||||||
collision: CollisionType::None,
|
collision: CollisionType::None,
|
||||||
raycast_collision: false,
|
raycast_collision: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ const BLOCK_KEY_MAP: &[(VirtualKeyCode, Block)] = &[
|
||||||
(VirtualKeyCode::Key5, Block::Sand),
|
(VirtualKeyCode::Key5, Block::Sand),
|
||||||
(VirtualKeyCode::Key6, Block::Stone),
|
(VirtualKeyCode::Key6, Block::Stone),
|
||||||
(VirtualKeyCode::Key7, Block::Torch),
|
(VirtualKeyCode::Key7, Block::Torch),
|
||||||
|
(VirtualKeyCode::Key8, Block::Leaf),
|
||||||
];
|
];
|
||||||
|
|
||||||
fn pick_block_with_number_keys(
|
fn pick_block_with_number_keys(
|
||||||
|
|
|
@ -43,10 +43,17 @@ pub fn generate_mesh(data: MeshGenData) -> (Vec<ChunkVertex>, Vec<u32>) {
|
||||||
for face in CubeFace::iter() {
|
for face in CubeFace::iter() {
|
||||||
let facing_direction = face.normal();
|
let facing_direction = face.normal();
|
||||||
let facing_coord = coord + facing_direction;
|
let facing_coord = coord + facing_direction;
|
||||||
let facing_descriptor = get_block(facing_coord).descriptor();
|
let facing_block = get_block(facing_coord);
|
||||||
|
let facing_descriptor = facing_block.descriptor();
|
||||||
let face_obstructed = match descriptor.render {
|
let face_obstructed = match descriptor.render {
|
||||||
RenderType::SolidBlock(_) => matches!(facing_descriptor.render, RenderType::SolidBlock(_)),
|
RenderType::SolidBlock(_) => matches!(facing_descriptor.render, RenderType::SolidBlock(_)),
|
||||||
RenderType::BinaryTransparency(_) => matches!(facing_descriptor.render, RenderType::SolidBlock(_) | RenderType::BinaryTransparency(_)),
|
RenderType::BinaryTransparency(_) => {
|
||||||
|
match facing_descriptor.render {
|
||||||
|
RenderType::SolidBlock(_) => true,
|
||||||
|
RenderType::BinaryTransparency(_) => block == facing_block,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
if !face_obstructed {
|
if !face_obstructed {
|
||||||
|
|
Loading…
Reference in a new issue