new treegen

This commit is contained in:
minjaesong
2023-11-13 01:29:56 +09:00
parent 58ff7ba167
commit 05d0c5b828
7 changed files with 227 additions and 70 deletions

View File

@@ -42,7 +42,7 @@ internal object ExportMap2 : ConsoleCommand {
private fun Float.toDitherredByte(): Byte {
val byteVal = this.times(255f).roundToInt()
val error = this - byteVal
val errorInt = if (Math.random() < error.absoluteValue) 0 else (1 * error.sign).toInt()
val errorInt = if (Math.random() < (1 - error.absoluteValue)) 0 else (1 * error.sign).toInt()
return (byteVal + errorInt).coerceIn(0..255).toByte()
}