mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
turns out actors still have the camera artefacts...
This commit is contained in:
@@ -128,7 +128,7 @@ class SpriteAnimation(@Transient val parentActor: ActorWithBody) {
|
|||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
val region = textureRegion.get(currentFrame, currentRow)
|
val region = textureRegion.get(currentFrame, currentRow)
|
||||||
batch.color = colorFilter
|
// batch.color = colorFilter
|
||||||
|
|
||||||
//val scale = parentActor.scale.toFloat() // wtf?
|
//val scale = parentActor.scale.toFloat() // wtf?
|
||||||
|
|
||||||
|
|||||||
@@ -1620,12 +1620,14 @@ open class ActorWithBody : Actor {
|
|||||||
val leftsidePadding = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1)
|
val leftsidePadding = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1)
|
||||||
val rightsidePadding = WorldCamera.width.ushr(1)
|
val rightsidePadding = WorldCamera.width.ushr(1)
|
||||||
|
|
||||||
|
val offendingPad = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1)
|
||||||
|
|
||||||
val offsetX = hitboxTranslateX * scale
|
val offsetX = hitboxTranslateX * scale
|
||||||
val offsetY = sprite.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1
|
val offsetY = sprite.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1
|
||||||
|
|
||||||
// it would be great if you can eliminate the try-catch because it may hurt the performance when there's too many actors on screen to draw
|
// it would be great if you can eliminate the try-catch because it may hurt the performance when there's too many actors on screen to draw
|
||||||
// try {
|
// try {
|
||||||
if (Math.abs(WorldCamera.x - hitbox.startX) > App.scr.halfw) {
|
/*if (Math.abs(WorldCamera.x - hitbox.startX) > App.scr.halfw) {
|
||||||
sprite.render(batch,
|
sprite.render(batch,
|
||||||
(hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZEF,
|
(hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZEF,
|
||||||
(hitbox.startY - offsetY).toFloat(),
|
(hitbox.startY - offsetY).toFloat(),
|
||||||
@@ -1638,7 +1640,30 @@ open class ActorWithBody : Actor {
|
|||||||
(hitbox.startY - offsetY).toFloat(),
|
(hitbox.startY - offsetY).toFloat(),
|
||||||
(scale).toFloat()
|
(scale).toFloat()
|
||||||
)
|
)
|
||||||
}
|
}*/
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
sprite.render(batch,
|
||||||
|
(hitbox.startX - offsetX).toFloat(),
|
||||||
|
(hitbox.startY - offsetY).toFloat(),
|
||||||
|
(scale).toFloat()
|
||||||
|
)
|
||||||
|
|
||||||
|
batch.color = Color.BLUE
|
||||||
|
sprite.render(batch,
|
||||||
|
(hitbox.startX - offsetX).toFloat() - world!!.width * TILE_SIZEF,
|
||||||
|
(hitbox.startY - offsetY).toFloat(),
|
||||||
|
(scale).toFloat()
|
||||||
|
)
|
||||||
|
|
||||||
|
batch.color = Color.GREEN
|
||||||
|
sprite.render(batch,
|
||||||
|
(hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZEF,
|
||||||
|
(hitbox.startY - offsetY).toFloat(),
|
||||||
|
(scale).toFloat()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// catch (e: UninitializedPropertyAccessException) {
|
// catch (e: UninitializedPropertyAccessException) {
|
||||||
// printdbgerr(this, this.javaClass.simpleName)
|
// printdbgerr(this, this.javaClass.simpleName)
|
||||||
@@ -1681,10 +1706,10 @@ open class ActorWithBody : Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun clampWtile(x: Int): Int =
|
private fun clampWtile(x: Int): Int =
|
||||||
if (x < 0) 0 else if (x >= world?.width ?: 0) (world?.width ?: 0) - 1 else x
|
if (x < 0) 0 else if (x >= (world?.width ?: 0)) (world?.width ?: 0) - 1 else x
|
||||||
|
|
||||||
private fun clampHtile(x: Int): Int =
|
private fun clampHtile(x: Int): Int =
|
||||||
if (x < 0) 0 else if (x >= world?.height ?: 0) (world?.height ?: 0) - 1 else x
|
if (x < 0) 0 else if (x >= (world?.height ?: 0)) (world?.height ?: 0) - 1 else x
|
||||||
|
|
||||||
|
|
||||||
var isNoClip: Boolean = false
|
var isNoClip: Boolean = false
|
||||||
|
|||||||
@@ -572,6 +572,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var worldWidth: Double = 0.0
|
private var worldWidth: Double = 0.0
|
||||||
|
private var oldCamX = 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ingame (world) related updates; UI update must go to renderGame()
|
* Ingame (world) related updates; UI update must go to renderGame()
|
||||||
@@ -633,13 +634,17 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
BlockStats.update()
|
BlockStats.update()
|
||||||
}
|
}
|
||||||
// fill up visibleActorsRenderFront for wires, if:
|
// fill up visibleActorsRenderFront for wires, if:
|
||||||
// 1. something is cued on the wire change queue
|
// 0. Camera wrapped
|
||||||
// 2. wire renderclass changed
|
// 1. new world has been loaded
|
||||||
if (newWorldLoadedLatch || wireChangeQueue.isNotEmpty() || selectedWireRenderClass != oldSelectedWireRenderClass) {
|
// 2. something is cued on the wire change queue
|
||||||
|
// 3. wire renderclass changed
|
||||||
|
if (Math.abs(WorldCamera.x - oldCamX) >= worldWidth * 0.85 ||
|
||||||
|
newWorldLoadedLatch || wireChangeQueue.isNotEmpty() || selectedWireRenderClass != oldSelectedWireRenderClass) {
|
||||||
measureDebugTime("Ingame.FillUpWiresBuffer") {
|
measureDebugTime("Ingame.FillUpWiresBuffer") {
|
||||||
fillUpWiresBuffer()
|
fillUpWiresBuffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
oldCamX = WorldCamera.x
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user