mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
update
This commit is contained in:
@@ -633,14 +633,10 @@ object LightmapRenderer {
|
|||||||
|
|
||||||
distFromLightSrc.add(1)
|
distFromLightSrc.add(1)
|
||||||
|
|
||||||
if (_mapLightLevelThis.getR(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getR(swipeX, swipeY))
|
if (_mapLightLevelThis.getR(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getR(swipeX, swipeY)) distFromLightSrc.r = 0
|
||||||
distFromLightSrc[0] = 0
|
if (_mapLightLevelThis.getG(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getG(swipeX, swipeY)) distFromLightSrc.g = 0
|
||||||
if (_mapLightLevelThis.getG(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getG(swipeX, swipeY))
|
if (_mapLightLevelThis.getB(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getB(swipeX, swipeY)) distFromLightSrc.b = 0
|
||||||
distFromLightSrc[0] = 0
|
if (_mapLightLevelThis.getA(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getA(swipeX, swipeY)) distFromLightSrc.a = 0
|
||||||
if (_mapLightLevelThis.getB(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getB(swipeX, swipeY))
|
|
||||||
distFromLightSrc[0] = 0
|
|
||||||
if (_mapLightLevelThis.getA(swipeX - dx, swipeY - dy) < _mapLightLevelThis.getA(swipeX, swipeY))
|
|
||||||
distFromLightSrc[0] = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
swipeX = ex; swipeY = ey
|
swipeX = ex; swipeY = ey
|
||||||
@@ -655,14 +651,10 @@ object LightmapRenderer {
|
|||||||
|
|
||||||
distFromLightSrc.add(1)
|
distFromLightSrc.add(1)
|
||||||
|
|
||||||
if (_mapLightLevelThis.getR(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getR(swipeX, swipeY))
|
if (_mapLightLevelThis.getR(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getR(swipeX, swipeY)) distFromLightSrc.r = 0
|
||||||
distFromLightSrc[0] = 0
|
if (_mapLightLevelThis.getG(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getG(swipeX, swipeY)) distFromLightSrc.g = 0
|
||||||
if (_mapLightLevelThis.getG(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getG(swipeX, swipeY))
|
if (_mapLightLevelThis.getB(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getB(swipeX, swipeY)) distFromLightSrc.b = 0
|
||||||
distFromLightSrc[0] = 0
|
if (_mapLightLevelThis.getA(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getA(swipeX, swipeY)) distFromLightSrc.a = 0
|
||||||
if (_mapLightLevelThis.getB(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getB(swipeX, swipeY))
|
|
||||||
distFromLightSrc[0] = 0
|
|
||||||
if (_mapLightLevelThis.getA(swipeX + dx, swipeY + dy) < _mapLightLevelThis.getA(swipeX, swipeY))
|
|
||||||
distFromLightSrc[0] = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,24 +665,26 @@ object LightmapRenderer {
|
|||||||
return if (BlockCodex[world.getTileFromTerrain(x, y)].isSolid) 1.2f else 1f
|
return if (BlockCodex[world.getTileFromTerrain(x, y)].isSolid) 1.2f else 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline class Ivec4(val i: IntArray = intArrayOf(0,0,0,0)) {
|
private class Ivec4 {
|
||||||
|
|
||||||
|
var r = 0
|
||||||
|
var g = 0
|
||||||
|
var b = 0
|
||||||
|
var a = 0
|
||||||
|
|
||||||
fun broadcast(scalar: Int) {
|
fun broadcast(scalar: Int) {
|
||||||
i[0]=scalar
|
r=scalar
|
||||||
i[1]=scalar
|
g=scalar
|
||||||
i[2]=scalar
|
b=scalar
|
||||||
i[3]=scalar
|
a=scalar
|
||||||
}
|
}
|
||||||
fun add(scalar: Int) {
|
fun add(scalar: Int) {
|
||||||
i[0]+=scalar
|
r+=scalar
|
||||||
i[1]+=scalar
|
g+=scalar
|
||||||
i[2]+=scalar
|
b+=scalar
|
||||||
i[3]+=scalar
|
a+=scalar
|
||||||
}
|
}
|
||||||
|
|
||||||
operator fun get(index: Int) = i[index]
|
|
||||||
operator fun set(index: Int, value: Int) {
|
|
||||||
i[index] = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var lightBuffer: Pixmap = Pixmap(64, 64, Pixmap.Format.RGBA8888) // must not be too small
|
var lightBuffer: Pixmap = Pixmap(64, 64, Pixmap.Format.RGBA8888) // must not be too small
|
||||||
|
|||||||
Reference in New Issue
Block a user