color.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* color.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: salee2 <salee2@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2023/05/24 20:21:16 by salee2 #+# #+# */ 9 /* Updated: 2023/05/24 20:21:18 by salee2 ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include "include/minirt.h" 14 15 void write_color(t_color3 color) 16 { 17 for(int i=0; i<3; ++i) 18 printf("%d ", (int) (255.999 * color.arr[i])); 19 printf("\n"); 20 return ; 21 } 22 23 int create_trgb(t_color3 color) 24 { 25 const unsigned char t = 0; 26 const unsigned char r = 255.99 * color.r; 27 const unsigned char g = 255.99 * color.g; 28 const unsigned char b = 255.99 * color.b; 29 30 return (*(int *)(unsigned char [4]){b, g, r, t}); 31 }