clearing up interpolation functions

This commit is contained in:
minjaesong
2023-06-30 00:14:28 +09:00
parent 07cbcbe79b
commit 6db3baf691
2 changed files with 24 additions and 19 deletions

View File

@@ -81,7 +81,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
val xperc: Double = (x - xwstart) / xw
// return FastMath.interpolateLinear(xperc.toFloat(), cameraNodes[indexThis fmod cameraNodes.size], cameraNodes[(indexThis + 1) fmod cameraNodes.size]).toDouble()
return FastMath.interpolateHermite(xperc.toFloat(),
return FastMath.interpolateCatmullRom(xperc.toFloat(),
cameraNodes[(indexThis - 1) fmod cameraNodes.size],
cameraNodes[(indexThis - 0) fmod cameraNodes.size],
cameraNodes[(indexThis + 1) fmod cameraNodes.size],
@@ -310,9 +310,9 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
drawLineOnWorld(x1.toFloat() + ww, y1.toFloat(), x2.toFloat() + ww, y2.toFloat())
}
private val baseSlopeCol = Color(0f, 1f, 1f, 1f)
private val baseSlopeCol = Color(0f, 0.9f, 0.85f, 1f)
private val firstOrderSlopeCol = Color(0f, 0.4f, 0f, 1f)
private val secondOrderSlopeCol = Color(0.6f, 0.6f, 0.0f, 1f)
private val secondOrderSlopeCol = Color(1f, 0.3f, 0.6f, 1f)
private val renderScreen = { delta: Float ->
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
@@ -361,15 +361,12 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
drawLineOnWorld(px1L, py1L, px1C, py1C)
drawLineOnWorld(px1C, py1C, px1R, py1R)
it.color = secondOrderSlopeCol
drawLineOnWorld(px2L, py2L, px2R, py2R)
it.color = baseSlopeCol
/*(1..cameraNodes.lastIndex + 16).forEach { index0 ->
val x1 = (index0 - 1) * cameraNodeWidth * TILE_SIZEF; val x2 = (index0 - 0) * cameraNodeWidth * TILE_SIZEF
val y1 = cameraNodes[(index0 - 1) fmod cameraNodes.size]; val y2 = cameraNodes[index0 fmod cameraNodes.size]
drawLineOnWorld(x1, y1, x2, y2)
}*/
it.color = baseSlopeCol
val points = (0..App.scr.width).map { x ->
val worldX = (WorldCamera.x + x).toDouble()
worldX to getPointAt(worldX)
@@ -380,6 +377,9 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
}
}
it.color = secondOrderSlopeCol
drawLineOnWorld(px2L, py2L, px2R, py2R)
}
}
}