Mercurial > games > semicongine
diff semiconginev2/core/matrix.nim @ 1257:e9b8d87b9883
fix: super stupid bug in perspective matrix X(
author | sam <sam@basx.dev> |
---|---|
date | Sun, 28 Jul 2024 18:55:46 +0700 |
parents | b0f4c8ccd49a |
children |
line wrap: on
line diff
--- a/semiconginev2/core/matrix.nim Sun Jul 28 17:33:41 2024 +0700 +++ b/semiconginev2/core/matrix.nim Sun Jul 28 18:55:46 2024 +0700 @@ -444,12 +444,12 @@ makeRandomMatrixInit(TMat4) func Perspective*(fovy, aspect, zNear, zFar: float32): Mat4 = - let tanHalfFovy = tan(fovy / 2) + let tanHalfFovy = 1 / tan(fovy / 2) return Mat4(data: [ - 1 / (aspect * tanHalfFovy), 0, 0, 0, - 0, 1 / tanHalfFovy, 0, 0, + tanHalfFovy / aspect, 0, 0, 0, + 0, tanHalfFovy, 0, 0, 0, 0, zFar / (zFar - zNear), -(zFar * zNear) / (zFar - zNear), - 0, 0, 1, 1, + 0, 0, 1, 0, ]) func Ortho*(left, right, top, bottom, zNear, zFar: float32): Mat4 =