From 1182e65eb87d38f105ac57d55b136078b5d483dc Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 2 Oct 2023 22:48:38 +0200 Subject: [PATCH] WIP: Test fonction 'set_arrow()' en cours; erreur affichage console mais graphisme 'quasi'ok --- src/graphics/graphics.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 2311288..d8cbc91 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -44,6 +44,8 @@ static volatile int buffer_lines_size = 0; static volatile int buffer_colors_size = 0; static volatile int buffer_plans_size = 0; +#define TEST 1 + /* * Dynamic array of ptrs to dynamically allocated gl_area_entry */ @@ -662,7 +664,7 @@ static int rewrite_arrow (GLuint *arrows, int arrows_nb, int address, int weight { *(arrows + address * 5 + 0) = weight; - show_arrows_array (arrows, arrows_nb, x, y, z); + if (! TEST) show_arrows_array (arrows, arrows_nb, x, y, z); return arrows_nb; } @@ -685,7 +687,7 @@ static int create_arrow (GLuint *arrows, int arrows_nb, int weight, int site, in arrows_nb ++; - show_arrows_array (arrows, arrows_nb, x, y, z); + if (! TEST) show_arrows_array (arrows, arrows_nb, x, y, z); return arrows_nb; } @@ -708,7 +710,7 @@ static int erase_arrow (GLuint *arrows, int arrows_nb, int address, int site, in buffer_lines_origin = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLuint)); - show_arrows_array (arrows, arrows_nb, x, y, z); + if (! TEST) show_arrows_array (arrows, arrows_nb, x, y, z); return arrows_nb; } @@ -750,9 +752,9 @@ static int set_arrow (GLuint *arrows, int arrows_nb, int requested_weight, int s if (address >= 0 && current_weight != requested_weight) return rewrite_arrow (arrows, arrows_nb, address/5, requested_weight, site, x, y, z); - if (address >= 0 && current_weight == requested_weight) show_arrows_array(arrows, arrows_nb, x, y, z); + if (! TEST && address >= 0 && current_weight == requested_weight) show_arrows_array(arrows, arrows_nb, x, y, z); - if (address == -1 && requested_weight == 0) show_arrows_array(arrows, arrows_nb, x, y, z); + if (! TEST && address == -1 && requested_weight == 0) show_arrows_array(arrows, arrows_nb, x, y, z); return arrows_nb; } @@ -809,7 +811,14 @@ void main_test_graphics (void) * are always defined (whether arrows are drawn or not). */ if (arrows_nb > 0) arrows_write_terminations (space_X, space_Y, space_Z); -// arrows_nb = set_arrow (arrows, arrows_nb, 0, 0, 0, 0, 0); +// for (int k = 0; k < arbitrary * arbitrary; k++) + for (int k = 0; k < 3; k++) + arrows_nb = set_arrow (arrows, arrows_nb, + rand() % arbitrary, // load / weight + rand() % 6, // site, + 0,//MIN (rand() % space_X, space_X - 1), // x + 0,//MIN (rand() % space_Y, space_Y - 1), // y + 0);//MIN (rand() % space_Z, space_Z - 1)); // z int weight = 0, site = 0, stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;