feat: adding all the textures
This commit is contained in:
parent
954c5f76d6
commit
badd6534f4
11 changed files with 276 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
minilibx-linux/
|
||||
.direnv/
|
||||
Cub3D*
|
||||
build/
|
||||
|
|
|
|||
3
Makefile
3
Makefile
|
|
@ -6,7 +6,7 @@
|
|||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||
# Updated: 2024/12/01 18:57:47 by rparodi ### ########.fr #
|
||||
# Updated: 2024/12/02 00:17:35 by rparodi ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -112,7 +112,6 @@ re: header fclean all
|
|||
build/libft.a:
|
||||
@make --no-print-directory -C $(LIBFT_DIR)
|
||||
build/libmlx.a:
|
||||
@make --no-print-directory -C $(MLX_DIR)
|
||||
|
||||
# Dependences for all
|
||||
$(NAME): $(OBJ) build/libft.a build/libmlx.a
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
INC=/usr/X11/include
|
||||
INC=/usr/include
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/11 19:53:42 by rparodi #+# #+# */
|
||||
/* Updated: 2024/12/01 18:02:27 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/12/02 00:20:25 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ t_win_list *c3_init_mlx_window(t_info *info)
|
|||
{
|
||||
mlx_get_screen_size(info->mlx_ptr, \
|
||||
&info->screen_size.x, &info->screen_size.y);
|
||||
info->screen_size.x *= WIN_COEF;
|
||||
info->screen_size.y *= WIN_COEF;
|
||||
/*info->screen_size.x *= WIN_COEF;*/
|
||||
/*info->screen_size.y *= WIN_COEF;*/
|
||||
ft_clamp(info->screen_size.x, 0, 1920);
|
||||
ft_clamp(info->screen_size.y, 0, 1080);
|
||||
return (\
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/20 12:25:45 by rparodi #+# #+# */
|
||||
/* Updated: 2024/11/20 15:20:23 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/12/02 17:54:04 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,6 +32,9 @@ bool mlx_load_all_textures(t_info *info)
|
|||
i = 0;
|
||||
info->map.texture[0] = mlx_load_image(info, "../textures/a.xpm");
|
||||
info->map.texture[1] = mlx_load_image(info, "../textures/b.xpm");
|
||||
info->map.texture[2] = mlx_load_image(info, "../textures/sandy_32.xpm");
|
||||
info->map.texture[3] = mlx_load_image(info, "../textures/cobblestone_32.xpm");
|
||||
|
||||
while (i < 4)
|
||||
{
|
||||
if (!info->map.texture[i])
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/12 06:02:54 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/12/01 18:57:25 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/12/05 16:30:56 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -91,6 +91,23 @@ void column_handler(t_ipoint pos_i, t_dpoint ray_dir, t_info *data, int x)
|
|||
draw_(side, perp_wall_dist, step, x, data);
|
||||
}
|
||||
|
||||
void draw_floor(t_info *data)
|
||||
{
|
||||
t_ipoint temp;
|
||||
|
||||
temp.y = data->screen_size.y / 2;
|
||||
while (temp.y < data->screen_size.y)
|
||||
{
|
||||
temp.x = 0;
|
||||
while (temp.x < data->screen_size.x)
|
||||
{
|
||||
my_mlx_pixel_put(data, temp.x, temp.y, 0xFFFFFF);
|
||||
temp.x++;
|
||||
}
|
||||
temp.y++;
|
||||
}
|
||||
}
|
||||
|
||||
int render_frame(t_info *data)
|
||||
{
|
||||
double camera_x;
|
||||
|
|
@ -101,6 +118,7 @@ int render_frame(t_info *data)
|
|||
coef = 2 * tan(deg2rad(FOV) / 2) / (double)data->screen_size.x;
|
||||
ft_bzero(data->camera.img_addr, data->screen_size.x * data->screen_size.y \
|
||||
* (data->camera.bpp / 8));
|
||||
draw_floor(data);
|
||||
while (x < data->screen_size.x)
|
||||
{
|
||||
camera_x = x * coef - 1;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||
# Updated: 2024/11/28 09:20:29 by bgoulard ### ########.fr #
|
||||
# Updated: 2024/12/02 17:42:23 by rparodi ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ MLXFLAGS = -L$(MLX_DIR) -lX11 -lXext
|
|||
# Add MLXFLAGS to the linker flags
|
||||
LDFLAGS += $(MLXFLAGS)
|
||||
|
||||
SRC = test.c
|
||||
SRC = test2.c
|
||||
|
||||
# Objects
|
||||
OBJDIRNAME = ./build
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/27 12:09:00 by rparodi #+# #+# */
|
||||
/* Updated: 2024/11/28 12:09:36 by bgoulard ### ########.fr */
|
||||
/* Updated: 2024/12/02 17:42:10 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -62,10 +62,8 @@ double deg2rad(int deg)
|
|||
void rotate_plane(t_2dpoint *plane, double angle)
|
||||
{
|
||||
double old_plane_x;
|
||||
double old_plane_y;
|
||||
|
||||
old_plane_x = (*plane).x;
|
||||
old_plane_y = (*plane).y;
|
||||
plane->x = plane->x * cos(angle) - plane->y * sin(angle);
|
||||
plane->y = old_plane_x * sin(angle) + plane->y * cos(angle);
|
||||
}
|
||||
|
|
|
|||
154
textures/cobblestone_32.xpm
Normal file
154
textures/cobblestone_32.xpm
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/* XPM */
|
||||
static char *_cb59dce4f574e3bd6a1e2f025c0312agi1mGDihwOOx8j7A[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 116 2 ",
|
||||
" c #100F10",
|
||||
". c #161515",
|
||||
"X c #191717",
|
||||
"o c #191718",
|
||||
"O c #1E1C1C",
|
||||
"+ c #211E1E",
|
||||
"@ c #252222",
|
||||
"# c #292626",
|
||||
"$ c #2D2B2B",
|
||||
"% c #322E2E",
|
||||
"& c #3A2F2E",
|
||||
"* c #36302F",
|
||||
"= c #3C312E",
|
||||
"- c #342F30",
|
||||
"; c #353131",
|
||||
": c #3A3434",
|
||||
"> c #3D3836",
|
||||
", c #3C3738",
|
||||
"< c #3E3A3A",
|
||||
"1 c #43332F",
|
||||
"2 c #433534",
|
||||
"3 c #4C3633",
|
||||
"4 c #433A36",
|
||||
"5 c #4C3937",
|
||||
"6 c #433C3B",
|
||||
"7 c #4B3D3B",
|
||||
"8 c #503835",
|
||||
"9 c #523D3C",
|
||||
"0 c #46413E",
|
||||
"q c #4B433D",
|
||||
"w c #524433",
|
||||
"e c #55443B",
|
||||
"r c #453F41",
|
||||
"t c #563D40",
|
||||
"y c #474141",
|
||||
"u c #4B4442",
|
||||
"i c #4E4845",
|
||||
"p c #4F4949",
|
||||
"a c #544442",
|
||||
"s c #584644",
|
||||
"d c #534A42",
|
||||
"f c #5A4A46",
|
||||
"g c #554D4B",
|
||||
"h c #5C4D4C",
|
||||
"j c #545146",
|
||||
"k c #56514C",
|
||||
"l c #5B524D",
|
||||
"z c #5D5552",
|
||||
"x c #5F5A53",
|
||||
"c c #614D46",
|
||||
"v c #61534D",
|
||||
"b c #625D4C",
|
||||
"n c #625553",
|
||||
"m c #635A53",
|
||||
"M c #655B59",
|
||||
"N c #695D5A",
|
||||
"B c #636052",
|
||||
"V c #696354",
|
||||
"C c #6E6852",
|
||||
"Z c #66615A",
|
||||
"A c #6B625D",
|
||||
"S c #6D695B",
|
||||
"D c #70675F",
|
||||
"F c #736A5D",
|
||||
"G c #6C6360",
|
||||
"H c #6B6463",
|
||||
"J c #6F6563",
|
||||
"K c #6D6865",
|
||||
"L c #706763",
|
||||
"P c #726766",
|
||||
"I c #716A62",
|
||||
"U c #726A63",
|
||||
"Y c #756D63",
|
||||
"T c #746A64",
|
||||
"R c #786B66",
|
||||
"E c #786D66",
|
||||
"W c #716A68",
|
||||
"Q c #746B69",
|
||||
"! c #776E6C",
|
||||
"~ c #7B6F69",
|
||||
"^ c #796E6A",
|
||||
"/ c #786E6C",
|
||||
"( c #767161",
|
||||
") c #7B7366",
|
||||
"_ c #7C7367",
|
||||
"` c #7E7A66",
|
||||
"' c #767069",
|
||||
"] c #79706B",
|
||||
"[ c #7C716B",
|
||||
"{ c #7F7868",
|
||||
"} c #7F796C",
|
||||
"| c #7E7572",
|
||||
" . c #807D6D",
|
||||
".. c #807776",
|
||||
"X. c #837B70",
|
||||
"o. c #847972",
|
||||
"O. c #857C72",
|
||||
"+. c #847B79",
|
||||
"@. c #8A7F78",
|
||||
"#. c #868172",
|
||||
"$. c #898171",
|
||||
"%. c #8C8673",
|
||||
"&. c #8A8174",
|
||||
"*. c #8D8870",
|
||||
"=. c #8D867B",
|
||||
"-. c #928B7C",
|
||||
";. c #938C7D",
|
||||
":. c #968F7F",
|
||||
">. c #96907B",
|
||||
",. c #98907F",
|
||||
"<. c #8D8681",
|
||||
"1. c #938C80",
|
||||
"2. c #948C88",
|
||||
"3. c #979081",
|
||||
"4. c #999087",
|
||||
"5. c #A29C81",
|
||||
/* pixels */
|
||||
"V : H + Z m % - $ $ ' ! # -.$ k g x $ $ 2 &.$ % % 2 >.g ; z $ A ",
|
||||
"&.d % $ 1 F 5.@ X.1 f [ % % % : z Y % ; O.L ] # @ N a T ; % , :.",
|
||||
"A ; $ 6 = C $ , % , ; a $ I %.% 7 % o + 1 Z = 1 O % $ < @ & v L ",
|
||||
"O ; T # 3 X @ 2 l z % % % g p % $ % A l $ ; : M t % = f G % # # ",
|
||||
"e ; ; 6 > k $ & $ % @ % % : 4 % 0 % > T 4 $ % a % @ % $ 9 N $ -.",
|
||||
"J % / z ~ 3.k , , f Z k e 3 # % O.d % % % } 6 : ; I | l $ , $ l ",
|
||||
"N 8 2 2 3 O.m 6 , % E % = % 5 L E S % % 7 N J k = > u [ & D $ R ",
|
||||
"= % + # ; % 2 % $ 7 l $ % : % : > $ $ $ , 2 q 4 % % % , , 4 % * ",
|
||||
"$ h Z A $ % % 7 % : : $ A z q ; ; : ] I % ; $ ; D N 0 $ | Z z p ",
|
||||
"M l g X.< 7 7 W u < % ; n { m , > > i > ; j % m q d g O 7 g g $ ",
|
||||
"6 , n @ $ z : 2 % m .d % 9 % , l > ; ; m M @ : % , x @ $ % $ ; ",
|
||||
"L 4 $ ; I <.u ; # A P A $ % # x 0 , % # z X.x < $ m P 9 = _ < g ",
|
||||
"A 7 , + @.M & 9 % ; $ : % > % ; # ; % : n N n ; k % $ % G H % u ",
|
||||
"$ % O.; $ $ . ` l % # $ # $ =.I 7 <.2.A ; % $ $ 6 x : , V Y > 6 ",
|
||||
"2 ] [ s $ 9 @ E { m A O ] f A ; l s +.@ F I $ | / O.% % 2 0 $ : ",
|
||||
"% % f a % $ ; A E = % # 3 i > $ $ , ..+ O g ; ~ N $ : : % $ 4 k ",
|
||||
"$.j , < & #.% 6 : $ ;.a % 2 % g *.; g ; c v , $ : 6 T ~ % u ; ( ",
|
||||
"g Z # : O.L ] # 6 N a T # % , D p d % % = F ` ; Z = f [ , % $ u ",
|
||||
"v % @ # 1 Z = 1 $ % $ ; 6 % v l A @ @ ; & j $ ; # $ ; a . I S : ",
|
||||
"# $ g l $ $ , M t % = f G , ; $ ; # z , 2 6 # 7 L ~ ; 7 % u 6 ; ",
|
||||
") % 0 z e , # a % ; % # 9 N $ -.n , < 6 > k $ & $ % $ # % < 4 $ ",
|
||||
": : ; $ % } b d , I | l $ $ # l W % / z ~ 3.S ; * f #.S e 3 ; * ",
|
||||
"0 6 % p s N J k = > J [ & D @ R N 8 3 9 3 O.m ; # % E % 2 % 9 A ",
|
||||
"v $ $ $ , : 4 : % * ; % 6 4 % % % % O < % % 2 % % > D @ ; q % z ",
|
||||
"# 2 ] z % , % # l N 0 # | +.4.p % q O.A $ r # a ; w = , A g m o ",
|
||||
"( i 0 c 7 j % ] l 6 , % 2 G N % > J A o.# 7 a W Q A + n k [ % ",
|
||||
"k M 9 @ S M # 2 $ 6 ] , # % % % % % n # # Q * 2 % d .d < 9 % ; ",
|
||||
"u u # $ Z 1.Z % % m P 9 = _ @ A x % $ ; I <.L $ $ g P ~ % % y [ ",
|
||||
"p $ % : u g a $ D % $ % G H % A y : ; % @.M 2 9 $ % # 3 @ f ; $ ",
|
||||
"7 K z y % # ; % 6 ] 7 , V ,.d 6 % % O.% $ ; % B ; % y ; ; $ =.I ",
|
||||
"J 7 g < u I $ M x O.% # 7 Z ; 1 9 ] [ s $ 2 # 6 { i q O ] f A , ",
|
||||
"u ; .., ; A u ~ N $ ; $ + $ 1 l % % f a , % # A z % % $ 3 n 9 % "
|
||||
};
|
||||
45
textures/sandy_32.xpm
Normal file
45
textures/sandy_32.xpm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* XPM */
|
||||
static char *b2ffa1f3349541dfd85c9d78164cd8f5fwrUjFoX83Qd2gcH[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 7 1",
|
||||
" c #747474",
|
||||
". c gray50",
|
||||
"X c gray56",
|
||||
"o c #9D9D9D",
|
||||
"O c gray64",
|
||||
"+ c gray66",
|
||||
"@ c gray69",
|
||||
/* pixels */
|
||||
". .. . XX .XXX. ...XX. .XXXX.",
|
||||
" @@@+@++++OOO+++OOOooOO++++++++X",
|
||||
" +OOOO+OOO+++OO+@@+@@+ooOooO+OO.",
|
||||
" +++O+++OOO+OO++O+OO+++OooO+OO+ ",
|
||||
" +OOooooOOOOOoooooOOOOO++++++OOX",
|
||||
".@+OOooOooO++OoOOOO+O+++OO+++++X",
|
||||
"XOOO++OOO++++++@@@@@+++OO+OooOOX",
|
||||
".+@@@@@@++@@+OO++@@+++@@@++OO++X",
|
||||
"XOOO+@@OooOO++OO++@@@@@++@@OOO+ ",
|
||||
"XO+++++OOO++OO+++@@++@@@++OO+++.",
|
||||
".@@@@+OO++++++OO++OOOO+OooOooO@ ",
|
||||
" +@@+++++++OOOO++OOooOoooOOOOOO ",
|
||||
" OO+O+@@@@@+O+@@@@@OOOOO+++++++.",
|
||||
"XOOOOOOO@@+OOO+@+OOOooO+++@@@OO ",
|
||||
"XOOOoooooOooO++OOO+OO++OOOOO+++ ",
|
||||
"X++OOoOoOOOOOOOO++++OOOOO++++++.",
|
||||
"X+OO+++OO+OO+@@@@@@@+O++OO+OOOO.",
|
||||
"X@@@@@++@@@+++@@@++OOOO+++++OO+.",
|
||||
".++@@++OO+O+@@++@@++O+@@@++@@++X",
|
||||
" +@@@@+++++OO+@@++++OOO++@@@OOOX",
|
||||
" oO+++++OOOoooOoOO+OO+++OO+OOoOX",
|
||||
".+++OOO++O++OooOO+++++@@@@@@+++X",
|
||||
".++OO+++++@@@@@+@@++++++@@+OO+@X",
|
||||
"X++++++++@@@@+++++OO+OOOO+++OOOX",
|
||||
"X+OO+OOO++@+++OOooO+++OooooOooO.",
|
||||
".++OooO+@@@@+++OO+++OO+OoOOOOooX",
|
||||
".@@@@O+OOO++OO++OOO@@+++OO++O@@X",
|
||||
" @@+++OOO+++++OOOO+++OOOO++OOO+.",
|
||||
" +O+OO++@@@@@OOO++OO++++@@@@@@@ ",
|
||||
".OooO+OO+@@+++OOO+++++++++@+@@@ ",
|
||||
".++OOO+++O+OOooO+@@@@@+O+OOOOO+.",
|
||||
" .XXXX. .XXXXXX. X.. . .X..."
|
||||
};
|
||||
45
textures/wasteland_32.xpm
Normal file
45
textures/wasteland_32.xpm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* XPM */
|
||||
static char *f4be72bda4ec41cce3e231f3563262e6RzcICVlC9CbSzsPX[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 7 1 ",
|
||||
" c #5A595A",
|
||||
". c gray39",
|
||||
"X c #6A6D6A",
|
||||
"o c #787678",
|
||||
"O c gray50",
|
||||
"+ c #8B898B",
|
||||
"@ c #9C999C",
|
||||
/* pixels */
|
||||
"++@@@@@@@@@@@@@@@@@@@@@@@@@@+++ ",
|
||||
"+oO+++++++++++++++OO++++OO+OOO+ ",
|
||||
"+O++OO++O++O+++OOOO++OO++OooOo+ ",
|
||||
"@OOOO+O+++OooO++OO++O+OOOOOooOO ",
|
||||
"@O+ooO++OOoO++OOOOOOOOOo+OOOOOO ",
|
||||
"@++OooO++OO++OOOOO+OoO++OOOOOOO ",
|
||||
"@O+++OoOO+ooOOO+OOooO++OooOooOo ",
|
||||
"@OoOOOOOOOOOoOOO++OO+OOOOoooOoo ",
|
||||
"@OOoOoOOOoOOOOOOOOOOOOOOoOOOOOO ",
|
||||
"@OoooOOooO++OO+OoO+oooOooOO+OOO ",
|
||||
"@OoXooooOOO+++OOOoooOOoooooO++O ",
|
||||
"+ooXOoOoOOOoOOOOOOOO++OOXooOOoO ",
|
||||
"+oXXoOXooooOooooooO+oOXXoooooOO ",
|
||||
"OoXXXXOOooooooooOoooOOOXXXOOooo ",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.",
|
||||
".. . ... .............",
|
||||
"@@@@@@@@@@@@@++ +++@@@@@@@@@@@@@",
|
||||
"ooOoOO+++++OOOO +OO+O+++O+++OOOO",
|
||||
"OooOO++O+O++OOO @OOO+++OOOOOOOOO",
|
||||
"O+O++O++OOOO+OO @OOOOOOO+OOoOO++",
|
||||
"+OOOOOOOOOOOOOo @oOOO+++OOOOooO+",
|
||||
"OOOO+OOOO+OOoOo @OoO+ooOoOOOOooO",
|
||||
"O+OOO+O++OoOooX @oO++OooOOOO+OOO",
|
||||
"OO+++++OooOoOXX @oOO++OOOoOo++OO",
|
||||
"OOOO+OO+Oo+OoXX @oOOOOO++ooOOOOO",
|
||||
"++OOOOOooOooXoX +ooOoO+OO++O+OOO",
|
||||
"+OooOoOoO++oOoo +oooOOOoOO++OO++",
|
||||
"OOOooOoOoOXOOoo +OOoOooOoOOOO+OO",
|
||||
"OoXXoXooXXOOOoo +OooooooOOoOOOoo",
|
||||
"oooXXooooXXXooo OoOOOoooooOOOOOo",
|
||||
"XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX",
|
||||
"............ .............."
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue