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

@@ -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)
}
}
}