Compare commits
No commits in common. "a3f0483891ade5ad1636dbb27cfbf3c98ae175bb" and "4353caeff961683b258dc9498fdeb100070b4cc6" have entirely different histories.
a3f0483891
...
4353caeff9
|
@ -675,12 +675,8 @@ static inline int erase_arrow (int arrows_nb, int address_of_the_arrow_to_erase_
|
||||||
{
|
{
|
||||||
assert (arrows_nb);
|
assert (arrows_nb);
|
||||||
arrows_nb --;
|
arrows_nb --;
|
||||||
|
if (address_of_the_arrow_to_erase_in_the_arrows_list == arrows_nb)
|
||||||
/* Il ne faut pas réécrire ce qui suit: ces lignes dessinent maintenant à partir d'autres vertex */
|
{
|
||||||
/* 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 graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); */
|
|
||||||
|
|
||||||
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 graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
|
||||||
|
@ -689,12 +685,16 @@ static inline int erase_arrow (int arrows_nb, int address_of_the_arrow_to_erase_
|
||||||
if (new_arrows_colors_ptr) buffer_colors_origin = new_arrows_colors_ptr;
|
if (new_arrows_colors_ptr) buffer_colors_origin = new_arrows_colors_ptr;
|
||||||
else perror("In graphics.erase_arrow(), can't re_allocate for arrows colors buffer.\n");
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows colors buffer.\n");
|
||||||
|
|
||||||
buffer_vertex_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_vertex()
|
buffer_vertex_size -= 6; // <<< ceci n'est pas fait dans : graphics_write_vertex()
|
||||||
buffer_colors_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_colors()
|
buffer_colors_size -= 6; // <<< ceci n'est pas fait dans : graphics_write_colors()
|
||||||
buffer_lines_size -= 2; // <<< l'inverse de ce qui est fait dans : graphics_write_line()
|
buffer_lines_size -= 2; // <<< ceci n'est pas fait dans : graphics_write_line()
|
||||||
|
|
||||||
|
if (console) printf("in erase_arrow() : arrows_nb decreases from %d to %d. the erased arrow was at address : %d = %d : arrows_nb\n\
|
||||||
|
buffer_vertex_size - 6 = %ld buffer_lines_size - 2 = %ld\n",\
|
||||||
|
arrows_nb + 1, arrows_nb, address_of_the_arrow_to_erase_in_the_arrows_list, arrows_nb, buffer_vertex_size, buffer_lines_size);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
if (address_of_the_arrow_to_erase_in_the_arrows_list < arrows_nb)
|
|
||||||
{
|
|
||||||
int mem = arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].site;
|
int mem = arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].site;
|
||||||
|
|
||||||
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].load = arrows_ptr[arrows_nb].load;
|
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].load = arrows_ptr[arrows_nb].load;
|
||||||
|
@ -709,16 +709,35 @@ static inline int erase_arrow (int arrows_nb, int address_of_the_arrow_to_erase_
|
||||||
arrows_nb + 1, arrows_nb, address_of_the_arrow_to_erase_in_the_arrows_list, address_of_the_arrow_to_erase_in_the_arrows_list, \
|
arrows_nb + 1, arrows_nb, address_of_the_arrow_to_erase_in_the_arrows_list, address_of_the_arrow_to_erase_in_the_arrows_list, \
|
||||||
mem, arrows_ptr[arrows_nb].site, arrows_ptr[arrows_nb].site);
|
mem, arrows_ptr[arrows_nb].site, arrows_ptr[arrows_nb].site);
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
for (long i = 0 + address_of_the_arrow_to_erase_in_the_arrows_list * 6;
|
for (long i = 0 + address_of_the_arrow_to_erase_in_the_arrows_list * 6;
|
||||||
i < 6 + address_of_the_arrow_to_erase_in_the_arrows_list * 6; i++)
|
i < 6 + address_of_the_arrow_to_erase_in_the_arrows_list * 6; i++)
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i]
|
buffer_vertex_origin [buffer_vertex_0_arrow + i]
|
||||||
= buffer_vertex_origin [buffer_vertex_size - 6 + i];
|
= buffer_vertex_origin [buffer_vertex_size - 6 + i];
|
||||||
|
|
||||||
|
|
||||||
|
void *new_arrows_colors_ptr = g_realloc(buffer_colors_origin, buffer_colors_size * sizeof(GLfloat));
|
||||||
|
if (new_arrows_colors_ptr) buffer_colors_origin = new_arrows_colors_ptr;
|
||||||
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows colors buffer.\n");
|
||||||
|
|
||||||
for (long i = 0; i < 6; i++)
|
for (long i = 0; i < 6; i++)
|
||||||
buffer_colors_origin [buffer_colors_0_arrow + (address_of_the_arrow_to_erase_in_the_arrows_list + 4) * 6 + i]
|
buffer_colors_origin [buffer_colors_0_arrow + (address_of_the_arrow_to_erase_in_the_arrows_list + 4) * 6 + i]
|
||||||
= buffer_colors_origin [buffer_colors_size - 6 + i];
|
= buffer_colors_origin [buffer_colors_size - 6 + i];
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
buffer_vertex_size -= 6; // <<< ceci est fait dans : graphics_write_vertex() ???
|
||||||
|
buffer_colors_size -= 6; // <<< ceci est fait dans : graphics_write_colors() ???
|
||||||
|
buffer_lines_size -= 2; // <<< ceci est fait dans : graphics_write_line() ???
|
||||||
|
|
||||||
|
/* Il ne faut pas réécrire ce qui suit: ces lignes dessinent maintenant à partir d'autres vertex */
|
||||||
|
/* 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 graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); */
|
||||||
|
|
||||||
|
}
|
||||||
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
||||||
|
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
|
@ -813,12 +832,12 @@ void main_test_graphics (void)
|
||||||
console = 1;
|
console = 1;
|
||||||
|
|
||||||
/* If load == 0 then erase the arrow at this address v */
|
/* If load == 0 then erase the arrow at this address v */
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0, 0, 0, 0, console); */
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0, 0, 0, 0, console);
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 1, 0, 0, 0, console); */
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 1, 0, 0, 0, console);
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 2, 0, 0, 0, console); */
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 2, 0, 0, 0, console);
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 3, 0, 0, 0, console); */
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 3, 0, 0, 0, console);
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 4, 0, 0, 0, console); */
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 4, 0, 0, 0, console);
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 5, 0, 0, 0, console); */
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 5, 0, 0, 0, console);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue