they call me knuckles unlike sonic i dont chuckle i just flex my knuckles

This commit is contained in:
2023-08-20 06:09:48 +10:00
parent e031523ed1
commit 22be9bbe00
4 changed files with 22 additions and 17 deletions

View File

@ -3,9 +3,7 @@ package gay.pizza.CavesOfJolk
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g3d.Attribute
import com.badlogic.gdx.graphics.g3d.Attributes
import com.badlogic.gdx.math.MathUtils
import com.badlogic.gdx.math.Vector2
import com.badlogic.gdx.math.Vector3
import com.badlogic.gdx.math.*
import ktx.math.div
import ktx.math.times
import ktx.math.unaryMinus
@ -75,3 +73,17 @@ fun Color.mix(rhs: Color, x: Float) = Color(
fun <T: Attribute> Attributes.get(type: Long) = get(type) as? T
fun Random.nextFloat(min: Float, max: Float) = min + nextFloat() * (max - min)
fun RandomXS128.nextQuaternion(): Quaternion
{
var x: Float
var y: Float
var z: Float
do { x = nextFloat(-1.0f, 1.0f); y = nextFloat(-1.0f, 1.0f); z = x * x + y * y } while (z > 1.0f)
var u: Float
var v: Float
var w: Float
do { u = nextFloat(-1.0f, 1.0f); v = nextFloat(-1.0f, 1.0f); w = u * u + v * v } while (w > 1.0f)
val s = kotlin.math.sqrt((1.0f - z) / w)
return Quaternion(x, y, s * u, s * v)
}