From 17b5c7278cf51f767ad1f2823b0c92841b5a4918 Mon Sep 17 00:00:00 2001 From: jvech Date: Tue, 30 Aug 2022 10:53:15 -0500 Subject: fix: pespective transformation minor bug fixed now is possible to show use a FoV greater than 90 degrees --- src/linear.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/linear.c b/src/linear.c index c38c297..8bd58e8 100644 --- a/src/linear.c +++ b/src/linear.c @@ -35,9 +35,9 @@ Mat4 linearPerspective(float FoV, float ratio, float near, float far) { Mat4 out = linearMat4Fill(0.0); - float FoV_radians = FoV * M_PI / 180; - float width = near * tanf(FoV_radians) * ratio; - float height = near * tanf(FoV_radians); + float FoV_radians = FoV * M_PI / 180 / 2; + float width = 2 * near * tanf(FoV_radians) * ratio; + float height = 2 * near * tanf(FoV_radians); out.matrix[0][0] = near / width; out.matrix[1][1] = near / height; -- cgit v1.2.3-70-g09d2