adjust materials

This commit is contained in:
2023-08-16 16:26:05 +10:00
parent 331efe5030
commit 23eefd9408
2 changed files with 28 additions and 10 deletions

View File

@ -1,6 +1,7 @@
package gay.pizza.CavesOfJolk
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.math.MathUtils
import com.badlogic.gdx.math.Vector2
import ktx.math.div
import ktx.math.times
@ -51,3 +52,9 @@ fun Color.lighten(ld: Double): Color
val rgb = HUSLColorConverter.hsluvToRgb(hsl)
return Color(rgb[0].toFloat(), rgb[1].toFloat(), rgb[2].toFloat(), a)
}
fun Color.mix(rhs: Color, x: Float) = Color(
MathUtils.lerp(this.r, rhs.r, x),
MathUtils.lerp(this.g, rhs.g, x),
MathUtils.lerp(this.b, rhs.b, x),
MathUtils.lerp(this.a, rhs.a, x))