WIP: une nécessaire correction des couleurs (lignes 646 sqq.) mais je ne sais pas encore pourquoi.

This commit is contained in:
Jean Sirmai 2023-10-28 13:10:57 +02:00
parent 9d859b0469
commit c2612d8e62
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 152 additions and 83 deletions

View File

@ -558,11 +558,11 @@ static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, i
/* /*
* Assigns a new load to the arrow at address (address) * Assigns a new load to the arrow at address (address)
*/ */
static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x, int y, int z) static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x, int y, int z, int console)
{ {
arrows_ptr[address].load = load; arrows_ptr[address].load = load;
if (0) print_arrows_array (arrows_ptr, arrows_nb, 2); if (console) print_arrows_array (arrows_ptr, arrows_nb, 2);
return arrows_nb; return arrows_nb;
} }
@ -573,7 +573,8 @@ static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x,
*/ */
static inline int create_arrow (int arrows_nb, static inline int create_arrow (int arrows_nb,
int space_X, int space_Y, int space_Z, int space_X, int space_Y, int space_Z,
int load, int site, int x, int y, int z) int load, int site, int x, int y, int z,
int console)
{ {
void *newptr = g_realloc(arrows_ptr, (arrows_nb + 1) * sizeof(struct arrow_t)); void *newptr = g_realloc(arrows_ptr, (arrows_nb + 1) * sizeof(struct arrow_t));
@ -588,12 +589,11 @@ static inline int create_arrow (int arrows_nb,
arrows_ptr[arrows_nb].y = y; arrows_ptr[arrows_nb].y = y;
arrows_ptr[arrows_nb].z = z; arrows_ptr[arrows_nb].z = z;
int print = 1;
write_one_arrow_vertex(space_X, space_Y, space_Z, write_one_arrow_vertex(space_X, space_Y, space_Z,
load, site, x, y, z, print); load, site, x, y, z, console);
buffer_colors_size = buffer_vertex_size; buffer_colors_size = buffer_vertex_size;
write_one_arrow_line (buffer_vertex_size / 3 - 2, print); write_one_arrow_line (buffer_vertex_size / 3 - 2, console);
arrows_nb ++; arrows_nb ++;
@ -605,7 +605,9 @@ static inline int create_arrow (int arrows_nb,
/* /*
* Removes an arrow at address (address) * Removes an arrow at address (address)
*/ */
static inline int erase_arrow (int arrows_nb, int address, int site, int x, int y, int z) static inline int erase_arrow (int arrows_nb, int address,
int site, int x, int y, int z,
int console)
{ {
arrows_nb --; arrows_nb --;
@ -615,41 +617,79 @@ static inline int erase_arrow (int arrows_nb, int address, int site, int x, int
arrows_ptr[address].y = arrows_ptr[arrows_nb].y; arrows_ptr[address].y = arrows_ptr[arrows_nb].y;
arrows_ptr[address].z = arrows_ptr[arrows_nb].z; arrows_ptr[address].z = arrows_ptr[arrows_nb].z;
for (int i = 0 + address; i < 6 + address; i++) /* for (int i = 0 + address; i < 6 + address; i++) */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + i] = buffer_vertex_origin[(long) buffer_vertex_size - 6 + i]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + i] = buffer_vertex_origin[(long) buffer_vertex_size - 6 + i]; */
/* for (int j = 0 + address; j < 4 + address; j++) */
/* buffer_lines_origin [(long) buffer_lines_0_arrow + j] = buffer_lines_origin[(long) buffer_lines_size - 4 + j]; */
for (int j = 0 + address; j < 4 + address; j++)
buffer_lines_origin [(long) buffer_lines_0_arrow + j] = buffer_lines_origin[(long) buffer_lines_size - 4 + j];
if (arrows_nb > 0) { if (arrows_nb > 0) {
int some_nb = 12; if (arrows_nb == 1) some_nb = 9; buffer_lines_size -= 2;
void *new_arrows_list_ptr = g_realloc(arrows_ptr, arrows_nb * sizeof(struct arrow_t)); void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat));
if (new_arrows_list_ptr) arrows_ptr = new_arrows_list_ptr; if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr;
else perror("In erase arrow, can't re_allocate for arrow list.\n"); else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n");
// Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6)
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6];
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5];
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_vertex_origin[(long) buffer_vertex_size - 4];
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3];
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2];
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1];
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6];
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5];
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4];
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3];
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2];
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1];
buffer_vertex_size -= 6;
buffer_colors_size -= 6;
void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat));
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr;
else perror("In graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
}
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
return arrows_nb;
}
/* if (0) { */
/* int some_nb = 12; if (arrows_nb == 1) some_nb = 9; */
/* void *new_arrows_list_ptr = g_realloc(arrows_ptr, arrows_nb * sizeof(struct arrow_t)); */
/* if (new_arrows_list_ptr) arrows_ptr = new_arrows_list_ptr; */
/* else perror("In erase arrow, can't re_allocate for arrow list.\n"); */
/* long unit = 24 * 3 * sizeof(GLfloat); // 4 * 3 * 4 = 48 sizeof(GLfloat) = 3 * 8 bits */ /* long unit = 24 * 3 * sizeof(GLfloat); // 4 * 3 * 4 = 48 sizeof(GLfloat) = 3 * 8 bits */
/* printf(" - erase_arrow() invoked with address = %d buffer_vertex_size - buffer_vertex_0_arrow = %d (for %d arrows)\n",\ */ /* printf(" - erase_arrow() invoked with address = %d buffer_vertex_size - buffer_vertex_0_arrow = %d (for %d arrows)\n",\ */
/* address, (long) buffer_vertex_size - buffer_vertex_0_arrow, arrows_nb + 1); */ /* address, (long) buffer_vertex_size - buffer_vertex_0_arrow, arrows_nb + 1); */
/* for (int i = 24; i < 36; i ++) printf(" %5.2f", buffer_vertex_origin[i]); printf("\n"); */ /* for (int i = 24; i < 36; i ++) printf(" %5.2f", buffer_vertex_origin[i]); printf("\n"); */
if (0) printf("buffer_vertex_0_arrow = %d arrows_nb * 3 = %d <<<<\n", buffer_vertex_0_arrow, arrows_nb * 3); /* if (0) printf("buffer_vertex_0_arrow = %d arrows_nb * 3 = %d <<<<\n", buffer_vertex_0_arrow, arrows_nb * 3); */
void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_0_arrow + some_nb * 3 * sizeof(GLfloat)); /* void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_0_arrow + some_nb * 3 * sizeof(GLfloat)); */
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; /* if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; */
else perror("In erase arrow, can't re_allocate for arrow vertex buffer.\n"); /* else perror("In erase arrow, can't re_allocate for arrow vertex buffer.\n"); */
/* if (0) printf("buffer_lines_0_arrow = %d arrows_nb * 2 = %d <<<<\n", buffer_lines_0_arrow, arrows_nb * 2); */
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_0_arrow + some_nb * 2 * sizeof(GLfloat)); */
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
/* else perror("In erase arrow, can't re_allocate for arrow lines buffer.\n"); */
/* } */
if (0) printf("buffer_lines_0_arrow = %d arrows_nb * 2 = %d <<<<\n", buffer_lines_0_arrow, arrows_nb * 2);
void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_0_arrow + some_nb * 2 * sizeof(GLfloat));
if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr;
else perror("In erase arrow, can't re_allocate for arrow lines buffer.\n");
}
printf(" >> bf_vrtx = %d bf_ln = %d\n", (buffer_vertex_size - 6) / 3, (buffer_lines_size - 4) / 2);
if (0) print_arrows_array (arrows_ptr, arrows_nb, 0);
return arrows_nb;
}
static inline void print_vertex_and_lines_buffers(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight, static inline void print_vertex_and_lines_buffers(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
int current_weight, int site, int x, int y, int z); int current_weight, int site, int x, int y, int z);
@ -665,7 +705,7 @@ static inline void show_user_action(struct arrow_t *arrows_ptr, int arrows_nb, i
*/ */
static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
int space_X, int space_Y, int space_Z, int space_X, int space_Y, int space_Z,
int requested_weight, int site, int x, int y, int z) int requested_weight, int site, int x, int y, int z, int console)
{ {
int address = -1, current_weight = -1; int address = -1, current_weight = -1;
@ -685,23 +725,24 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
} }
// print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); // print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
if (requested_weight == 0) printf(" - set_arrow() invoked with requested weight = %2d bf_vrtx = %d bf_ln = %d add: %d",\ if (requested_weight == 0 && console)
printf(" - set_arrow() invoked with requested weight = %2d bf_vrtx = %d bf_ln = %d add: %d",\
requested_weight, buffer_vertex_size / 3, buffer_lines_size / 2, address); requested_weight, buffer_vertex_size / 3, buffer_lines_size / 2, address);
if (TEST) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); if (console) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
if (address == -1 && requested_weight > 0) if (address == -1 && requested_weight > 0)
return create_arrow (arrows_nb, space_X, space_Y, space_Z, requested_weight, site, x, y, z); return create_arrow (arrows_nb, space_X, space_Y, space_Z, requested_weight, site, x, y, z, console);
if (address >= 0 && requested_weight == 0) if (address >= 0 && requested_weight == 0)
return erase_arrow (arrows_nb, address, site, x, y, z); return erase_arrow (arrows_nb, address, site, x, y, z, console);
if (address >= 0 && current_weight != requested_weight) if (address >= 0 && current_weight != requested_weight)
return rewrite_arrow (arrows_nb, address/5, requested_weight, site, x, y, z); return rewrite_arrow (arrows_nb, address/5, requested_weight, site, x, y, z, console);
if (! TEST && address >= 0 && current_weight == requested_weight) print_arrows_array(arrows_ptr, arrows_nb, 3); if (address >= 0 && current_weight == requested_weight && console) print_arrows_array(arrows_ptr, arrows_nb, 3);
if (! TEST && address == -1 && requested_weight == 0) print_arrows_array(arrows_ptr, arrows_nb, 4); if (address == -1 && requested_weight == 0 && console) print_arrows_array(arrows_ptr, arrows_nb, 4);
return arrows_nb; return arrows_nb;
} }
@ -805,7 +846,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* A R R O W S */ /* A R R O W S */
/* if (1) printf("buffer_vertex_size before writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */ /* if (0) printf("buffer_vertex_size before writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */
/* for (int i = 0; i < arrows_nb; i++) { */ /* for (int i = 0; i < arrows_nb; i++) { */
/* load = arrows_ptr[i].load; */ /* load = arrows_ptr[i].load; */
@ -819,7 +860,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* buffer_colors_size = buffer_vertex_size; */ /* buffer_colors_size = buffer_vertex_size; */
/* } */ /* } */
/* if (1) printf("buffer_vertex_size after writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */ /* if (0) printf("buffer_vertex_size after writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */
/*---------------------------------------------------------------*/ /*---------------------------------------------------------------*/
@ -844,7 +885,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
buffer_vertex_0_arrow = buffer_vertex_size; // Attention, à ce stade, pas de vertex redondant buffer_vertex_0_arrow = buffer_vertex_size; // Attention, à ce stade, pas de vertex redondant
buffer_lines_0_arrow = buffer_lines_size; buffer_lines_0_arrow = buffer_lines_size;
if (1) printf("buffer_vertex_0_arrow = %d (%d points) buffer_lines_0_arrow = %d (%d lines)\n",\ if (0) printf("buffer_vertex_0_arrow = %d (%d points) buffer_lines_0_arrow = %d (%d lines)\n",\
buffer_vertex_0_arrow, buffer_vertex_0_arrow / 3, buffer_lines_0_arrow, buffer_lines_0_arrow / 2); buffer_vertex_0_arrow, buffer_vertex_0_arrow / 3, buffer_lines_0_arrow, buffer_lines_0_arrow / 2);
/* A R R O W S */ /* A R R O W S */
@ -860,14 +901,14 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
0,//rand() % 6, // site, 0,//rand() % 6, // site,
0,//rand() % space_X, // x 0,//rand() % space_X, // x
0,//rand() % space_Y, // y 0,//rand() % space_Y, // y
0);//rand() % space_Z); // z 0, 0);//rand() % space_Z); // z
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
rand() % arbitrary + 1, // load / weight rand() % arbitrary + 1, // load / weight
1,//rand() % 6, // site, 1,//rand() % 6, // site,
0,//rand() % space_X, // x 0,//rand() % space_X, // x
0,//rand() % space_Y, // y 0,//rand() % space_Y, // y
0);//rand() % space_Z); // z 0, 0);//rand() % space_Z); // z
/* clock_gettime(CLOCK_REALTIME, &ts); < Je n'arrive pas à afficher les temps en cours d'exécutuion */ /* clock_gettime(CLOCK_REALTIME, &ts); < Je n'arrive pas à afficher les temps en cours d'exécutuion */
/* if (arrows_nb % 1000 == 0) {cpt++; printf("%8d", arrows_nb / 1000); if (cpt % 22 == 0) printf(" %f\n%10d | ", specif_arrows_nb / 1000, ts.tv_sec - t_initial);} */ /* if (arrows_nb % 1000 == 0) {cpt++; printf("%8d", arrows_nb / 1000); if (cpt % 22 == 0) printf(" %f\n%10d | ", specif_arrows_nb / 1000, ts.tv_sec - t_initial);} */
@ -885,14 +926,14 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/*--------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------*/
/* if (1) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */ /* if (0) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
1,//rand() % arbitrary + 1, // load / weight 1,//rand() % arbitrary + 1, // load / weight
2,//rand() % 6, // site, 2,//rand() % 6, // site,
0,//rand() % space_X, // x 0,//rand() % space_X, // x
0,//rand() % space_Y, // y 0,//rand() % space_Y, // y
0);//rand() % space_Z); // z 0, 0);//rand() % space_Z); // z
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */ /* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
@ -901,46 +942,74 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
3,//rand() % 6, // site, 3,//rand() % 6, // site,
0,//rand() % space_X, // x 0,//rand() % space_X, // x
0,//rand() % space_Y, // y 0,//rand() % space_Y, // y
0);//rand() % space_Z); // z 0, 0);//rand() % space_Z); // z
int address = 2; arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
0,//rand() % arbitrary + 1, // load / weight
0,//rand() % 6, // site,
0,//rand() % space_X, // x
0,//rand() % space_Y, // y
0, 0);//rand() % space_Z); // z
if (1) printf("buffer_lines_0_arrow = %d address = %d buffer_lines_size = %d >>>",\ /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
buffer_lines_0_arrow, address, buffer_lines_size); /* 0,//rand() % arbitrary + 1, // load / weight */
//buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 0] = buffer_lines_origin[(long) buffer_lines_size - 2]; /* 1,//rand() % 6, // site, */
//buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 1] = buffer_lines_origin[(long) buffer_lines_size - 1]; /* 0,//rand() % space_X, // x */
/* 0,//rand() % space_Y, // y */
/* 0, 0);//rand() % space_Z); // z */
buffer_lines_size -= 2; /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
/* 0,//rand() % arbitrary + 1, // load / weight */
/* 2,//rand() % 6, // site, */
/* 0,//rand() % space_X, // x */
/* 0,//rand() % space_Y, // y */
/* 0, 0);//rand() % space_Z); // z */
void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; /* 0,//rand() % arbitrary + 1, // load / weight */
else perror("In experience, can't re_allocate for arrows lines buffer.\n"); /* 3,//rand() % 6, // site, */
if (1) printf(">>> buffer_lines_size = %d\n", buffer_lines_size); /* 0,//rand() % space_X, // x */
/* 0,//rand() % space_Y, // y */
/* 0, 0);//rand() % space_Z); // z */
/* int address = 1; */
/* if (0) printf("buffer_lines_0_arrow = %d address = %d buffer_lines_size = %d >>>",\ */
/* buffer_lines_0_arrow, address, buffer_lines_size); */
/* //buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 0] = buffer_lines_origin[(long) buffer_lines_size - 2]; */
/* //buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 1] = buffer_lines_origin[(long) buffer_lines_size - 1]; */
/* buffer_lines_size -= 2; */
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); */
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
/* else perror("In experience, can't re_allocate for arrows lines buffer.\n"); */
/* if (0) printf(">>> buffer_lines_size = %d\n", buffer_lines_size); */
// Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6) /* // Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6) */
if (1) printf("buffer_vertex_0_arrow = %d address = %d buffer_vertex_size = %d >>>", buffer_vertex_0_arrow, address, buffer_vertex_size); /* if (0) printf("buffer_vertex_0_arrow = %d address = %d buffer_vertex_size = %d >>>", buffer_vertex_0_arrow, address, buffer_vertex_size); */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5]; */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_git vertex_origin[(long) buffer_vertex_size - 4]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_vertex_origin[(long) buffer_vertex_size - 4]; */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3]; */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2]; */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1]; /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1]; */
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; /* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; */
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; /* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; */
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; /* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; */
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; /* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; */
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; /* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; */
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; /* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; */
buffer_vertex_size -= 6; /* buffer_vertex_size -= 6; */
buffer_colors_size -= 6; /* buffer_colors_size -= 6; */
void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat)); /* void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat)); */
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; /* if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; */
else perror("In experience, can't re_allocate for arrows vertex buffer.\n"); /* else perror("In experience, can't re_allocate for arrows vertex buffer.\n"); */
if (1) printf(">>> buffer_vertex_size = %d\n", buffer_vertex_size); /* if (0) printf(">>> buffer_vertex_size = %d\n", buffer_vertex_size); */
@ -948,21 +1017,21 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
printf("buffer_lines_0_arrow = %d\n", buffer_lines_0_arrow); if (0) printf("buffer_lines_0_arrow = %d\n", buffer_lines_0_arrow);
for (long h = buffer_lines_0_arrow; h < buffer_lines_size; h++) { if (0) for (long h = buffer_lines_0_arrow; h < buffer_lines_size; h++) {
if (h == buffer_lines_0_arrow) printf("\n"); if (h == buffer_lines_0_arrow) printf("\n");
if (h % 2 == 0) printf("\n"); if (h % 2 == 0) printf("\n");
printf("%2d ", buffer_lines_origin [h]); printf("%2d ", buffer_lines_origin [h]);
} }
printf("\n"); if (0) printf("\n");
for (long a = buffer_vertex_0_arrow; a < buffer_vertex_size; a++) { if (0) for (long a = buffer_vertex_0_arrow; a < buffer_vertex_size; a++) {
if (a % 6 == 0) printf("\n"); if (a % 6 == 0) printf("\n");
if (a % 3 == 0) printf("\n"); if (a % 3 == 0) printf("\n");
printf("[%d] %5.2f ", a/3, buffer_vertex_origin [a]); printf("[%d] %5.2f ", a/3, buffer_vertex_origin [a]);
} }
printf("\n"); if (0) printf("\n");
@ -976,7 +1045,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* 0,//rand() % 6, // site, */ /* 0,//rand() % 6, // site, */
/* 0,//rand() % space_X, // x */ /* 0,//rand() % space_X, // x */
/* 0,//rand() % space_Y, // y */ /* 0,//rand() % space_Y, // y */
/* 0);//rand() % space_Z); // z */ /* 0, 0);//rand() % space_Z); // z */
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */ /* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
@ -985,14 +1054,14 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* 2,//rand() % 6, // site, */ /* 2,//rand() % 6, // site, */
/* 0,//rand() % space_X, // x */ /* 0,//rand() % space_X, // x */
/* 0,//rand() % space_Y, // y */ /* 0,//rand() % space_Y, // y */
/* 0);//rand() % space_Z); // z */ /* 0, 0);//rand() % space_Z); // z */
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, */ /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, */
/* 1,//rand() % arbitrary + 1, // load / weight */ /* 1,//rand() % arbitrary + 1, // load / weight */
/* 3,//rand() % 6, // site, */ /* 3,//rand() % 6, // site, */
/* 0,//rand() % space_X, // x */ /* 0,//rand() % space_X, // x */
/* 0,//rand() % space_Y, // y */ /* 0,//rand() % space_Y, // y */
/* 0);//rand() % space_Z); // z */ /* 0, 0);//rand() % space_Z); // z */
/* printf("On devrait avoir deux flèches Y+Y- (Zénith-Nadir) dessinées (au lieu des deux flèches X+X- Est-Ouest)...\n"); */ /* printf("On devrait avoir deux flèches Y+Y- (Zénith-Nadir) dessinées (au lieu des deux flèches X+X- Est-Ouest)...\n"); */
@ -1017,7 +1086,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* rand() % 6, // site, */ /* rand() % 6, // site, */
/* rand() % space_X, // x */ /* rand() % space_X, // x */
/* rand() % space_Y, // y */ /* rand() % space_Y, // y */
/* rand() % space_Z); // z */ /* rand() % space_Z, 0); // z */
/* } */ /* } */
/* } */ /* } */