mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 11:58:21 -06:00
changes to binary transparency meshing
This commit is contained in:
parent
fc783d52dc
commit
ce687e8d36
|
@ -124,7 +124,7 @@ impl Block {
|
|||
name: "water",
|
||||
render: RenderType::BinaryTransparency(CubeTexture::all(BlockTexture::WaterSolid)),
|
||||
collision: CollisionType::None,
|
||||
raycast_collision: false,
|
||||
raycast_collision: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ const BLOCK_KEY_MAP: &[(VirtualKeyCode, Block)] = &[
|
|||
(VirtualKeyCode::Key5, Block::Sand),
|
||||
(VirtualKeyCode::Key6, Block::Stone),
|
||||
(VirtualKeyCode::Key7, Block::Torch),
|
||||
(VirtualKeyCode::Key8, Block::Leaf),
|
||||
];
|
||||
|
||||
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() {
|
||||
let facing_direction = face.normal();
|
||||
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 {
|
||||
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!(),
|
||||
};
|
||||
if !face_obstructed {
|
||||
|
|
Loading…
Reference in a new issue