From ad601ffd7e714d579af71e8bd3f72e1fc76bcdef Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 25 Jul 2023 16:57:13 +0900 Subject: [PATCH] oops forgot about the alpha channel --- src/net/torvald/gdx/graphics/Cvec.kt | 7 +++++++ src/net/torvald/terrarum/weather/WeatherMixer.kt | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/net/torvald/gdx/graphics/Cvec.kt b/src/net/torvald/gdx/graphics/Cvec.kt index 399729795..d4e55de8c 100644 --- a/src/net/torvald/gdx/graphics/Cvec.kt +++ b/src/net/torvald/gdx/graphics/Cvec.kt @@ -55,6 +55,13 @@ class Cvec { this.a = color.a } + constructor(rgb: Color, alpha: Float) { + this.r = rgb.r + this.g = rgb.g + this.b = rgb.b + this.a = alpha + } + /** Constructor, sets the components of the color * * @param r the red component diff --git a/src/net/torvald/terrarum/weather/WeatherMixer.kt b/src/net/torvald/terrarum/weather/WeatherMixer.kt index ddd171709..28e04b46a 100644 --- a/src/net/torvald/terrarum/weather/WeatherMixer.kt +++ b/src/net/torvald/terrarum/weather/WeatherMixer.kt @@ -282,16 +282,19 @@ internal object WeatherMixer : RNGConsumer { else { pNx = pSx - 1; pNy = 1 } } - val colourThis = colorMap.get(pSx, pSy) - val colourNext = colorMap.get(pNx, pNy) + val colourThisRGB = colorMap.get(pSx, pSy) + val colourNextRGB = colorMap.get(pNx, pNy) + val colourThisUV = colorMap.get(pSx, pSy + 2) + val colourNextUV = colorMap.get(pNx, pNy + 2) // interpolate R, G, B and A var scale = (pNowRaw - pStartRaw).toFloat() if (timeOfDay >= HALF_DAY) scale = 1f - scale - val newCol = colourThis.cpy().lerp(colourNext, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) + val newColRGB = colourThisRGB.cpy().lerp(colourNextRGB, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) + val newColUV = colourThisUV.cpy().lerp(colourNextUV, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) - return Cvec(newCol) + return Cvec(newColRGB, newColUV.r) } fun getWeatherList(classification: String) = weatherList[classification]!!