blob: 656aac7a9403a273d08b681c6f932906206b63e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_darken_rgb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/03/05 16:04:28 by rbousset #+# #+# */
/* Updated: 2020/03/05 16:04:29 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <cub3d.h>
#include <stdint.h>
uint32_t
ft_darken_ceil(t_rgb rgb, int32_t y, t_cub *cl)
{
t_rgb darker;
float 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;
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)); */
/* } */
|