Skip to content

Commit

Permalink
#30 feat implement bump map textures (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
KenWR authored Aug 27, 2024
1 parent a3d5430 commit a3773bf
Show file tree
Hide file tree
Showing 29 changed files with 13,973 additions and 4,691 deletions.
14 changes: 5 additions & 9 deletions example.rt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
A 1 255,255,255
C -10,14,10 0,-1,-1 60
L 25,25,25 1 255,255,0
L -25,25,25 1 0,255,255
sp 3.5,6.5,-20 8.5 147,255,216 -c 0,0,0 16 8
sp -5,4,-33 14 121,0,255 -c 0,0,0 16 8
cy -9.5,7.5,-5 0,1,0 5 5 100,100,255 -c 0,0,0 32 4
co -9.5,-6.5,-5 1,-1,0 5 5 255,89,89 -c 0,0,0 32 4
pl 0,-15,0 0,-1,0 125,125,125 -c 0,0,0 2 2
A 0.3 255,255,255
C 0,80,20 0,0.67,1 80
L -10,100,-30 1 255,255,255
L 10,120,-30 1 255,255,255
sp 0,100,48 40 111,130,130 -t ./resources/brick.xpm -b ./resources/brick_bump.xpm
13 changes: 8 additions & 5 deletions includes/shape/texture.h → includes/shape/map.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* texture.h :+: :+: :+: */
/* map.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jeongwpa <jeongwpa@student.42.fr> +#+ +:+ +#+ */
/* By: jiwojung <jiwojung@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/23 01:01:12 by jeongwpa #+# #+# */
/* Updated: 2024/08/23 18:35:25 by jeongwpa ### ########.fr */
/* Updated: 2024/08/27 18:02:56 by jiwojung ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef TEXTURE_H
# define TEXTURE_H
#ifndef MAP_H
# define MAP_H

# include "shape/hittable.h"

Expand All @@ -21,4 +21,7 @@ t_color uv_texture_map(t_hit *obj, t_record *rec, t_uv_map uv_map);
t_color_map uv_color_map_adapter(t_texture texture);
t_bool is_texture_map_enabled(t_texture texture);

// bump.c
void normal_mapping(t_hit *obj, t_record *rec, t_uv_map uv_map);

#endif
8 changes: 6 additions & 2 deletions includes/vec2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* vec2.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jeongwpa <jeongwpa@student.42.fr> +#+ +:+ +#+ */
/* By: jiwojung <jiwojung@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:06:56 by jeongwpa #+# #+# */
/* Updated: 2024/08/22 17:07:16 by jeongwpa ### ########.fr */
/* Updated: 2024/08/27 15:26:48 by jiwojung ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -19,4 +19,8 @@ typedef struct s_vec2
float v;
} t_vec2;

// vec2.c
t_vec2 vec2_add(t_vec2 a, t_vec2 b);
t_vec2 vec2_sub(t_vec2 a, t_vec2 b);

#endif
2,287 changes: 2,287 additions & 0 deletions resources/brick.xpm

Large diffs are not rendered by default.

2,310 changes: 2,310 additions & 0 deletions resources/brick_bump.xpm

Large diffs are not rendered by default.

1,286 changes: 1,286 additions & 0 deletions resources/earth.xpm

Large diffs are not rendered by default.

Loading

0 comments on commit a3773bf

Please sign in to comment.