another attempt

This commit is contained in:
minjaesong
2020-02-23 03:35:50 +09:00
parent d65305569c
commit 12b9ec3c06
2 changed files with 9 additions and 6 deletions

View File

@@ -29,6 +29,8 @@ internal class UnsafeCvecArray(val width: Int, val height: Int) {
fun setB(x: Int, y: Int, value: Float) { array.setFloat(toAddr(x, y) + 8, value) }
fun setA(x: Int, y: Int, value: Float) { array.setFloat(toAddr(x, y) + 12, value) }
fun addA(x: Int, y: Int, value: Float) { array.setFloat(toAddr(x, y) + 12, getA(x, y) + value) }
/**
* @param channel 0 for R, 1 for G, 2 for B, 3 for A
*/

View File

@@ -256,12 +256,11 @@ object LightmapRenderer {
lightsourceMap.add(LandUtil.getBlockAddr(world, x, y) to lightlevel)
}
val lx = x.convX(); val ly = y.convY()
lightmap.setR(lx, ly, lightlevel.r)
lightmap.setG(lx, ly, lightlevel.g)
lightmap.setB(lx, ly, lightlevel.b)
lightmap.setA(lx, ly, lightlevel.a)
//val lx = x.convX(); val ly = y.convY()
//lightmap.setR(lx, ly, lightlevel.r)
//lightmap.setG(lx, ly, lightlevel.g)
//lightmap.setB(lx, ly, lightlevel.b)
//lightmap.setA(lx, ly, lightlevel.a)
}
}
@@ -321,6 +320,8 @@ object LightmapRenderer {
// * Spread-every-cell idea might work as skippable cells are predictable, and they're related
// to the pos of lightsources
// * No-op masks cause some ambient ray to disappear when they're on the screen edge
// * Naive optimisation (mark-and-iterate) attempt was a disaster
// per-channel operation for bit more aggressive optimisation