aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z1r3p1.le-101.fr>2020-03-05 20:58:15 +0100
committerRudy Bousset <rbousset@z1r3p1.le-101.fr>2020-03-05 20:58:15 +0100
commitc7b399f143c5df061860c2d2b45d6855b2c12db3 (patch)
treece23620bb886058521f1d2736d655194d4884c5e /src
parenthow (diff)
download42-cub3d-c7b399f143c5df061860c2d2b45d6855b2c12db3.tar.gz
42-cub3d-c7b399f143c5df061860c2d2b45d6855b2c12db3.tar.bz2
42-cub3d-c7b399f143c5df061860c2d2b45d6855b2c12db3.tar.xz
42-cub3d-c7b399f143c5df061860c2d2b45d6855b2c12db3.tar.zst
42-cub3d-c7b399f143c5df061860c2d2b45d6855b2c12db3.zip
cool cool
Diffstat (limited to 'src')
-rw-r--r--src/ft_darken_rgb.c9
-rw-r--r--src/ft_draw_verline.c4
2 files changed, 5 insertions, 8 deletions
diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c
index 6993891..97d0c0e 100644
--- a/src/ft_darken_rgb.c
+++ b/src/ft_darken_rgb.c
@@ -15,15 +15,12 @@
#include <stdio.h>
uint32_t
- ft_darken_rgb(t_rgb rgb, t_cub *cl)
+ ft_darken_rgb(t_rgb rgb, int32_t y, t_cub *cl)
{
t_rgb darker;
- float dist;
- float calc;
+ uint8_t calc;
- if ((dist = cl->rlist.ceil_dist) <= 0)
- dist = 0.0001;
- calc = (dist * 0.4);
+ calc = (((cl->wlist.y_size / 2) + y)),
calc = (calc >= 255) ? (255) : (calc);
calc = (calc < 1) ? (1) : (calc);
darker = rgb;
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c
index f01ddc8..eeccc42 100644
--- a/src/ft_draw_verline.c
+++ b/src/ft_draw_verline.c
@@ -20,7 +20,7 @@ static void
{
*(int*)(cl->img.ptr +
(x * 4 + (y * cl->img.sizeline)))
- = ft_darken_rgb(cl->f_rgb, cl);
+ = ft_darken_rgb(cl->f_rgb, y, cl);
y++;
}
}
@@ -35,7 +35,7 @@ static void
{
*(int*)(cl->img.ptr +
(x * 4 + (i * cl->img.sizeline)))
- = ft_darken_rgb(cl->c_rgb, cl);
+ = ft_darken_rgb(cl->c_rgb, i, cl);
i++;
}
}