aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvech <jmvalenciae@unal.edu.co>2022-08-30 10:53:15 -0500
committerjvech <jmvalenciae@unal.edu.co>2022-08-30 10:53:15 -0500
commit17b5c7278cf51f767ad1f2823b0c92841b5a4918 (patch)
tree077dcbfd6589de908510e5666c790ca1b39407be
parent1e677d8532d0832537112db9429e7ecdcff53215 (diff)
fix: pespective transformation minor bug fixed
now is possible to show use a FoV greater than 90 degrees
-rw-r--r--src/linear.c6
1 files 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;
Feel free to download, copy and edit any repo