From 6007f2751095c0b708e2bc63c21722e068ea6576 Mon Sep 17 00:00:00 2001 From: mcolonna Date: Tue, 12 Nov 2024 13:07:09 +0100 Subject: [PATCH] fix: render * fix: - fix texture for each direction (north texture is in north etc) - fix mirror textures (the left of each texture is at its left) - fix dimensions (walls are 1x1 for any window dimensions or FOV) - optimize render() dev: - add testmaps/good_directions_test.cub - add textures/test/*.xpm --- include/const.h | 4 +- include/include.h | 5 +- include/map.h | 6 +- include/render.h | 3 +- include/temp.h | 47 ------------ include/utils.h | 6 +- src/render.c | 122 +++++++++++++----------------- src/render_utils.c | 59 +++++++-------- src/render_utils.h | 38 +++++++++- testmaps/good_directions_test.cub | 13 ++++ textures/test/east.xpm | 89 ++++++++++++++++++++++ textures/test/north.xpm | 99 ++++++++++++++++++++++++ textures/test/south.xpm | 88 +++++++++++++++++++++ textures/test/west.xpm | 73 ++++++++++++++++++ 14 files changed, 488 insertions(+), 164 deletions(-) delete mode 100644 include/temp.h create mode 100644 testmaps/good_directions_test.cub create mode 100644 textures/test/east.xpm create mode 100644 textures/test/north.xpm create mode 100644 textures/test/south.xpm create mode 100644 textures/test/west.xpm diff --git a/include/const.h b/include/const.h index 62ce444..151cfe2 100644 --- a/include/const.h +++ b/include/const.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* const.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mc +#+ +:+ +#+ */ +/* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/31 17:00:59 by mc #+# #+# */ -/* Updated: 2024/11/07 19:26:53 by mc ### ########.fr */ +/* Updated: 2024/11/12 17:56:05 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/include/include.h b/include/include.h index 58ae764..188bf43 100644 --- a/include/include.h +++ b/include/include.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* include.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mc +#+ +:+ +#+ */ +/* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/31 16:22:09 by mc #+# #+# */ -/* Updated: 2024/10/31 18:03:26 by mc ### ########.fr */ +/* Updated: 2024/11/12 17:41:11 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,6 +23,7 @@ # include # include # include +# include # include # include # include diff --git a/include/map.h b/include/map.h index 60f549a..b63873b 100644 --- a/include/map.h +++ b/include/map.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* map.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mc +#+ +:+ +#+ */ +/* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/01 13:59:04 by mcolonna #+# #+# */ -/* Updated: 2024/11/06 19:24:03 by mc ### ########.fr */ +/* Updated: 2024/11/12 15:10:07 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -82,7 +82,7 @@ typedef struct s_player { // pos player on map (cases) t_point_double pos; - // player rotation (rad) + // player rotation (rad) (0 rad is -y / pi/2 rad is +x) double rot; } t_player; diff --git a/include/render.h b/include/render.h index 86d5134..da4d780 100644 --- a/include/render.h +++ b/include/render.h @@ -6,7 +6,7 @@ /* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/31 17:13:20 by mc #+# #+# */ -/* Updated: 2024/11/04 13:47:47 by mcolonna ### ########.fr */ +/* Updated: 2024/11/12 12:24:02 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,6 @@ # include "include.h" # include "utils.h" -# include "temp.h" # include "const.h" # include "global.h" diff --git a/include/temp.h b/include/temp.h deleted file mode 100644 index 73f1248..0000000 --- a/include/temp.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* temp.h :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: mc +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/10/31 17:04:08 by mc #+# #+# */ -/* Updated: 2024/11/07 19:07:25 by mc ### ########.fr */ -/* */ -/* ************************************************************************** */ - -// DEBUG remove temp.h - -#ifndef TEMP_H -# define TEMP_H - -# include "include.h" - -# include "utils.h" - -# define TEX_WIDTH 64 -# define TEX_HEIGHT 64 - -typedef struct s_tex -{ - void *textures[4]; - void *current_tex; - int tex_height; - int tex_width; - int tex_dir; - int tex_x; - int tex_y; - int bpp; - int size_line; - int endian; -} t_tex; - -typedef struct s_ray -{ - // pos player on map (cases) - t_point_double dir; - bool side; - double wallx; -} t_ray; - -#endif diff --git a/include/utils.h b/include/utils.h index c8f82ae..a8c5c66 100644 --- a/include/utils.h +++ b/include/utils.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* utils.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mc +#+ +:+ +#+ */ +/* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/15 16:56:47 by mcolonna #+# #+# */ -/* Updated: 2024/11/07 19:07:03 by mc ### ########.fr */ +/* Updated: 2024/11/12 17:01:35 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -61,7 +61,7 @@ void timedloop(void (*f)(void)); uint32_t *get_data_addr(void *img_ptr); /// @brief Create a vector according to the angle with a specific norm. -/// (0 rad returns (0;-1) / pi/2 rad returns (1;0)) +/// (0 rad is -y / pi/2 rad is +x) /// /// @param vec This will be set to the result. /// @param angle Angle to use in radians. diff --git a/src/render.c b/src/render.c index 2a96395..0ae21df 100644 --- a/src/render.c +++ b/src/render.c @@ -3,21 +3,21 @@ /* ::: :::::::: */ /* render.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mc +#+ +:+ +#+ */ +/* By: Zy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/14 14:55:05 by greg #+# #+# */ -/* Updated: 2024/11/07 19:27:54 by mc ### ########.fr */ +/* Updated: 2024/11/13 17:53:57 by Zy ### ########.fr */ /* */ /* ************************************************************************** */ #include "render.h" #include "render_utils.h" -static void calculate_perpwalldist3(int x, - t_point_double *deltadist, - t_ray *ray) +// needs ray->x to be defined. +static void calculate_dir_and_deltadist(t_ray *ray) { - const double ray_direction = 2 * x / (double)SCREEN_WIDTH - 1; + const double ray_direction + = FOV * 2 * ray->x / (double)SCREEN_WIDTH - FOV; t_point_double plane; t_point_double dir; @@ -25,129 +25,111 @@ static void calculate_perpwalldist3(int x, vector_from_rotation(&plane, g_map.player.rot + PI / 2, 1); ray->dir.x = dir.x + plane.x * ray_direction; ray->dir.y = dir.y + plane.y * ray_direction; - deltadist->x = 1e30; + ray->deltadist.x = 1e30; if (ray->dir.x != 0) - deltadist->x = fabs(1 / ray->dir.x); - deltadist->y = 1e30; + ray->deltadist.x = fabs(1 / ray->dir.x); + ray->deltadist.y = 1e30; if (ray->dir.y != 0) - deltadist->y = fabs(1 / ray->dir.y); + ray->deltadist.y = fabs(1 / ray->dir.y); } -static void calculate_perpwalldist2(int x, - t_point_double *sidedist, - t_point_double *deltadist, - t_point_int *step, - t_ray *ray) +// needs ray->x to be defined. +// also defines ->dir and ->deltadist. +static void calculate_step_and_sidedist(t_ray *ray) { const int map_x = (int)g_map.player.pos.x; const int map_y = (int)g_map.player.pos.y; - calculate_perpwalldist3(x, deltadist, ray); + calculate_dir_and_deltadist(ray); if (ray->dir.x < 0) { - step->x = -1; - sidedist->x = (g_map.player.pos.x - map_x) * deltadist->x; + ray->step.x = -1; + ray->sidedist.x = (g_map.player.pos.x - map_x) * ray->deltadist.x; } else { - step->x = 1; - sidedist->x = (map_x + 1.0 - g_map.player.pos.x) * deltadist->x; + ray->step.x = +1; + ray->sidedist.x = (map_x + 1.0 - g_map.player.pos.x) * ray->deltadist.x; } if (ray->dir.y < 0) { - step->y = -1; - sidedist->y = (g_map.player.pos.y - map_y) * deltadist->y; + ray->step.y = -1; + ray->sidedist.y = (g_map.player.pos.y - map_y) * ray->deltadist.y; } else { - step->y = 1; - sidedist->y = (map_y + 1.0 - g_map.player.pos.y) * deltadist->y; + ray->step.y = +1; + ray->sidedist.y = (map_y + 1.0 - g_map.player.pos.y) * ray->deltadist.y; } } -/// @brief Calculate the distance of the wall perpendicularly to the camera -/// plane. -/// -/// @param x Ray direction x between 0 and 1. -/// @return Result. -static double calculate_perpwalldist(int x, t_ray *ray) +// needs ray->x to be defined. +// also defines ->dir, ->deltadist, ->step and ->sidedist. +static void calculate_side_and_perpwalldist(t_ray *ray) { t_point_int map_pos; - t_point_double sidedist; - t_point_double deltadist; - t_point_int step; map_pos.x = (int)g_map.player.pos.x; map_pos.y = (int)g_map.player.pos.y; - calculate_perpwalldist2(x, &sidedist, &deltadist, &step, ray); + calculate_step_and_sidedist(ray); while (map_get_case(&g_map, map_pos.x, map_pos.y)->wall == EMPTY) { - if (sidedist.x < sidedist.y) + if (ray->sidedist.x < ray->sidedist.y) { - sidedist.x += deltadist.x; - map_pos.x += step.x; + ray->sidedist.x += ray->deltadist.x; + map_pos.x += ray->step.x; ray->side = false; continue ; } - sidedist.y += deltadist.y; - map_pos.y += step.y; + ray->sidedist.y += ray->deltadist.y; + map_pos.y += ray->step.y; ray->side = true; } if (!ray->side) - return (sidedist.x - deltadist.x); - return (sidedist.y - deltadist.y); + ray->perpwalldist = ray->sidedist.x - ray->deltadist.x; + else + ray->perpwalldist = ray->sidedist.y - ray->deltadist.y; } /// @brief Draw a vertical line according to the ray direction x. /// /// @param x Ray direction x between 0 and 1. -static void draw_vertical_line(int x, u_int32_t *img_data, - t_ray *ray, t_tex *tex) +static void draw_vertical_line(u_int32_t *img_data, t_ray *ray) { - const double perpwalldist = calculate_perpwalldist(x, ray); - const int line_height = (int)(SCREEN_HEIGHT / perpwalldist); - int draw_start; - int draw_end; - int y; + int line_height; + int draw_start; + int draw_end; - ft_init_texture(perpwalldist, ray, tex); + calculate_side_and_perpwalldist(ray); + calculate_texdir_and_wallx(ray); + line_height = (int)(SCREEN_WIDTH / FOV / 2 / ray->perpwalldist); draw_start = -line_height / 2 + SCREEN_HEIGHT / 2; if (draw_start < 0) draw_start = 0; draw_end = line_height / 2 + SCREEN_HEIGHT / 2; if (draw_end >= SCREEN_HEIGHT) draw_end = SCREEN_HEIGHT - 1; - y = 0; - while (y++ < SCREEN_HEIGHT) + ray->y = 0; + while (ray->y++ < SCREEN_HEIGHT) { - if (y < draw_start) - img_data[y * SCREEN_WIDTH + x] = g_map.color_ceiling; - else if (y < draw_end) - { - draw_wall(tex, ray, line_height, x, y, img_data); - } + if (ray->y < draw_start) + img_data[ray->y * SCREEN_WIDTH + ray->x] = g_map.color_ceiling; + else if (ray->y < draw_end) + draw_wall(ray, line_height, img_data); else - img_data[y * SCREEN_WIDTH + x] = g_map.color_floor; + img_data[ray->y * SCREEN_WIDTH + ray->x] = g_map.color_floor; } } int render(u_int32_t *img_data) { - int x; t_ray ray; - t_tex tex; - tex.tex_width = 64; // TODO fix - tex.tex_height = 64; // TODO fix - tex.textures[NORTH] = g_map.textures[NORTH].image; - tex.textures[SOUTH] = g_map.textures[SOUTH].image; - tex.textures[WEST] = g_map.textures[WEST].image; - tex.textures[EAST] = g_map.textures[EAST].image; - x = 0; - while (x < SCREEN_WIDTH) + ray.x = 0; + while (ray.x < SCREEN_WIDTH) { - draw_vertical_line(x, img_data, &ray, &tex); - x++; + draw_vertical_line(img_data, &ray); + ray.x++; } return (0); } diff --git a/src/render_utils.c b/src/render_utils.c index 53289aa..6cfd96c 100644 --- a/src/render_utils.c +++ b/src/render_utils.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* render_utils.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mcolonna +#+ +:+ +#+ */ +/* By: Zy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/24 14:26:22 by grobledo #+# #+# */ -/* Updated: 2024/11/04 14:00:25 by mcolonna ### ########.fr */ +/* Updated: 2024/11/13 18:11:14 by Zy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,42 +15,39 @@ #include "const.h" #include "global.h" -void ft_init_texture(const double perpwalldist, t_ray *ray, t_tex *tex) +void calculate_texdir_and_wallx(t_ray *ray) { - if (ray->side == 0 && ray->dir.x < 0) - tex->tex_dir = 0; - if (ray->side == 0 && ray->dir.x >= 0) - tex->tex_dir = 1; - if (ray->side == 1 && ray->dir.y < 0) - tex->tex_dir = 2; - if (ray->side == 1 && ray->dir.y >= 0) - tex->tex_dir = 3; - if (ray->side == 0) - ray->wallx = g_map.player.pos.y + perpwalldist \ + if (ray->side && ray->dir.y < 0) + ray->texdir = NORTH; + if (ray->side && ray->dir.y >= 0) + ray->texdir = SOUTH; + if (!ray->side && ray->dir.x < 0) + ray->texdir = EAST; + if (!ray->side && ray->dir.x >= 0) + ray->texdir = WEST; + if (!ray->side) + ray->wallx = g_map.player.pos.y + ray->perpwalldist \ * ray->dir.y; else - ray->wallx = g_map.player.pos.x + perpwalldist \ + ray->wallx = g_map.player.pos.x + ray->perpwalldist \ * ray->dir.x; + if (ray->texdir == SOUTH || ray->texdir == EAST) + ray->wallx = -ray->wallx; ray->wallx -= floor((ray->wallx)); } -void draw_wall(t_tex *tex, t_ray *ray, const int line_height, int x, - int y, u_int32_t *img_data) +void draw_wall(t_ray *ray, const int line_height, u_int32_t *img_data) { - u_int32_t color; - u_int32_t *texture_data; - int texx; - int texy; + u_int32_t color; + u_int32_t *texture_data; + int texx; + int texy; + const t_texture texture = g_map.textures[ray->texdir]; - texy = ((y - (-line_height / 2 + SCREEN_HEIGHT / 2)) \ - * tex->tex_height) / line_height; - texx = (int)(ray->wallx * (double)tex->tex_width); - if (ray->side == 0 && ray->dir.x > 0) - texx = tex->tex_width - texx - 1; - if (ray->side == 1 && ray->dir.y < 0) - texx = tex->tex_height - texx - 1; - texture_data = (u_int32_t *)mlx_get_data_addr(tex->textures[tex->tex_dir], - &tex->bpp, &tex->size_line, &tex->endian); - color = texture_data[texx * tex->tex_width + texy]; - img_data[y * SCREEN_WIDTH + x] = color; + texy = ((ray->y - (-line_height / 2 + SCREEN_HEIGHT / 2)) + * texture.height) / line_height; + texx = (int)(ray->wallx * (double)texture.width); + texture_data = get_data_addr(texture.image); + color = texture_data[texy * texture.width + texx]; + img_data[ray->y * SCREEN_WIDTH + ray->x] = color; } diff --git a/src/render_utils.h b/src/render_utils.h index f3d8444..a0a055e 100644 --- a/src/render_utils.h +++ b/src/render_utils.h @@ -6,7 +6,7 @@ /* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/24 14:26:22 by grobledo #+# #+# */ -/* Updated: 2024/11/04 13:07:42 by mcolonna ### ########.fr */ +/* Updated: 2024/11/12 17:38:08 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,9 +15,39 @@ # include "render.h" -void ft_init_texture(const double perpwalldist, t_ray *ray, t_tex *tex); +typedef struct s_ray +{ + // Column of pixels currently drawing. + // Define the angle of the projected ray. + int x; + // With x, pixel to draw. + int y; + // Let the plane 1 case in front of the camera, of size FOV: + // point at which the ray projected touches the plane, relative to + // the camera position. + t_point_double dir; + // Transversal distance between two cases horizontally (for x) / + // vertically (for y), following the ray angle. + t_point_double deltadist; + // Direction of the ray, each component is either -1 or +1. + t_point_int step; + // Iterating perpwalldist for both north/south walls and east/west walls. + t_point_double sidedist; + // If true, the texture touched by the ray is facing north or south. + bool side; + // Distance between the wall touched by the ray and the camera plane. + double perpwalldist; + // x position of the point at which the ray touches the wall + // on the wall texture. + // Is in [0, 1[: 0 is the left side, 1 is the right side. + double wallx; + // Direction of the wall that the ray touches. + t_direction texdir; +} t_ray; -void draw_wall(t_tex *tex, t_ray *ray, const int line_height, int x, - int y, u_int32_t *img_data); +// needs ray->x, ->side and ->dir to be defined. +void calculate_texdir_and_wallx(t_ray *ray); + +void draw_wall(t_ray *ray, const int line_height, u_int32_t *img_data); #endif diff --git a/testmaps/good_directions_test.cub b/testmaps/good_directions_test.cub new file mode 100644 index 0000000..e405e17 --- /dev/null +++ b/testmaps/good_directions_test.cub @@ -0,0 +1,13 @@ +F 255,127,0 +C 0,2,67 +EA textures/test/east.xpm +NO textures/test/north.xpm +SO textures/test/south.xpm +WE textures/test/west.xpm + 111 +111110111 +10000N001 +111110111 + 101 + 101 + 111 diff --git a/textures/test/east.xpm b/textures/test/east.xpm new file mode 100644 index 0000000..f2d0762 --- /dev/null +++ b/textures/test/east.xpm @@ -0,0 +1,89 @@ +/* XPM */ +static char *east[] = { +/* columns rows colors chars-per-pixel */ +"79 80 3 1 ", +" c #FFB600", +". c #FFD000", +"X c white", +/* pixels */ +"......................................... ", +"......................................... ", +"......................................... ", +"........................................ ", +"........................................ ", +"...............................XXXXXXXXXXXXXXXXXXXXX ", +"..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"....................XXXXXXXXXXXXX....... XXXXXXXXXXXXXXX ", +"...............XXXXXXXXXXXX............. XXXXXXXXXXXXXXXXX ", +"...........XXXXXXXXXXX.................. XXXXXXXXXX ", +".......XXXXXXXXXX....................... XXX ", +".......XXXXXX........................... XX ", +".......XX............................... XX ", +".......XX............................... XX ", +"......XXX............................... XXX ", +"......XX................................ XXX ", +"......XX................................ XX ", +"......XX................................ XX ", +"......XX................................ XX ", +"......XX................................ XX ", +"......XX................................ XX ", +"......XX................................ XXX ", +"......XX............................... XX ", +"......XX............................... XX ", +".....XXX............................... XX ", +".....XXX....................XXXX....... XXXXXXXXX XXXXX XX ", +".....XX.......XXXXXXXXXXX..XXXXXX......XXXXXXXXXXX XXXXXXXX XX ", +".....XX......XXXXXXXXXXXX.XXXXXXXX....XXXXX XXXXXXXX XX ", +".....XX......XXX..........XXX..XXXX...XXX XXXXXXXX XX ", +".....XX......XX...........XX.....XXX..XX XXXXXXXXXX XX ", +".....XX......XX..........XXX.....XXX..XXX XXXXX XX XX ", +".....XX......XX..........XX.......XX..XXX XX XX ", +".....XX......XX..........XX.......XXX..XX XX XX ", +".....XX......XX..........XX.......XXX..XXX XX XX ", +".....XX......XX.........XXX........XX..XXXX XX XX ", +".....XX......XXXXXXXX...XXX........XX.. XXXX XX XX ", +".....XX......XXXXXXXX...XX.........XX.. XXXX XX XX ", +"....XXX......XX.........XX.........XX.. XXX XX XX ", +"....XXX......XX........XXXXXXXXXXXXXX.. XXX XX XX ", +"....XX.......XX........XXXXXXXXXXXXXX.. XXXX XX XX ", +"....XX.......XX........XX..........XX.. XXX XXX XX ", +"....XX.......XX........XX..........XX.. XXX XX XX ", +"....XX.......XX........XX..........XX.. XXXX XX XX ", +"....XX.......XX........XX..........XX.. XXX XX XX ", +"....XX.......XX........XX..........XX.. XX XX XX ", +"....XX.......XX........XX..........XX. XX XX XX ", +"....XX.......XX........XX..........XX. XX XXX XX ", +"....XX.......XX........XX..........XX. XX XXX XX ", +"....XX.......XX........XX..........XX. XXX XX XXX ", +"....XX.......XX........XX..........XX. XXXX XX XXX ", +"....XX.......XX........XX..........XX. XXXX XX XX ", +"....XX......XXXXXXXX...XX..........XX. XXXXXXXX XX XX ", +"....XX......XXXXXXXX...XX..........XX. XXXXXXX XX ", +"....XX................................ XX ", +"....XX................................ XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XXX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XX ", +"....XX............................... XXX ", +".....XXX............................. XXXX ", +".....XXXXXXX......................... XXXXX ", +"......XXXXXXXXXXXXXXXXX.............. XXXXXXXXXXXXXXXX ", +"..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +".....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +".................................... ", +".................................... ", +".................................... ", +".................................... ", +".................................... ", +".................................... ", +".................................... ", +".................................... " +}; diff --git a/textures/test/north.xpm b/textures/test/north.xpm new file mode 100644 index 0000000..e43acfa --- /dev/null +++ b/textures/test/north.xpm @@ -0,0 +1,99 @@ +/* XPM */ +static char *north[] = { +/* columns rows colors chars-per-pixel */ +"127 90 3 1 ", +" c #003BFF", +". c #006AFF", +"X c white", +/* pixels */ +"............................................................... ", +"............................................................... ", +"............................................................... ", +"............................................................... ", +"............................................................... XXXXXXXXXXXXX ", +"....XX.....................................................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"....XXX........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.. XXXXXXXXXXXXXX ", +"....XXXXXXXXXXXXX............................................. XXXXXXXXXXXX ", +"....XX........................................................ XXXXXXXX ", +"....XX........................................................ XX ", +"....XX........................................................ XX ", +"....XX........................................................ XX ", +"....XX........................................................ XXX ", +"....XX........................................................ XX ", +"....XX........................................................ XX ", +"....XX........................................................ XX ", +"....XX........................................................ XX ", +"....XX........................................................ XX ", +"....XXX....................................................... XXX ", +"....XXX....................................................... XXX ", +".....XX...................................................... XX ", +".....XX...................................................... XX ", +".....XX...................................................... XX ", +".....XX...................................................... XX ", +".....XX...................................................... XXX ", +".....XX...................................................... XXX ", +".....XX...................................................... XX ", +".....XX.....................................XXXX............. XX ", +".....XX...........................XX.......XXXXXX.......XXXXXX XX ", +".....XX...................XX......XX......XXXXXXX...XXXXXXXXXXXX XXXXXX XXX XX XXX ", +".....XX...................XXX.....XX.....XXXXX.XXX..XXXXXX.. XXXX XXXXXXXXXXXXXX XX XX XXX ", +".....XX...................XXXX....XXX...XXXXXX..XX....XXX... XXX XXXXXXXXXXXX XX XX XX ", +".....XX...................XXXX....XXX...XXX.....XX.....XX... XX XX XX XX XX ", +".....XX...................XXXXX....XX...XX......XX.....XX... XX XX XX XX XX ", +".....XX...................XX.XXX...XX..XXX......XXX...XXX... XX XX XX XX XX ", +".....XX...................XX.XXX...XX..XXX.......XX...XXX... XXX XX XXXXXXXX XX XX ", +".....XX...................XX..XXX..XX..XX........XX...XX.XXXXXXX XX XXXXXXXXXXXX XX ", +".....XX...................XX..XXX..XX..XX........XX...XX.XXXXXXX XXX XX XXXXXX XX ", +".....XX...................XX...XXX.XX..XX.......XXX...XX...XXXX XXX XX XXX XX ", +".....XX...................XX...XXX.XX..XXX......XXX...XX....XXXX XX XX XXX XX ", +".....XX...................XXX...XXXXX...XX.....XXX....XX... XXXX XXX XX XX XXX ", +".....XX...................XXX...XXXXX...XXX...XXXX....XX... XXX XXX XX XX XXX ", +".....XX....................XX....XXXX...XXXXXXXXX.....XX... XX XX XX XX ", +".....XX....................XX....XXXX....XXXXXXX......XX... XX XX ", +".....XX.................................................... XX ", +".....XX.................................................... XX ", +".....XX.................................................... XX ", +".....XX.................................................... XX ", +".....XX.................................................... XX ", +".....XX................................................... XX ", +".....XX................................................... XX ", +".....XXX.................................................. XX ", +".....XXX.................................................. XX ", +"......XX.................................................. XX ", +"......XX.................................................. XX ", +"......XX.................................................. XX ", +"......XX.................................................. XX ", +"......XXXX............................................... XX ", +"......XXXX............................................... XX ", +"......XXXX............................................... XXX ", +"......XXXX............................................... XXX ", +"......XXXX............................................... XX ", +".......XXX............................................... XX ", +".......XX................................................ XX ", +".......XX................................................ XX ", +".......XX................................................ XX ", +".......XX............................................... XX ", +".......XXX.............................................. XX ", +".......XXX.............................................. XX ", +"........XX.............................................. XX ", +"........XX.............................................. XX ", +"........XX.............................................. XX ", +"........XX.............................................. XX ", +"........XXXX............................................ XX ", +"........XXXXXXXX........................................ XX ", +"..........XXXXXXXXX..................................... XX ", +"...............XXXXXX................................... XX ", +".................XXXXXXX................................ XXXXXXX ", +"...................XXXXXXXXX............................ XXXXXXXXXXXXX ", +"......................XXXXXXXXXXX....................... XXXXXXXXXXXXXXX ", +"..........................XXXXXXXXXXXXXX................ XXXXXXXXXXXXXXXXXXX ", +"...............................XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX ", +"......................................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"........................................................XXXXXXXXXXXXXXXXXXXXXX ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ " +}; diff --git a/textures/test/south.xpm b/textures/test/south.xpm new file mode 100644 index 0000000..445a39d --- /dev/null +++ b/textures/test/south.xpm @@ -0,0 +1,88 @@ +/* XPM */ +static char *south[] = { +/* columns rows colors chars-per-pixel */ +"121 79 3 1 ", +" c #DD0E00", +". c #FF3B00", +"X c white", +/* pixels */ +"............................................................... ", +"............................................................... ", +"............................................................... ", +"............................................................... ", +"............................................................... ", +".................................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ", +"..........XXXX.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"..........XXXXXXXXXXXXXXXXXXXXXXXXX.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"..........XXXXXXXXXXXX......................................... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"..........XXX.................................................. XXXXXXXXXXXXXXXXXXXX ", +"..........XXX.................................................. XXXXXXXXXXX ", +"...........XX.................................................. XXX ", +"...........XX.................................................. XX ", +"..........XXX.................................................. XX ", +"..........XXX.................................................. XX ", +"..........XX................................................... XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX.................................................. XX ", +"..........XX..................XXXX............................ XX ", +".........XXX................XXXXXXX....................XX..... XX XX ", +".........XXX..............XXXXXX.XX......XX..XX........XX..... XX XX XX XX ", +".........XX...............XXXX..........XXX..XXXX......XX..... XX XXXXXXXX XX XX XX ", +".........XX..............XXX...........XXXX..XXXXX.....XX..... XX XXXXXXXXXXXXXX XX XX XX ", +".........XX..............XXX...........XXX.....XXXX....XX..... XXX XXXXXXXXX XX XX XX ", +".........XX..............XX...........XXX.......XXXX...XX..... XXX XXXXX XX XX XX ", +".........XX..............XX...........XXX.........XXX.XXX..... XX XXXX XXX XX XX ", +".........XX..............XXX..........XX...........XX.XX...... XX XXX XXX XX XX ", +".........XX..............XXXX........XXX...........XXXXX...... XX XXX XX XX XX ", +".........XX...............XXXXX......XX.............XXXX...... XX XX XX XXXX XX ", +".........XX................XXXXX.....XX.............XXXX...... XX XXX XXXXXXXXXXXXXX XX ", +".........XX..................XXXXX...XX.............XXXX...... XX XXX XXXXXXXXXXXXX XX ", +".........XX....................XXXX..XX.............XXXX...... XX XX XX XX XX ", +".........XX.....................XXXX.XX.............XXXX...... XXX XX XX XX XX ", +".........XX......................XXX.XX.............XXXXX..... XXX XX XX XX XX ", +".........XX.......................XX.XX.............XXXXX..... XX XX XX XX XX ", +".........XX.......................XX.XX............XXX.XXX....XXX XX XXX XX XX ", +".........XX.......................XX.XXX...........XX..XXX...XXXX XX XXX XX XX ", +".........XX.....................XXXX.XXX..........XXX...XXXXXXXX XX XX XXX XX ", +".........XX....................XXXX...XXX.........XXX....XXXXXX XX XX XXX XX ", +".........XX..................XXXXX....XXXX.......XXX......XXXX XX XX ", +".........XX.............XXXXXXXXX......XXXX.....XXXX.......... XX XX ", +".........XX.............XXXXXXX.........XXXXXXXXXXX........... XX XX ", +".........XX..............................XXXXXXXX............. XX ", +".........XX................................................... XXX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XX ", +".........XX................................................... XXX ", +".........XX................................................... XXX ", +".......XXXX....................XXXXXXXX....................... XX ", +".......XXXX...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX ", +".......XXXXXXXXXXXXXXXXXXXXXXXXXX.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX ", +"........XXXXXXXX............................................. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX ", +"............................................................. XXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"............................................................. XXXXXXX ", +"............................................................. ", +"............................................................. ", +"............................................................. ", +"............................................................. ", +"............................................................. " +}; diff --git a/textures/test/west.xpm b/textures/test/west.xpm new file mode 100644 index 0000000..1ebae09 --- /dev/null +++ b/textures/test/west.xpm @@ -0,0 +1,73 @@ +/* XPM */ +static char *west[] = { +/* columns rows colors chars-per-pixel */ +"117 64 3 1 ", +" c #38E200", +". c #3CF300", +"X c white", +/* pixels */ +"...................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"....................................................... ", +"............XXXX....................................... ", +"............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... XXXXXXXXXXXXXXXXXXXXXXXXX ", +"............XX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +"............XX.............................XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XXX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX..............XXX.............XX.....XXXXXX XXXXXXX XXXXXX XX ", +"............XX..............XXX....XX.......XX...XXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XX ", +"............XX..............XX.....XXX......XX..XXXX... XXXX XXXXXXX XXXXXX XX ", +"............XX..............XX.....XXX......XXX.XXX.... XX XXX XX XXX XX ", +"............XX..............XX.....XXX......XXX.XX..... XXXX XXX XX ", +"............XX..............XX.....XXX.......XX.XXX.... XXXXX XX XX ", +"............XX..............XX......XX......XXX..XXXX.. XXXXX XX XX ", +"............XX..............XX......XX......XXX..XXXXXXXXX XXXXX XXX XX ", +"............XX..............XX.....XXX......XX...XXXXXXXXX XXXX XX XX ", +"............XX..............XXX....XXXX....XXX..XXX.... XXX XXX XX ", +"............XX..............XXXX..XXXXXX..XXXX..XX..... XXX XXX XX ", +"............XX...............XXXXXXXXXXXXXXXX...XX..... XX XXX XX XX ", +"............XX................XXXXXX..XXXXXX....XXX...XXXXX XXXXXXXXXXX XX XX ", +"............XX..................XXX....XXXX.....XXXXXXXXXXX XXXXXXXXX XX XX ", +"............XX....................................XXXXXX XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX......................................... XX ", +"............XX.......................................... XX ", +"............XXX......................................... XX ", +"............XXX......................................... XX ", +".............XX......................................... XX ", +".............XX......................................... XX ", +".............XX......................................... XX ", +".............XX......................................... XX ", +".............XX......................................... XXX ", +".............XX..................................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +".............XXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", +".............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ", +".................XXXXXX................................. ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ ", +"........................................................ " +};