mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 04:15:14 -04:00
weather overlay: config, fix sunset intensity
This commit is contained in:
parent
2bebd937d0
commit
099174c95c
@ -15,6 +15,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
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.overlay.weather.WeatherC
|
||||
|
||||
class OverlayC {
|
||||
/**
|
||||
@ -33,4 +34,5 @@ class OverlayC {
|
||||
var worldBorder by delegate(true)
|
||||
|
||||
val fire = FireC()
|
||||
val weather = WeatherC()
|
||||
}
|
||||
|
@ -31,12 +31,16 @@ import java.util.*
|
||||
|
||||
class WeatherOverlay(private val renderWindow: RenderWindow, private val z: Float) : Overlay {
|
||||
private val world = renderWindow.connection.world
|
||||
private val config = renderWindow.connection.profiles.rendering.overlay
|
||||
private val config = renderWindow.connection.profiles.rendering.overlay.weather
|
||||
private val rain = renderWindow.textureManager.staticTextures.createTexture(RAIN)
|
||||
private val snow = renderWindow.textureManager.staticTextures.createTexture(SNOW)
|
||||
private val precipitation get() = renderWindow.connection.player.positionInfo.biome?.precipitation ?: BiomePrecipitation.NONE
|
||||
override val render: Boolean
|
||||
get() = world.weather.raining && precipitation != BiomePrecipitation.NONE // ToDo: Check if exposed to the sky
|
||||
get() = world.weather.raining && when (precipitation) { // ToDo: Check if exposed to the sky
|
||||
BiomePrecipitation.NONE -> false
|
||||
BiomePrecipitation.RAIN -> config.rain
|
||||
BiomePrecipitation.SNOW -> config.snow
|
||||
}
|
||||
private val texture: AbstractTexture?
|
||||
get() = when (precipitation) {
|
||||
BiomePrecipitation.NONE -> null
|
||||
@ -93,10 +97,8 @@ class WeatherOverlay(private val renderWindow: RenderWindow, private val z: Floa
|
||||
private fun updateShader() {
|
||||
shader.setFloat("uIntensity", world.weather.rain)
|
||||
val offset = (millis() % 500L) / 500.0f
|
||||
println("Offset: $offset")
|
||||
shader.setFloat("uOffset", -offset)
|
||||
shader.setUInt("uIndexLayer", texture!!.shaderId)
|
||||
// shader.setVec2("uMaxUV", texture!!.textureArrayUV)
|
||||
}
|
||||
|
||||
override fun draw() {
|
||||
|
@ -272,7 +272,7 @@ class SkyboxRenderer(
|
||||
val delta = (abs(progress - 0.5f) * 2.0f)
|
||||
val sine = maxOf(sin(delta.pow(3) * PI.toFloat() / 2.0f), 0.4f)
|
||||
|
||||
color = interpolateLinear(sine * intensity, SUNSET_BASE_COLOR, color)
|
||||
color = interpolateLinear(sine, SUNSET_BASE_COLOR, color)
|
||||
color = interpolateLinear(intensity, baseColor, color)
|
||||
|
||||
return color
|
||||
|
Loading…
x
Reference in New Issue
Block a user