diff --git a/src/main/java/de/bixilon/minosoft/data/world/BlockPosition.kt b/src/main/java/de/bixilon/minosoft/data/world/BlockPosition.kt index f608ecb0a..981c58be0 100644 --- a/src/main/java/de/bixilon/minosoft/data/world/BlockPosition.kt +++ b/src/main/java/de/bixilon/minosoft/data/world/BlockPosition.kt @@ -77,7 +77,7 @@ data class BlockPosition(val x: Int, val y: Int, val z: Int) { return "($x $y $z)" } - infix fun add(input: Vec3): Vec3 { + infix operator fun plus(input: Vec3): Vec3 { return Vec3(input.x + x, input.y + y, input.z + z) } } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/BlockRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/BlockRenderer.kt index 7c386b69d..d6fbf9175 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/BlockRenderer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/BlockRenderer.kt @@ -93,22 +93,25 @@ class BlockRenderer : BlockRenderInterface { override fun render(blockState: BlockState, lightAccessor: LightAccessor, tintColor: RGBColor?, position: BlockPosition, meshCollection: ChunkMeshCollection, neighbourBlocks: Array, world: World) { for (direction in Directions.DIRECTIONS) { - for (element in elements) { - val cullFace = cullFaces[direction.ordinal] != null + val cullFace = cullFaces[direction.ordinal] != null + + var neighbourBlockFullFace = false + neighbourBlocks[direction.ordinal]?.renders?.let { // ToDo: Improve this + val testDirection = direction.inverse + for (model in it) { + if (model.fullFaceDirections[testDirection.ordinal] != null && model.transparentFaces[testDirection.ordinal] == null) { + neighbourBlockFullFace = true + break - var neighbourBlockFullFace = false - neighbourBlocks[direction.ordinal]?.renders?.let { // ToDo: Improve this - val testDirection = direction.inverse - for (model in it) { - if (model.fullFaceDirections[testDirection.ordinal] != null && model.transparentFaces[testDirection.ordinal] == null) { - neighbourBlockFullFace = true - break - } } } - if (neighbourBlockFullFace && cullFace) { - continue - } + } + + if (neighbourBlockFullFace && cullFace) { + continue + } + + for (element in elements) { element.render(tintColor, position, lightAccessor, textureMapping, direction, meshCollection) } } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/ElementRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/ElementRenderer.kt index 404701e0e..ab25b5401 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/ElementRenderer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/models/renderable/ElementRenderer.kt @@ -79,7 +79,7 @@ class ElementRenderer(parent: BlockModelElement, val rotation: Vec3, uvLock: Boo fun createQuad(drawPositions: Array, texturePositions: Array) { for (vertex in DRAW_ODER) { val input = drawPositions[vertex.first] - val output = position add input + val output = position + input mesh.addVertex( position = output, textureCoordinates = texturePositions[vertex.second]!!,