aboutsummaryrefslogtreecommitdiff
path: root/vendor/libftm/inc
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-12 19:11:40 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-12 19:11:40 +0200
commit723c4602c6ec9b74e841501754e651ef359f6385 (patch)
treed6dd27c251871fb61e3fc99fe7a0a96438096f1d /vendor/libftm/inc
parent7b214503608550dc2853b9e01526723f8c65baf3 (diff)
downloadscop-723c4602c6ec9b74e841501754e651ef359f6385.tar.gz
scop-723c4602c6ec9b74e841501754e651ef359f6385.tar.bz2
scop-723c4602c6ec9b74e841501754e651ef359f6385.zip
Added perspective matrix
Diffstat (limited to 'vendor/libftm/inc')
-rw-r--r--vendor/libftm/inc/libftm_mat4.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/vendor/libftm/inc/libftm_mat4.h b/vendor/libftm/inc/libftm_mat4.h
index f69d7e6..5fc183b 100644
--- a/vendor/libftm/inc/libftm_mat4.h
+++ b/vendor/libftm/inc/libftm_mat4.h
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/12 11:04:59 by charles #+# #+# */
-/* Updated: 2020/05/12 13:53:40 by charles ### ########.fr */
+/* Updated: 2020/05/12 17:21:34 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,8 +22,33 @@ typedef struct
float m[4 * 4];
} t_ftmmat4;
+/*
+** http://www.songho.ca/opengl/gl_projectionmatrix.html
+*/
+
+typedef struct
+{
+ float near;
+ float far;
+ float left;
+ float right;
+ float top;
+ float bottom;
+} t_ftmfrustum;
+
+typedef struct
+{
+ float near;
+ float far;
+ float width;
+ float height;
+} t_ftmfrustum_sym;
+
t_ftmmat4 *ftm_mat4init_eye(t_ftmmat4 *mat4, float x);
t_ftmmat4 *ftm_mat4init_fill(t_ftmmat4 *mat4, float x);
+t_ftmmat4 *ftm_mat4init_frustum(t_ftmmat4 *mat4, t_ftmfrustum *frustum);
+t_ftmmat4 *ftm_mat4init_frustum_sym(t_ftmmat4 *mat4, t_ftmfrustum_sym *frustum);
+t_ftmmat4 *ftm_mat4init_perspective(t_ftmmat4 *mat4, float fov, float aspect_ratio, float near, float far);
t_ftmmat4 *ftm_mat4translate(t_ftmmat4 *mat4, float x, float y, float z);
t_ftmmat4 *ftm_mat4rotate(t_ftmmat4 *mat4, float radian, t_ftmvec3 *axis);
t_ftmmat4 *ftm_mat4scale(t_ftmmat4 *mat4, float x, float y, float z);