diff --git a/src/net/torvald/colourutil/CIELabUtil.kt b/src/net/torvald/colourutil/CIELabUtil.kt index f27359c6e..2ce79b7f5 100644 --- a/src/net/torvald/colourutil/CIELabUtil.kt +++ b/src/net/torvald/colourutil/CIELabUtil.kt @@ -40,7 +40,7 @@ object CIELabUtil { return lab.toColor() } - /** Sweet Lab linear gradient */ + /** Tend to have more natural (or less saturated) colour */ fun getGradient(scale: Float, fromCol: Color, toCol: Color): Color { val from = fromCol.toLab() val to = toCol.toLab() @@ -92,9 +92,9 @@ fun RGB.toLab() = this.toXYZ().toLab() fun CIELab.toColor() = this.toXYZ().toColor() fun CIELab.toRGB() = this.toXYZ().toRGB() -internal val D65 = CIEXYZ(0.95047f, 1f, 1.08883f) -val epsilon = 216f/24389f -val kappa = 24389f/27f +internal val D65 = CIEXYZ(0.95047f, 1f, 1.08883f) // D50 in this case will make the colour excessively blue, dunno why tho +const val epsilon = 216f/24389f +const val kappa = 24389f/27f /** * Range: diff --git a/src/net/torvald/colourutil/CIELuvUtil.kt b/src/net/torvald/colourutil/CIELuvUtil.kt index a49def34a..768a28634 100644 --- a/src/net/torvald/colourutil/CIELuvUtil.kt +++ b/src/net/torvald/colourutil/CIELuvUtil.kt @@ -37,6 +37,18 @@ object CIELuvUtil { return luv.toColor() } + /** Tend to have more vivid (or saturated) colour */ + fun getGradient(scale: Float, fromCol: Color, toCol: Color): Color { + val from = fromCol.toLuv() + val to = toCol.toLuv() + val newL = FastMath.interpolateLinear(scale, from.L, to.L) + val newU = FastMath.interpolateLinear(scale, from.u, to.u) + val newV = FastMath.interpolateLinear(scale, from.v, to.v) + val newAlpha = FastMath.interpolateLinear(scale, from.alpha, to.alpha) + + return CIELab(newL, newU, newV, newAlpha).toColor() + } + /** * Alpha value will be overwritten to 1.0 */ diff --git a/src/net/torvald/colourutil/CIEXYZUtil.kt b/src/net/torvald/colourutil/CIEXYZUtil.kt index 16e7fa23e..33e19155d 100644 --- a/src/net/torvald/colourutil/CIEXYZUtil.kt +++ b/src/net/torvald/colourutil/CIEXYZUtil.kt @@ -23,7 +23,7 @@ object CIEXYZUtil { return xyz.toColor() } - @Deprecated("Use one in CIELAB or CIELUV; CIEXYZ is not perceptually uniform") + /*@Deprecated("Use one in CIELAB or CIELUV; CIEXYZ is not perceptually uniform") fun getGradient(scale: Float, fromCol: Color, toCol: Color): Color { val from = fromCol.toXYZ() val to = toCol.toXYZ() @@ -33,7 +33,7 @@ object CIEXYZUtil { val newAlpha = FastMath.interpolateLinear(scale, from.alpha, to.alpha) return CIEXYZ(newX, newY, newZ, newAlpha).toColor() - } + }*/ fun Color.toXYZ(): CIEXYZ = RGB(this).toXYZ() diff --git a/src/net/torvald/terrarum/ui/ConsoleWindow.kt b/src/net/torvald/terrarum/ui/ConsoleWindow.kt index f5796827b..5652ef4b4 100644 --- a/src/net/torvald/terrarum/ui/ConsoleWindow.kt +++ b/src/net/torvald/terrarum/ui/ConsoleWindow.kt @@ -125,8 +125,6 @@ class ConsoleWindow : UICanvas() { val acceptedChars = "1234567890-=qwfpgjluy;[]\\arstdhneio'zxcvbkm,./!@#$%^&*()_+QWFPGJLUY:{}|ARSTDHNEIO\"ZXCVBKM<>? ".toSet() override fun keyTyped(character: Char): Boolean { - println("[ConsoleWindow] Key typed event; isVisible = $isVisible") - if (character in acceptedChars) { commandInputPool!!.append(character) inputCursorPos += 1 diff --git a/src/net/torvald/terrarum/weather/WeatherMixer.kt b/src/net/torvald/terrarum/weather/WeatherMixer.kt index 8affcf1a2..f3cd73876 100644 --- a/src/net/torvald/terrarum/weather/WeatherMixer.kt +++ b/src/net/torvald/terrarum/weather/WeatherMixer.kt @@ -168,7 +168,7 @@ object WeatherMixer { // interpolate R, G, B and A val scale = (timeInSec % dataPointDistance).toFloat() / dataPointDistance // [0.0, 1.0] - val newCol = CIELabUtil.getGradient(scale, colourThis, colourNext) + val newCol = CIELuvUtil.getGradient(scale, colourThis, colourNext) /* // very nice monitor code // 65 -> 66 | 300 | 19623 | RGB8(255, 0, 255) -[41%]-> RGB8(193, 97, 23) | * `230`40`160` diff --git a/work_files/esdf_masterrace.psd b/work_files/esdf_masterrace.psd new file mode 100644 index 000000000..fbddcf98d --- /dev/null +++ b/work_files/esdf_masterrace.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c79a0f7c492f1fcbd3a082df85fdfde2bd54d5f4e5f9e73e17ed231027725ac +size 92528