diff --git a/src/main/java/de/bixilon/minosoft/data/entities/entities/LivingEntity.kt b/src/main/java/de/bixilon/minosoft/data/entities/entities/LivingEntity.kt index 5f59dc47c..36fdc8537 100644 --- a/src/main/java/de/bixilon/minosoft/data/entities/entities/LivingEntity.kt +++ b/src/main/java/de/bixilon/minosoft/data/entities/entities/LivingEntity.kt @@ -118,6 +118,4 @@ abstract class LivingEntity(connection: PlayConnection, entityType: EntityType, super.realTick() tickStatusEffects() } - - } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/input/camera/Camera.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/input/camera/Camera.kt index 5b164f62a..d640b1743 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/input/camera/Camera.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/input/camera/Camera.kt @@ -163,18 +163,18 @@ class Camera( inChunkSectionPosition = blockPosition.inChunkSectionPosition // recalculate sky color for current biome val skyRenderer = renderWindow[SkyRenderer] ?: return - skyRenderer.setSkyColor(connection.world.getBiome(blockPosition)?.skyColor ?: RenderConstants.DEFAULT_SKY_COLOR) + skyRenderer.baseColor = connection.world.getBiome(blockPosition)?.skyColor ?: RenderConstants.DEFAULT_SKY_COLOR frustum.recalculate() connection.fireEvent(FrustumChangeEvent(renderWindow, frustum)) connection.world.dimension?.hasSkyLight?.let { if (it) { - skyRenderer.setSkyColor(currentBiome?.skyColor ?: RenderConstants.DEFAULT_SKY_COLOR) + skyRenderer.baseColor = currentBiome?.skyColor ?: RenderConstants.DEFAULT_SKY_COLOR } else { - skyRenderer.setSkyColor(RenderConstants.BLACK_COLOR) + skyRenderer.baseColor = RenderConstants.BLACK_COLOR } - } ?: skyRenderer.setSkyColor(RenderConstants.DEFAULT_SKY_COLOR) + } ?: let { skyRenderer.baseColor = RenderConstants.DEFAULT_SKY_COLOR } connection.fireEvent(CameraPositionChangeEvent(renderWindow, cameraPosition)) } diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt index 38cd41c3f..f7f4bdf3e 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt @@ -14,7 +14,6 @@ package de.bixilon.minosoft.gui.rendering.sky import de.bixilon.minosoft.data.mappings.ResourceLocation -import de.bixilon.minosoft.data.text.ChatColors import de.bixilon.minosoft.data.text.RGBColor import de.bixilon.minosoft.gui.rendering.RenderConstants import de.bixilon.minosoft.gui.rendering.RenderWindow @@ -50,8 +49,7 @@ class SkyRenderer( private var skySunMesh = SimpleTextureMesh() private lateinit var sunTexture: Texture private var recalculateSunNextFrame: Boolean = true - private var bottomColor = ChatColors.BLACK - private var topColor = RenderConstants.DEFAULT_SKY_COLOR + var baseColor = RenderConstants.DEFAULT_SKY_COLOR override fun init() { @@ -118,15 +116,17 @@ class SkyRenderer( skySunMesh.draw() } - fun setSkyColor(color: RGBColor) { - topColor = color - bottomColor = RGBColor(color.red * 8 / 9, color.green * 8 / 9, color.blue * 8 / 9) + private fun checkSkyColor() { + // ToDo: Calculate correct + val brightness = 1.0f + val topColor = RGBColor((baseColor.red * brightness).toInt(), (baseColor.green * brightness).toInt(), (baseColor.blue * brightness).toInt()) + val bottomColor = RGBColor(topColor.red * 8 / 9, topColor.green * 8 / 9, topColor.blue * 8 / 9) renderWindow.queue += { - updateSkyColor() + updateSkyColor(topColor, bottomColor) } } - private fun updateSkyColor() { + private fun updateSkyColor(topColor: RGBColor, bottomColor: RGBColor) { skyboxShader.use() skyboxShader.setRGBColor("uBottomColor", bottomColor) @@ -134,6 +134,7 @@ class SkyRenderer( } private fun drawSkybox() { + checkSkyColor() skyboxShader.use() skyboxMesh.draw() }