-
Notifications
You must be signed in to change notification settings - Fork 0
/
perspective.c
53 lines (46 loc) · 1.51 KB
/
perspective.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* perspective.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: eteyssed <eteyssed@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/12/01 17:03:26 by eteyssed #+# #+# */
/* Updated: 2014/12/01 17:03:27 by eteyssed ### ########.fr */
/* */
/* ************************************************************************** */
#include "head.h"
t_pos ft_3d_to_2d(t_3dpos dp1, float rx, float ry)
{
t_pos p1;
p1.x = dp1.x - dp1.y;
p1.y = dp1.z + (dp1.x / rx) + (dp1.y / ry);
return (p1);
}
t_3dpos ft_new_3d_pos(int x, int y, int z)
{
t_3dpos dp1;
dp1.x = x;
dp1.y = y;
dp1.z = z;
return (dp1);
}
void ft_put_3d_tab(t_all *all)
{
int x;
int y;
y = 0;
color_alt(all, ((all->tab[0][0].z + all->tab[0][1].z) / 2));
while (y < (all->max.y - 1))
{
x = 0;
while (x < (all->max.x - 1))
{
ft_3d_line(all, all->tab[y][x], all->tab[y][x + 1]);
ft_3d_line(all, all->tab[y][x], all->tab[y + 1][x]);
x++;
}
y++;
}
ft_end_line(all, all->tab, all->max);
}