they call me knuckles unlike sonic i dont chuckle i just flex my knuckles
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user