From 82f823ceb63d76ce052db3bca74842fe37394eb4 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Thu, 5 Mar 2020 22:01:22 +0100 Subject: fuck --- src/ft_draw_verline.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index b0f9880..2b684eb 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -10,7 +10,24 @@ /* */ /* ************************************************************************** */ +#include #include +uint32_t + ft_gradient(t_rgb rgb, int it) +{ + uint32_t res; + + (void)it; + res = 0; + if (it < 255) + { + rgb.r += it; + rgb.g += it; + rgb.b += it; + } + res += ((rgb.r << 16) + (rgb.g << 8) + rgb.b); + return (res); +} static void ft_draw_floor(t_cub *cl, int32_t y, int32_t x) @@ -18,7 +35,7 @@ static void while ((uint32_t)y < cl->wlist->y_size) { *(int*)(cl->img.ptr + - (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(cl->f_rgb); + (x * 4 + (y * cl->img.sizeline))) = ft_gradient(cl->f_rgb, y); y++; } } -- cgit v1.2.3 From 04658c5e9a019917c3f8ffeb84562c328da0a885 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Fri, 6 Mar 2020 18:40:56 +0100 Subject: ils se cachent (mal) --- src/ft_draw_verline.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 2b684eb..220badb 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -19,11 +19,12 @@ uint32_t (void)it; res = 0; - if (it < 255) + while (it < 500) { - rgb.r += it; - rgb.g += it; - rgb.b += it; + rgb.r += 1; + rgb.g += 1; + rgb.b += 1; + it++; } res += ((rgb.r << 16) + (rgb.g << 8) + rgb.b); return (res); -- cgit v1.2.3 From f00d3d412bdbbe45c6a84930e9d392bf915a25b9 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 9 Mar 2020 15:50:02 +0100 Subject: start over n --- src/ft_draw_verline.c | 51 +-------------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 220badb..99fff3c 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -12,23 +12,6 @@ #include #include -uint32_t - ft_gradient(t_rgb rgb, int it) -{ - uint32_t res; - - (void)it; - res = 0; - while (it < 500) - { - rgb.r += 1; - rgb.g += 1; - rgb.b += 1; - it++; - } - res += ((rgb.r << 16) + (rgb.g << 8) + rgb.b); - return (res); -} static void ft_draw_floor(t_cub *cl, int32_t y, int32_t x) @@ -36,7 +19,7 @@ static void while ((uint32_t)y < cl->wlist->y_size) { *(int*)(cl->img.ptr + - (x * 4 + (y * cl->img.sizeline))) = ft_gradient(cl->f_rgb, y); + (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(cl->f_rgb); y++; } } @@ -55,38 +38,6 @@ static void } } -/* -** #include -** static void -** ft_draw_ceil_tex(t_cub *cl, int x, int y) -** { -** int16_t i; -** int32_t d; -** int32_t tex_y; -** -** i = 0; -** while (i < y) -** { -** d = i * 256 - cl->wlist->y_size * 128 + cl->rlist.line_h * 128; -** d = (d <= 0) ? (-d) : (d); -** ft_printf("%d\n", d); -** tex_y = ((d * cl->tlist[1].img_h) / cl->rlist.line_h) / 256; -** (tex_y <= 0) ? (tex_y = 1) : 0; -** cl->img.ptr[x * 4 + (cl->img.sizeline * i)] = -** (int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * -** cl->tlist[1].img_h * tex_y]; -** cl->img.ptr[x * 4 + (cl->img.sizeline * i) + 1] = -** (int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * -** cl->tlist[1].img_h * tex_y + 1]; -** cl->img.ptr[x * 4 + (cl->img.sizeline * i) + 2] = -** (int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * -** cl->tlist[1].img_h * tex_y + 2]; -** cl->img.ptr[x * 4 + cl->wlist->x_size * i + 3] = (char)0; -** i++; -** } -** } -*/ - int8_t ft_draw_verline(t_cub *cl, int32_t x, int32_t y, int32_t y2) { -- cgit v1.2.3