From 29ea8338efb0b5450611b73463c9d7d469db2d75 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 14 May 2020 15:01:31 +0200 Subject: Changed window manager to SDL2, refactoring everything --- src/center.c | 72 ------------------------------------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 src/center.c (limited to 'src/center.c') diff --git a/src/center.c b/src/center.c deleted file mode 100644 index a3a18b4..0000000 --- a/src/center.c +++ /dev/null @@ -1,72 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* center.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: charles +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/05/13 10:48:15 by charles #+# #+# */ -/* Updated: 2020/05/13 16:43:38 by charles ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "scop.h" - -void st_find_boundary(float *vertices, size_t vertices_len, t_ftmvec3 *min, t_ftmvec3 *max) -{ - size_t i; - - ftm_vec3init(min, INFINITY, INFINITY, INFINITY); - ftm_vec3init(max, -INFINITY, -INFINITY, -INFINITY); - i = 0; - while (i < vertices_len * 4) - { - if (vertices[i] > max->x) - max->x = vertices[i]; - if (vertices[i] < min->x) - min->x = vertices[i]; - i++; - if (vertices[i] > max->y) - max->y = vertices[i]; - if (vertices[i] < min->y) - min->y = vertices[i]; - i++; - if (vertices[i] > max->z) - max->z = vertices[i]; - if (vertices[i] < min->z) - min->z = vertices[i]; - i += 2; - } -} - -void center_mat4_init_translate(t_ftmmat4 *dst, float *vertices, size_t vertices_len) -{ - t_ftmvec3 min; - t_ftmvec3 max; - - st_find_boundary(vertices, vertices_len, &min, &max); - ftm_mat4init_eye(dst, 1.0); - ftm_mat4translate(dst, -(max.x + min.x) / 2.0f, - -(max.y + min.y) / 2.0f, - -(max.z + min.z) / 2.0f); -} - -float *texture_coord_create(float *vertices, size_t vertices_len) -{ - t_ftmvec3 min; - t_ftmvec3 max; - float *coords; - size_t i; - - if ((coords = malloc(sizeof(float) * (vertices_len * 2))) == NULL) - return (NULL); - st_find_boundary(vertices, vertices_len, &min, &max); - i = 0; - while (i < vertices_len) - { - coords[i * 2 + 0] = (vertices[i * 4 + 0] - min.x) * (1.0 / (max.x - min.x)); - coords[i * 2 + 1] = (vertices[i * 4 + 1] - min.y) * (1.0 / (max.y - min.y)); - i++; - } - return (coords); -} -- cgit