-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yesim Zaim
committed
Jan 24, 2024
1 parent
d361c67
commit c350710
Showing
5 changed files
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/24 13:13:37 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/24 16:06:35 by yzaim ######## odam.nl */ | ||
/* Updated: 2024/01/24 17:05:20 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -19,10 +19,10 @@ t_vray floorcaster(t_vec2d pp, t_vec2d dir, t_vec2d cam_plane, uint32_t y) | |
t_vec2d raydir_left; | ||
t_vec2d raydir_right; | ||
|
||
raydir_left = (t_vec2d){dir.x - cam_plane.x, dir.y - cam_plane.y}; | ||
raydir_right = (t_vec2d){dir.x + cam_plane.x, dir.y + cam_plane.y}; | ||
raydir_left = ((t_vec2d){dir.x - cam_plane.x, dir.y - cam_plane.y}); | ||
raydir_right = ((t_vec2d){dir.x + cam_plane.x, dir.y + cam_plane.y}); | ||
|
||
|
||
|
||
int p = y - WINDOW_HEIGHT / 2; | ||
double posZ = 0.5 * WINDOW_HEIGHT; | ||
double row_distance = posZ / p; | ||
|
@@ -32,7 +32,5 @@ t_vray floorcaster(t_vec2d pp, t_vec2d dir, t_vec2d cam_plane, uint32_t y) | |
ray.floor.x = pp.x + row_distance + raydir_left.x; | ||
ray.floor.y = pp.y + row_distance + raydir_left.y; | ||
|
||
|
||
|
||
return (ray); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:27:23 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/24 16:09:02 by yzaim ######## odam.nl */ | ||
/* Updated: 2024/01/24 17:09:42 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:28:08 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/24 16:06:25 by yzaim ######## odam.nl */ | ||
/* Updated: 2024/01/24 17:08:29 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -74,10 +74,10 @@ void draw_fc(mlx_image_t *image, t_vray *vray, mlx_texture_t *f_tex, mlx_texture | |
|
||
vray->floor = vec2d_add(vray->floor, vray->step); | ||
|
||
const uint32_t c_color = pixel_picker(c_tex, c_t.x, c_t.y); | ||
const uint32_t f_color = pixel_picker(f_tex, f_t.x, f_t.y); | ||
mlx_put_pixel(image, col, WINDOW_HEIGHT - row - 1, c_color); | ||
mlx_put_pixel(image, col, row, f_color); | ||
const uint32_t c_pixel = pixel_picker(c_tex, c_t.x, c_t.y); | ||
const uint32_t f_pixel = pixel_picker(f_tex, f_t.x, f_t.y); | ||
mlx_put_pixel(image, col, WINDOW_HEIGHT - row - 1, c_pixel); | ||
mlx_put_pixel(image, col, row, f_pixel); | ||
} | ||
|
||
void render_viewport(mlx_image_t *image, t_player *p) | ||
|
@@ -88,7 +88,6 @@ void render_viewport(mlx_image_t *image, t_player *p) | |
|
||
if (p->should_render) | ||
{ | ||
row = 0; | ||
while (row < image->height) | ||
{ | ||
col = 0; | ||
|
@@ -101,6 +100,8 @@ void render_viewport(mlx_image_t *image, t_player *p) | |
} | ||
p->should_render = false; | ||
} | ||
|
||
|
||
col = 0; | ||
while(col < image->width) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: yzaim <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2024/01/08 15:26:51 by yzaim #+# #+# */ | ||
/* Updated: 2024/01/24 15:49:05 by yzaim ######## odam.nl */ | ||
/* Updated: 2024/01/24 16:46:58 by yzaim ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|