lanternmap will blend when multiple blocks occupy the same block

This commit is contained in:
minjaesong
2022-01-28 11:31:34 +09:00
parent ff400d1e2f
commit fe5a4bcfb0
2 changed files with 5 additions and 4 deletions

View File

@@ -53,8 +53,8 @@ object WriteSavegame {
val w = 960
val h = 640
val cx = WorldCamera.x % 2
val cy = WorldCamera.y % 2
val cx = (1 - WorldCamera.x % 2)
val cy = (1 - WorldCamera.y % 2)
val x = (fb.width - w) - cx // force the even-numbered position
val y = (fb.height - h) - cy // force the even-numbered position

View File

@@ -341,9 +341,10 @@ object LightmapRenderer {
for (x in lightBoxX.div(TILE_SIZE).floorInt()
..lightBoxX.plus(lightBoxW).div(TILE_SIZE).floorInt()) {
val normalisedCvec = it.color//.cpy().mul(DIV_FLOAT)
val oldLight = lanternMap[LandUtil.getBlockAddr(world, x, y)] ?: Cvec(0) // if two or more luminous actors share the same block, mix the light
val actorLight = it.color
lanternMap[LandUtil.getBlockAddr(world, x, y)] = normalisedCvec
lanternMap[LandUtil.getBlockAddr(world, x, y)] = oldLight.maxAndAssign(actorLight)
}
}
}