-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzero_to_structures.c
More file actions
73 lines (66 loc) · 2.16 KB
/
zero_to_structures.c
File metadata and controls
73 lines (66 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* zero_to_structures.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bgerda <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/23 17:42:25 by bgerda #+# #+# */
/* Updated: 2019/11/23 17:46:07 by bgerda ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void zero_to_rot(t_rot *rot)
{
rot->alpha = 0;
rot->beta = 0;
rot->tetta = 0;
}
void zero_to_mouse(t_point *half)
{
half->mouse.prev_x = 0;
half->mouse.prev_y = 0;
half->mouse.x = 0;
half->mouse.y = 0;
half->mouse.left_press = 0;
}
void zero_to_vizor(t_point *half)
{
half->vizor.x_shift = 0;
half->vizor.y_shift = 0;
half->vizor.z_shift = 1;
if (half->max_x < 50)
half->vizor.zoom = 30;
else if (half->max_x < 500)
half->vizor.zoom = 3;
else
half->vizor.zoom = 1;
}
void zero_to_half(t_point *half, char *input)
{
half->axis = (int ***)char_to_point(input);
half->min_z = 0;
half->max_z = 0;
half->projection = 0;
half->mlx_ptr = mlx_init();
half->window = mlx_new_window(half->mlx_ptr, 1000, 1000, "fdf");
half->map = mlx_new_image(half->mlx_ptr, 1000, 1000);
half->img_sourse = mlx_get_data_addr(half->map, &half->bits_pp,
&half->size_line, &half->endian);
edge_of_abyss(half->axis, &half->min_z, &half->max_z);
make_first_color(&half->axis, half->min_z, half->max_z);
find_xy_interval(half);
zero_to_mouse(half);
zero_to_vizor(half);
zero_to_rot(&half->rot);
}
char *ft_undin(int fd)
{
char *buf;
int ret;
if (!(buf = (char *)malloc(sizeof(char) * 5000000)))
return (NULL);
while ((ret = read(fd, buf, 5000000)))
buf[ret] = '\0';
return (buf);
}