texture.h
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* texture.h :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <gychoi@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2023/05/16 17:34:21 by gychoi #+# #+# */ 9 /* Updated: 2023/05/17 18:39:07 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #ifndef TEXTURE_H 14 # define TEXTURE_H 15 16 typedef struct s_tpoints 17 { 18 t_vec2 uv0; 19 t_vec2 uv1; 20 t_vec2 uv2; 21 t_vec2 uv3; 22 } t_tpoints; 23 24 typedef struct s_texture 25 { 26 int width; 27 int height; 28 int channels; 29 double *image; 30 } t_texture; 31 32 t_color3 get_clamped(t_texture *texture, int i, int j); 33 t_color3 get_wrapped(t_texture *texture, int i, int j); 34 t_point3 sample_point(t_texture *texture, t_vec2 *uv); 35 t_point3 sample_linear(t_texture *texture, t_vec2 *uv); 36 t_texture *generate_sample_texture_image(int width, int height, t_vec3 *sample_image); 37 t_texture *generate_texture_image(int width, int height, void *texture); 38 39 #endif