[Block] Draw type 'Glass' added.

This commit is contained in:
Quentin Bazin 2020-02-03 15:38:34 +09:00
parent 70e80d1e31
commit 9afa1b6202
3 changed files with 6 additions and 3 deletions

View File

@ -89,7 +89,8 @@ std::array<std::size_t, ChunkBuilder::layers> ChunkBuilder::buildChunk(const Cli
if (block.drawType() == BlockDrawType::Solid
|| block.drawType() == BlockDrawType::AllFaces
|| block.drawType() == BlockDrawType::Liquid) {
|| block.drawType() == BlockDrawType::Liquid
|| block.drawType() == BlockDrawType::Glass) {
for(u8 i = 0 ; i < 6 ; i++) {
addFace(x, y, z, i, chunk, &block, surroundingBlocksPos[i]);
}
@ -125,7 +126,7 @@ inline void ChunkBuilder::addFace(u8 x, u8 y, u8 z, u8 i, const ClientChunk &chu
// Skip hidden faces
if (surroundingBlock && surroundingBlock->id()
&& ((block->drawType() == BlockDrawType::Solid && surroundingBlock->drawType() == BlockDrawType::Solid && surroundingBlock->isOpaque())
|| (block->id() == surroundingBlock->id() && block->drawType() == BlockDrawType::Liquid)))
|| (block->id() == surroundingBlock->id() && (block->drawType() == BlockDrawType::Liquid || block->drawType() == BlockDrawType::Glass))))
return;
static glm::vec3 a, b, c, v1, v2, normal;

View File

@ -35,6 +35,7 @@ enum class BlockDrawType {
XShape = 1,
AllFaces = 2,
Liquid = 3,
Glass = 4,
};
class Block : public ISerializable {

View File

@ -65,7 +65,8 @@ mod:block {
mod:block {
id = "glass",
name = "Glass",
tiles = "glass.png"
tiles = "glass.png",
draw_type = 4 -- FIXME: Use string instead
}
mod:block {