-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb_set_color_bonus.c
More file actions
39 lines (35 loc) · 1.72 KB
/
b_set_color_bonus.c
File metadata and controls
39 lines (35 loc) · 1.72 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* b_set_color_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nkawaguc <nkawaguc@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/29 00:48:51 by nkawaguc #+# #+# */
/* Updated: 2024/10/30 12:10:24 by nkawaguc ### ########.fr */
/* */
/* ************************************************************************** */
#include "b_fdf_bonus.h"
void set_color(t_data *data, t_map *map, int i, int j)
{
map->points[i][j].color.trgb[0] = in_div(0x00, 0x00,
map->data[i][j] - map->z_min, map->z_max - map->z_min);
map->points[i][j].color.trgb[1] = in_div(0xFF, 0x00,
map->data[i][j] - map->z_min, map->z_max - map->z_min);
map->points[i][j].color.trgb[2] = in_div(0xFF, 0x70,
map->data[i][j] - map->z_min, map->z_max - map->z_min);
map->points[i][j].color.trgb[3] = in_div(0xFF, 0x00,
map->data[i][j] - map->z_min, map->z_max - map->z_min);
if (data->endian == 0)
small_endian_color(&map->points[i][j]);
}
void small_endian_color(t_point *point)
{
int tmp;
tmp = point->color.trgb[0];
point->color.trgb[0] = point->color.trgb[3];
point->color.trgb[3] = tmp;
tmp = point->color.trgb[1];
point->color.trgb[1] = point->color.trgb[2];
point->color.trgb[2] = tmp;
}