aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_verline.c
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-03-05 22:01:22 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-03-05 22:01:22 +0100
commit82f823ceb63d76ce052db3bca74842fe37394eb4 (patch)
tree8e4f3fc4b36027560dad63da91f91f0fc9db2dde /src/ft_draw_verline.c
parentdebugging... (diff)
download42-cub3d-82f823ceb63d76ce052db3bca74842fe37394eb4.tar.gz
42-cub3d-82f823ceb63d76ce052db3bca74842fe37394eb4.tar.bz2
42-cub3d-82f823ceb63d76ce052db3bca74842fe37394eb4.tar.xz
42-cub3d-82f823ceb63d76ce052db3bca74842fe37394eb4.tar.zst
42-cub3d-82f823ceb63d76ce052db3bca74842fe37394eb4.zip
fuck
Diffstat (limited to 'src/ft_draw_verline.c')
-rw-r--r--src/ft_draw_verline.c19
1 files changed, 18 insertions, 1 deletions
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 <stdio.h>
#include <cub3d.h>
+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++;
}
}