diff tests/test_gltf.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 bfb75c934f4e
children 5442d0e9d8ff
line wrap: on
line diff
--- a/tests/test_gltf.nim	Sun Jul 28 17:33:41 2024 +0700
+++ b/tests/test_gltf.nim	Sun Jul 28 18:55:46 2024 +0700
@@ -138,8 +138,10 @@
     camPos += camDir * forward * dt
     camPos += camDirSide * sideward * dt
 
+    let fovH = PI / 2
+    let fovV = 2 * arctan(tan(fovH / 2) * 1 / GetAspectRatio())
     descriptors.data.camera.data.viewPerspective = (
-      Perspective(PI/3, aspect = GetAspectRatio(), zNear = 0.1, zFar = 1) *
+      Perspective(fovV, aspect = GetAspectRatio(), zNear = 0.01, zFar = 20) *
       Rotate(-camPitch, X) * Rotate(-camYaw, Y) * Translate(-camPos)
     )