oops forgot about the alpha channel

This commit is contained in:
minjaesong
2023-07-25 16:57:13 +09:00
parent 987ec1fd98
commit ad601ffd7e
2 changed files with 14 additions and 4 deletions

View File

@@ -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

View File

@@ -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]!!