diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-24 15:42:05 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-24 15:42:05 +0100 |
commit | 75ce0896f9333f29cbd55f7e80bfad09668f5500 (patch) | |
tree | d55069d9dc052fc779aa76c0578c594d579043f6 | |
parent | less threads (diff) | |
download | 42-cub3d-75ce0896f9333f29cbd55f7e80bfad09668f5500.tar.gz 42-cub3d-75ce0896f9333f29cbd55f7e80bfad09668f5500.tar.bz2 42-cub3d-75ce0896f9333f29cbd55f7e80bfad09668f5500.tar.xz 42-cub3d-75ce0896f9333f29cbd55f7e80bfad09668f5500.tar.zst 42-cub3d-75ce0896f9333f29cbd55f7e80bfad09668f5500.zip |
Norme and merge
Diffstat (limited to '')
-rw-r--r-- | src/ft_floor_cast.c | 29 | ||||
-rw-r--r-- | src/ft_raycasting.c | 12 | ||||
-rw-r--r-- | src/ft_wall_cast.c | 2 |
3 files changed, 19 insertions, 24 deletions
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c index f371359..c9c44e5 100644 --- a/src/ft_floor_cast.c +++ b/src/ft_floor_cast.c @@ -69,11 +69,10 @@ void cl = (t_cub *)vargp; y = (cl->wlist.y_size / 2); - y += 0 * (cl->wlist.y_size / 2 / 4); - while (y < (cl->wlist.y_size / 2) + (1 * (cl->wlist.y_size / 2 / 4))) + while (y < (cl->wlist.y_size)) { x = 0; - while (x < cl->wlist.x_size) + while (x < cl->wlist.x_size / 4) { if (cl->rlist.wall_bz[x] <= y) ft_floor_cast_loop(y, x, cl); @@ -94,11 +93,11 @@ void cl = (t_cub *)vargp; y = (cl->wlist.y_size / 2); - y += 1 * (cl->wlist.y_size / 2 / 4); - while (y < (cl->wlist.y_size / 2) + (2 * (cl->wlist.y_size / 2 / 4))) + /* y += 1 * (cl->wlist.y_size / 2 / 4); */ + while (y < (cl->wlist.y_size)) { - x = 0; - while (x < cl->wlist.x_size) + x = cl->wlist.x_size / 4; + while (x < 2 * (cl->wlist.x_size / 4)) { if (cl->rlist.wall_bz[x] <= y) ft_floor_cast_loop(y, x, cl); @@ -119,11 +118,10 @@ void cl = (t_cub *)vargp; y = (cl->wlist.y_size / 2); - y += (2 * (cl->wlist.y_size / 2 / 4)); - while (y < (cl->wlist.y_size / 2) + (3 * (cl->wlist.y_size / 2 / 4))) + while (y < (cl->wlist.y_size)) { - x = 0; - while (x < cl->wlist.x_size) + x = 2 * (cl->wlist.x_size / 4); + while (x < 3 * (cl->wlist.x_size / 4)) { if (cl->rlist.wall_bz[x] <= y) ft_floor_cast_loop(y, x, cl); @@ -144,11 +142,10 @@ void cl = (t_cub *)vargp; y = (cl->wlist.y_size / 2); - y += (3 * (cl->wlist.y_size / 2 / 4)); - while (y < (cl->wlist.y_size / 2) + (4 * (cl->wlist.y_size / 2 / 4))) + while (y < (cl->wlist.y_size)) { - x = 0; - while (x < cl->wlist.x_size) + x = 3 * (cl->wlist.x_size / 4); + while (x < 4 * (cl->wlist.x_size / 4)) { if (cl->rlist.wall_bz[x] <= y) ft_floor_cast_loop(y, x, cl); @@ -175,6 +172,6 @@ void pthread_join(tid[1], 0x0); pthread_join(tid[2], 0x0); pthread_join(tid[3], 0x0); - /* pthread_exit(0x0); */ + pthread_exit(0x0); return (0x0); } diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index ea27d29..1804118 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -104,7 +104,7 @@ static void void ft_castray(t_cub *cl) { - /* pthread_t tid[2]; */ + pthread_t tid[2]; uint16_t y; uint16_t x; @@ -173,12 +173,10 @@ void cl->rlist.row_dist_tab[cl->wlist.y_size - y] = cl->rlist.row_dist; y++; } - ft_wall_cast(cl); - ft_floor_cast(cl); - /* pthread_create(&tid[0], 0x0, ft_wall_cast, (void*)cl); */ - /* pthread_create(&tid[1], 0x0, ft_floor_cast, (void*)cl); */ - /* pthread_join(tid[0], 0x0); */ - /* pthread_join(tid[1], 0x0); */ + pthread_create(&tid[0], 0x0, ft_wall_cast, (void*)cl); + pthread_create(&tid[1], 0x0, ft_floor_cast, (void*)cl); + pthread_join(tid[0], 0x0); + pthread_join(tid[1], 0x0); x = 0; while (x < 2) { diff --git a/src/ft_wall_cast.c b/src/ft_wall_cast.c index b8d4e3c..8e74434 100644 --- a/src/ft_wall_cast.c +++ b/src/ft_wall_cast.c @@ -118,6 +118,6 @@ void pthread_join(tid[1], 0x0); pthread_join(tid[2], 0x0); pthread_join(tid[3], 0x0); - /* pthread_exit(0x0); */ + pthread_exit(0x0); return (0x0); } |