added some new params to Particle

This commit is contained in:
2024-11-30 00:05:31 +01:00
parent 939867934b
commit be00598efe
8 changed files with 192 additions and 175 deletions
@@ -170,18 +170,9 @@ fun lerp(x: Float, y: Float, t: Float) : Float {
}
fun interpolateCurve(start: Vector3f, end: Vector3f, t: Float, curve: LerpCurves): Vector3f {
val clampedT = t.coerceIn(0.0f, 1.0f)
val curvedT = curve.function(clampedT)
val interpolatedVec = Vector3f(
lerp(start.x, end.x, curvedT),
lerp(start.y, end.y, curvedT),
lerp(start.z, end.z, curvedT)
)
return interpolatedVec
fun lerpArray(array: Array<Any>, t: Float, curve: LerpCurves = LerpCurves.Linear) : Any {
val idx = round(lerp(0.0f, array.lastIndex.toFloat(), t) * curve.function(t)).toInt()
return array[idx]
}