fogleman / Craft

A simple Minecraft clone written in C using modern OpenGL (shaders).
http://www.michaelfogleman.com/craft/
MIT License
10.39k stars 1.39k forks source link

Matrix.h conversion from degrees to radians #237

Open mmhanson opened 4 years ago

mmhanson commented 4 years ago

I'm reading through this project to help with my own OpenGL project and I noticed line 180 of matrix.c:

ymax = znear * tanf(fov * PI / 360.0);

Is fov in degrees? If so the correct way to convert it to radians would be:

ymax = znear * tanf(fov * PI / 180.0);

jtlehtinen commented 2 years ago

Yes, FOV is in degrees. The argument passed to tanf is half of the FOV.