mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
lanternmap will blend when multiple blocks occupy the same block
This commit is contained in:
@@ -53,8 +53,8 @@ object WriteSavegame {
|
|||||||
val w = 960
|
val w = 960
|
||||||
val h = 640
|
val h = 640
|
||||||
|
|
||||||
val cx = WorldCamera.x % 2
|
val cx = (1 - WorldCamera.x % 2)
|
||||||
val cy = WorldCamera.y % 2
|
val cy = (1 - WorldCamera.y % 2)
|
||||||
|
|
||||||
val x = (fb.width - w) - cx // force the even-numbered position
|
val x = (fb.width - w) - cx // force the even-numbered position
|
||||||
val y = (fb.height - h) - cy // force the even-numbered position
|
val y = (fb.height - h) - cy // force the even-numbered position
|
||||||
|
|||||||
@@ -341,9 +341,10 @@ object LightmapRenderer {
|
|||||||
for (x in lightBoxX.div(TILE_SIZE).floorInt()
|
for (x in lightBoxX.div(TILE_SIZE).floorInt()
|
||||||
..lightBoxX.plus(lightBoxW).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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user