mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
fixed a bug where colourmap won't interpolate properly. BUG: fadeout/fadein is somewhat glitched, UIQuickBar does not fade-in/out instead it just (dis)appears with no effect
Former-commit-id: 029f504b7e2e4d85676ec8b36b27dcbed5e5db47 Former-commit-id: 0b56ca1e8976bfc5e7ea8d665e6ed6496a52de85
This commit is contained in:
18
src/net/torvald/colourutil/ColourTemp.kt
Normal file
18
src/net/torvald/colourutil/ColourTemp.kt
Normal file
@@ -0,0 +1,18 @@
|
||||
package net.torvald.colourutil
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.Image
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-07-26.
|
||||
*/
|
||||
object ColourTemp {
|
||||
private var envOverlayColourmap = Image("./res/graphics/colourmap/black_body_col_1000_40000_K.png")
|
||||
|
||||
private fun colTempToImagePos(K: Int): Int {
|
||||
if (K < 1000 || K >= 40000) throw IllegalArgumentException("K: out of range. ($K)")
|
||||
return (K - 1000) / 10
|
||||
}
|
||||
|
||||
operator fun invoke(temp: Int): Color = envOverlayColourmap.getColor(colTempToImagePos(temp), 0)
|
||||
}
|
||||
10
src/net/torvald/colourutil/ColourUtil.kt
Normal file
10
src/net/torvald/colourutil/ColourUtil.kt
Normal file
@@ -0,0 +1,10 @@
|
||||
package net.torvald.colourutil
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-07-26.
|
||||
*/
|
||||
object ColourUtil {
|
||||
fun toSlickColor(r: Int, g: Int, b: Int) = Color(r.shl(16) or g.shl(8) or b)
|
||||
}
|
||||
Reference in New Issue
Block a user