diff --git a/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/OverlayC.kt b/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/OverlayC.kt
index f39caf4c2..b486bfee4 100644
--- a/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/OverlayC.kt
+++ b/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/OverlayC.kt
@@ -14,6 +14,7 @@
package de.bixilon.minosoft.config.profile.profiles.rendering.overlay
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager.delegate
+import de.bixilon.minosoft.config.profile.profiles.rendering.overlay.fire.FireC
class OverlayC {
/**
@@ -25,4 +26,6 @@ class OverlayC {
* Enabled the pumpkin blur overlay if the player is waring a carved pumpkin
*/
var pumpkin by delegate(true)
+
+ val fire = FireC()
}
diff --git a/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/fire/FireC.kt b/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/fire/FireC.kt
new file mode 100644
index 000000000..f808b7c45
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/config/profile/profiles/rendering/overlay/fire/FireC.kt
@@ -0,0 +1,34 @@
+/*
+ * Minosoft
+ * Copyright (C) 2020-2022 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.config.profile.profiles.rendering.overlay.fire
+
+import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager.delegate
+
+class FireC {
+
+ /**
+ * Enables the fire/burning overlay
+ */
+ var enabled by delegate(true)
+
+ /**
+ * Enables the overlay if in creative
+ */
+ var creative by delegate(true)
+
+ /**
+ * Enables the fire overlay if in lava
+ */
+ var lava by delegate(true)
+}
diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/DefaultOverlays.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/DefaultOverlays.kt
index a59dc7f02..6c722dfe6 100644
--- a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/DefaultOverlays.kt
+++ b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/DefaultOverlays.kt
@@ -24,5 +24,6 @@ object DefaultOverlays {
WaterOverlay,
PumpkinOverlay,
PowderSnowOverlay,
+ FireOverlay,
)
}
diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/FireOverlay.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/FireOverlay.kt
new file mode 100644
index 000000000..557de7414
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/gui/rendering/framebuffer/world/overlay/overlays/FireOverlay.kt
@@ -0,0 +1,79 @@
+/*
+ * Minosoft
+ * Copyright (C) 2020-2022 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays
+
+import de.bixilon.minosoft.data.abilities.Gamemodes
+import de.bixilon.minosoft.data.registries.fluid.DefaultFluids
+import de.bixilon.minosoft.data.text.RGBColor
+import de.bixilon.minosoft.gui.rendering.RenderWindow
+import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.Overlay
+import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.OverlayFactory
+import de.bixilon.minosoft.gui.rendering.system.base.shader.Shader
+import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.AbstractTexture
+import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
+import de.bixilon.minosoft.gui.rendering.util.mesh.SimpleTextureMesh
+import de.bixilon.minosoft.util.KUtil.toResourceLocation
+import glm_.vec3.Vec3
+
+class FireOverlay(
+ private val renderWindow: RenderWindow,
+ private val z: Float,
+) : Overlay {
+ private val config = renderWindow.connection.profiles.rendering.overlay.fire
+ private val player = renderWindow.connection.player
+ private val shader: Shader = renderWindow.shaderManager.genericTexture2dShader
+ private var texture: AbstractTexture = renderWindow.textureManager.staticTextures.createTexture("block/fire_1".toResourceLocation().texture())
+ override val render: Boolean
+ get() = config.enabled && player.isOnFire && !((player.gamemode == Gamemodes.CREATIVE && config.creative) || (player.fluidHeights[DefaultFluids.LAVA] != null && config.lava))
+ private lateinit var mesh: SimpleTextureMesh
+ private val tintColor = RGBColor(1.0f, 1.0f, 1.0f, 0.9f)
+
+
+ override fun postInit() {
+ mesh = SimpleTextureMesh(renderWindow)
+
+ // left
+ mesh.addQuad(arrayOf(
+ Vec3(-1.0f, -1.0f, +0.0f),
+ Vec3(-1.0f, +1.0f, +0.0f),
+ Vec3(+0.0f, +1.0f, +1.0f),
+ Vec3(+0.0f, -1.0f, +1.0f),
+ )) { position, uv -> mesh.addVertex(position, texture, uv, tintColor) }
+
+ // right
+ mesh.addQuad(arrayOf(
+ Vec3(+0.0f, -1.0f, +1.0f),
+ Vec3(+0.0f, +1.0f, +1.0f),
+ Vec3(+1.0f, +1.0f, +0.0f),
+ Vec3(+1.0f, -1.0f, +0.0f),
+ )) { position, uv -> mesh.addVertex(position, texture, uv, tintColor) }
+
+ mesh.load()
+ }
+
+
+ override fun draw() {
+ renderWindow.renderSystem.reset(blending = true, depthMask = false)
+ shader.use()
+ mesh.draw()
+ }
+
+
+ companion object : OverlayFactory {
+
+ override fun build(renderWindow: RenderWindow, z: Float): FireOverlay {
+ return FireOverlay(renderWindow, z)
+ }
+ }
+}
diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/util/mesh/Mesh.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/util/mesh/Mesh.kt
index 3c78b93f9..750409784 100644
--- a/src/main/java/de/bixilon/minosoft/gui/rendering/util/mesh/Mesh.kt
+++ b/src/main/java/de/bixilon/minosoft/gui/rendering/util/mesh/Mesh.kt
@@ -99,7 +99,7 @@ abstract class Mesh(
addQuad(positions, uvStart, uvEnd, vertexConsumer)
}
- private fun addQuad(positions: Array, uvStart: Vec2 = Vec2(0.0f, 0.0f), uvEnd: Vec2 = Vec2(1.0f, 1.0f), vertexConsumer: (position: Vec3, uv: Vec2) -> Unit) {
+ fun addQuad(positions: Array, uvStart: Vec2 = Vec2(0.0f, 0.0f), uvEnd: Vec2 = Vec2(1.0f, 1.0f), vertexConsumer: (position: Vec3, uv: Vec2) -> Unit) {
val texturePositions = arrayOf(
uvStart,
Vec2(uvStart.x, uvEnd.y),