WIP: Test fonction 'set_arrow()' en cours; erreur affichage console mais graphisme 'quasi'ok

This commit is contained in:
Jean Sirmai 2023-10-02 22:48:38 +02:00
parent 567a5ec07f
commit 1182e65eb8
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 15 additions and 6 deletions

View File

@ -44,6 +44,8 @@ static volatile int buffer_lines_size = 0;
static volatile int buffer_colors_size = 0; static volatile int buffer_colors_size = 0;
static volatile int buffer_plans_size = 0; static volatile int buffer_plans_size = 0;
#define TEST 1
/* /*
* Dynamic array of ptrs to dynamically allocated gl_area_entry * 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; *(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; return arrows_nb;
} }
@ -685,7 +687,7 @@ static int create_arrow (GLuint *arrows, int arrows_nb, int weight, int site, in
arrows_nb ++; 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; 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)); 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; 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) if (address >= 0 && current_weight != requested_weight)
return rewrite_arrow (arrows, arrows_nb, address/5, requested_weight, site, x, y, z); 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; return arrows_nb;
} }
@ -809,7 +811,14 @@ void main_test_graphics (void)
* are always defined (whether arrows are drawn or not). */ * are always defined (whether arrows are drawn or not). */
if (arrows_nb > 0) arrows_write_terminations (space_X, space_Y, space_Z); 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, int weight = 0, site = 0,
stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0; stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;