diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-12 19:11:40 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-12 19:11:40 +0200 |
| commit | 723c4602c6ec9b74e841501754e651ef359f6385 (patch) | |
| tree | d6dd27c251871fb61e3fc99fe7a0a96438096f1d /vendor/libftm/src/mat4/ftm_mat4init_perspective.c | |
| parent | 7b214503608550dc2853b9e01526723f8c65baf3 (diff) | |
| download | scop-723c4602c6ec9b74e841501754e651ef359f6385.tar.gz scop-723c4602c6ec9b74e841501754e651ef359f6385.tar.bz2 scop-723c4602c6ec9b74e841501754e651ef359f6385.zip | |
Added perspective matrix
Diffstat (limited to 'vendor/libftm/src/mat4/ftm_mat4init_perspective.c')
| -rw-r--r-- | vendor/libftm/src/mat4/ftm_mat4init_perspective.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/libftm/src/mat4/ftm_mat4init_perspective.c b/vendor/libftm/src/mat4/ftm_mat4init_perspective.c new file mode 100644 index 0000000..f04b39e --- /dev/null +++ b/vendor/libftm/src/mat4/ftm_mat4init_perspective.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ftm_mat4init_perspective.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/05/12 16:54:49 by charles #+# #+# */ +/* Updated: 2020/05/12 19:07:45 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libftm_mat4.h" + +t_ftmmat4 *ftm_mat4init_perspective(t_ftmmat4 *mat4, float fov, float aspect_ratio, + float near, float far) +{ + t_ftmfrustum_sym frustum; + + frustum.near = near; + frustum.far = far; + frustum.width = 2.0 * (near / tanf(M_PI_2 - (fov / 2.0))); + frustum.height = frustum.width / aspect_ratio; + return (ftm_mat4init_frustum_sym(mat4, &frustum)); +} |
