mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 05:41:51 +09:00
another attempt
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user