mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
removed unnecessary class Light10B, minor fixes for LightmapRenderer
Former-commit-id: 4cddfb080cc689738d9bf308f7d08852f4c78a8b Former-commit-id: 2354b2483f30e70862a327c1b9688a19bd1b2f66
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import net.torvald.CSVFetcher
|
||||
import net.torvald.colourutil.CIELabUtil.toXYZ
|
||||
import net.torvald.colourutil.CIELabUtil.toLab
|
||||
import net.torvald.colourutil.CIELabUtil.toRGB
|
||||
import net.torvald.colourutil.CIELuv
|
||||
import net.torvald.colourutil.CIELuvUtil.toRawRGB
|
||||
import net.torvald.colourutil.CIELuvUtil.toLuv
|
||||
import net.torvald.colourutil.RGB
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Graphics
|
||||
@@ -13,14 +19,22 @@ import org.newdawn.slick.state.StateBasedGame
|
||||
* Created by minjaesong on 16-09-05.
|
||||
*/
|
||||
class StateTestingSandbox : BasicGameState() {
|
||||
val colRGB = Color(0x51621D)
|
||||
val colAfter1 = colRGB.toXYZ().toRGB()
|
||||
//val colAfter2 = colRGB.toXYZ().toLab().toXYZ().toRGB()
|
||||
|
||||
override fun init(container: GameContainer?, game: StateBasedGame?) {
|
||||
println("Color:\n$colRGB")
|
||||
println("Color -> XYZ -> Color:\n$colAfter1")
|
||||
//println("Color -> XYZ -> Lab -> XYZ -> Color:\n$colAfter2")
|
||||
val records = CSVFetcher("./src/net/torvald/terrarum/tileproperties/tileprop_10bcol.csv")
|
||||
records.forEach {
|
||||
val tenOpacity = intVal(it, "opacity")
|
||||
val tenLum = intVal(it, "lumcolor")
|
||||
|
||||
val eightOpacity = tenOpacity.and(0xff) or
|
||||
tenOpacity.ushr(10).and(0xff).shl(8) or
|
||||
tenOpacity.ushr(20).and(0xff).shl(16)
|
||||
val eightLum = tenLum.and(0xff) or
|
||||
tenLum.ushr(10).and(0xff).shl(8) or
|
||||
tenLum.ushr(20).and(0xff).shl(16)
|
||||
|
||||
println("$eightOpacity\t$eightLum")
|
||||
}
|
||||
}
|
||||
|
||||
override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) {
|
||||
@@ -31,4 +45,15 @@ class StateTestingSandbox : BasicGameState() {
|
||||
|
||||
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
|
||||
}
|
||||
|
||||
private fun intVal(rec: CSVRecord, s: String): Int {
|
||||
var ret = -1
|
||||
try {
|
||||
ret = Integer.decode(rec.get(s))!!
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user