sprite shift re-fixed with a correct method

This commit is contained in:
minjaesong
2017-10-14 02:13:06 +09:00
parent 367304d0bb
commit fc3fce2f82
4 changed files with 39 additions and 20 deletions

View File

@@ -459,7 +459,7 @@ object BlocksDrawer {
val for_y_start = WorldCamera.y / TILE_SIZE
val for_y_end = for_y_start + tilesBuffer.height - 1//clampHTile(for_y_start + (WorldCamera.height / TILE_SIZE) + 2)
val for_x_start = WorldCamera.x / TILE_SIZE - 1
val for_x_start = WorldCamera.x / TILE_SIZE
val for_x_end = for_x_start + tilesBuffer.width - 1//for_x_start + (WorldCamera.width / TILE_SIZE) + 3
// loop

View File

@@ -546,12 +546,12 @@ object LightmapRenderer {
// input: 0..1 for int 0..1023
fun hdr(intensity: Float): Float {
val intervalStart = (intensity * MUL).floorInt()
val intervalEnd = minOf(rgbHDRLookupTable.lastIndex, (intensity * MUL).floorInt() + 1)
val intervalStart = (intensity * CHANNEL_MAX).floorInt()
val intervalEnd = minOf(rgbHDRLookupTable.lastIndex, (intensity * CHANNEL_MAX).floorInt() + 1)
if (intervalStart == intervalEnd) return rgbHDRLookupTable[intervalStart]
val intervalPos = (intensity * MUL) - (intensity * MUL).toInt()
val intervalPos = (intensity * CHANNEL_MAX) - (intensity * CHANNEL_MAX).toInt()
return interpolateLinear(
intervalPos,

View File

@@ -37,7 +37,7 @@ object WorldCamera {
// some hacky equation to position player at the dead centre
// NOT tested for WorldDrawer sampling negative coord for its drawing (which causes some fucking artefacts)
x = ((player.hitbox.centeredX + player.hitbox.width).toFloat() - (width / 2)).floorInt() // X only: ROUNDWORLD implementation
x = ((player.hitbox.centeredX).toFloat() - (width / 2)).floorInt() // X only: ROUNDWORLD implementation
y = (FastMath.clamp(