mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 21:21:34 +00:00
break up gameplay stuff
This commit is contained in:
@ -68,20 +68,20 @@ public extension simd_float4x4 {
|
||||
let x = 2 * invWidth, y = 2 * invHeight, z = invDepth
|
||||
|
||||
return .init(
|
||||
.init( x, 0, 0, 0),
|
||||
.init( 0, y, 0, 0),
|
||||
.init( 0, 0, z, 0),
|
||||
.init(tx, ty, tz, 1))
|
||||
.init( x, 0, 0, 0),
|
||||
.init( 0, y, 0, 0),
|
||||
.init( 0, 0, z, 0),
|
||||
.init(tx, ty, tz, 1))
|
||||
}
|
||||
|
||||
static func perspective(verticalFov fovY: T, aspect: T, near: T, far: T) -> Self {
|
||||
static func perspective(verticalFov fovY: T, aspect: T, near zNear: T, far zFar: T) -> Self {
|
||||
let tanHalfFovY = tan(fovY * T(0.5))
|
||||
let invClipRange = 1 / (near - far)
|
||||
let invClipRange = 1 / (zNear - zFar)
|
||||
|
||||
let y = 1 / tanHalfFovY
|
||||
let x = y / aspect
|
||||
let z = far * invClipRange
|
||||
let w = near * z // (far * near) * invClipRange
|
||||
let z = zFar * invClipRange
|
||||
let w = zNear * z
|
||||
return .init(
|
||||
.init(x, 0, 0, 0),
|
||||
.init(0, y, 0, 0),
|
||||
@ -89,3 +89,7 @@ public extension simd_float4x4 {
|
||||
.init(0, 0, w, 0))
|
||||
}
|
||||
}
|
||||
|
||||
extension simd_quatf {
|
||||
static var identity: Self { .init(real: 1, imag: .zero) }
|
||||
}
|
||||
|
Reference in New Issue
Block a user