diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-14 19:09:39 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-14 19:09:39 +0200 |
| commit | f6de2b1453930267015ab9323d5f83daa25667ba (patch) | |
| tree | 5ff586948f7ffe257f8f46919f01bd99c1ffb82a /vendor/libftm | |
| parent | 23ba151d95e4284ddb2d5f1c9810741061c293fd (diff) | |
| download | scop-f6de2b1453930267015ab9323d5f83daa25667ba.tar.gz scop-f6de2b1453930267015ab9323d5f83daa25667ba.tar.bz2 scop-f6de2b1453930267015ab9323d5f83daa25667ba.zip | |
Added ugly Cylindric UV mapping, texture/color transition
Diffstat (limited to 'vendor/libftm')
| -rw-r--r-- | vendor/libftm/inc/libftm_mat4.h | 13 | ||||
| -rw-r--r-- | vendor/libftm/inc/libftm_vec3.h | 21 | ||||
| -rw-r--r-- | vendor/libftm/src/vec3/ftm_vec3norm.c | 18 | ||||
| -rw-r--r-- | vendor/libftm/src/vec3/ftm_vec3normalize.c | 24 |
4 files changed, 62 insertions, 14 deletions
diff --git a/vendor/libftm/inc/libftm_mat4.h b/vendor/libftm/inc/libftm_mat4.h index 5fc183b..16e1c61 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 17:21:34 by charles ### ########.fr */ +/* Updated: 2020/05/14 16:46:03 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -47,8 +47,14 @@ typedef struct 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_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); @@ -56,5 +62,4 @@ t_ftmmat4 *ftm_mat4mul(t_ftmmat4 *dst, t_ftmmat4 *other); t_ftmmat4 *ftm_mat4set(t_ftmmat4 *mat4, size_t y, size_t x, float value); float ftm_mat4get(t_ftmmat4 *mat4, size_t y, size_t x); - #endif diff --git a/vendor/libftm/inc/libftm_vec3.h b/vendor/libftm/inc/libftm_vec3.h index c40d6c8..62a6dac 100644 --- a/vendor/libftm/inc/libftm_vec3.h +++ b/vendor/libftm/inc/libftm_vec3.h @@ -6,27 +6,28 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/05/12 11:02:29 by charles #+# #+# */ -/* Updated: 2020/05/13 11:13:12 by charles ### ########.fr */ +/* Updated: 2020/05/14 18:06:33 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFTM_VEC3_H # define LIBFTM_VEC3_H -typedef struct +# include <math.h> + +typedef union { - union + float v[3]; + struct { - float v[3]; - struct - { - float x; - float y; - float z; - }; + float x; + float y; + float z; }; } t_ftmvec3; t_ftmvec3 *ftm_vec3init(t_ftmvec3 *vec3, float x, float y, float z); +float ftm_vec3norm(t_ftmvec3 *vec3); +t_ftmvec3 *ftm_vec3normalize(t_ftmvec3 *vec3); #endif diff --git a/vendor/libftm/src/vec3/ftm_vec3norm.c b/vendor/libftm/src/vec3/ftm_vec3norm.c new file mode 100644 index 0000000..d226e08 --- /dev/null +++ b/vendor/libftm/src/vec3/ftm_vec3norm.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ftm_vec3norm.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/05/14 18:04:25 by charles #+# #+# */ +/* Updated: 2020/05/14 18:05:14 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libftm_vec3.h" + +float ftm_vec3norm(t_ftmvec3 *vec3) +{ + return (sqrt(vec3->x * vec3->x + vec3->y * vec3->y + vec3->z * vec3->z)); +} diff --git a/vendor/libftm/src/vec3/ftm_vec3normalize.c b/vendor/libftm/src/vec3/ftm_vec3normalize.c new file mode 100644 index 0000000..dbf24d3 --- /dev/null +++ b/vendor/libftm/src/vec3/ftm_vec3normalize.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ftm_vec3normalize.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/05/14 18:05:22 by charles #+# #+# */ +/* Updated: 2020/05/14 18:06:04 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libftm_vec3.h" + +t_ftmvec3 *ftm_vec3normalize(t_ftmvec3 *vec3) +{ + float norm; + + norm = ftm_vec3norm(vec3); + vec3->x /= norm; + vec3->y /= norm; + vec3->z /= norm; + return (vec3); +} |
