aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_darken_rgb.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-09 01:52:21 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-09 01:52:21 +0100
commitc51419a68e38ed3a2eb28e740f72eaa436fbd106 (patch)
tree4cafa4ee075be34b32132c54fdda87c7ec996695 /src/ft_darken_rgb.c
parentNigga my gun go off (diff)
download42-cub3d-c51419a68e38ed3a2eb28e740f72eaa436fbd106.tar.gz
42-cub3d-c51419a68e38ed3a2eb28e740f72eaa436fbd106.tar.bz2
42-cub3d-c51419a68e38ed3a2eb28e740f72eaa436fbd106.tar.xz
42-cub3d-c51419a68e38ed3a2eb28e740f72eaa436fbd106.tar.zst
42-cub3d-c51419a68e38ed3a2eb28e740f72eaa436fbd106.zip
Boy
Diffstat (limited to '')
-rw-r--r--src/ft_darken_rgb.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c
index 656aac7..4c571cf 100644
--- a/src/ft_darken_rgb.c
+++ b/src/ft_darken_rgb.c
@@ -14,33 +14,20 @@
#include <stdint.h>
uint32_t
- ft_darken_ceil(t_rgb rgb, int32_t y, t_cub *cl)
+ ft_darken(t_rgb rgb, t_cub *cl)
{
t_rgb darker;
float calc;
+ float dist;
+ if ((dist = cl->rlist.row_dist) <= 0)
+ dist = 0.0001;
+ calc = (dist * 0.4);
+ calc = (calc >= 255) ? (255) : (calc);
+ calc = (calc < 1) ? (1) : (calc);
darker = rgb;
- calc = ((float)(y - (75000.0 / cl->wlist.y_size))
- / (cl->wlist.y_size / 2));
- calc = (calc < 0) ? (0) : (calc);
- darker.r *= 1 - calc;
- darker.g *= 1 - calc;
- darker.b *= 1 - calc;
+ darker.r /= calc;
+ darker.g /= calc;
+ darker.b /= calc;
return (ft_rgb_to_hex(darker));
}
-
-/* uint32_t */
-/* ft_darken_floor(t_rgb rgb, int32_t y, t_cub *cl) */
-/* { */
-/* t_rgb darker; */
-/* float calc; */
-
-/* calc = ((float)(y + (75000.0 / cl->wlist.y_size)) */
-/* / (cl->wlist.y_size / 2)) - 1.0; */
-/* calc = (calc < 0) ? (0) : (calc); */
-/* darker = rgb; */
-/* darker.r *= calc; */
-/* darker.g *= calc; */
-/* darker.b *= calc; */
-/* return (ft_rgb_to_hex(darker)); */
-/* } */