WIP: retour au garage pour de petits travaux de peinture.
This commit is contained in:
parent
d29c19636b
commit
be944a2305
|
@ -672,13 +672,15 @@ static inline int create_arrow (int arrows_nb,
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int erase_arrow (int arrows_nb, int address_of_the_arrow_to_erase_in_the_arrows_list,
|
static inline int erase_arrow (int arrows_nb, int arrow_address_in_list,
|
||||||
int site, int x, int y, int z,
|
int site, int x, int y, int z,
|
||||||
int console)
|
int console)
|
||||||
{
|
{
|
||||||
if (arrows_nb == 0) assert (buffer_lines_size == buffer_lines_0_arrow); // ?
|
if (arrows_nb == 0) assert (buffer_lines_size == buffer_lines_0_arrow); // ?
|
||||||
if (arrows_nb == 0) {buffer_lines_size = buffer_lines_0_arrow; return 0;}
|
if (arrows_nb == 0) {buffer_lines_size = buffer_lines_0_arrow; return 0;}
|
||||||
|
|
||||||
|
if (1) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
||||||
|
|
||||||
assert (arrows_nb);
|
assert (arrows_nb);
|
||||||
arrows_nb --;
|
arrows_nb --;
|
||||||
|
|
||||||
|
@ -699,30 +701,27 @@ static inline int erase_arrow (int arrows_nb, int address_of_the_arrow_to_erase_
|
||||||
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
/* 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"); */
|
/* else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); */
|
||||||
|
|
||||||
if (address_of_the_arrow_to_erase_in_the_arrows_list < arrows_nb)
|
if (arrow_address_in_list < arrows_nb)
|
||||||
{
|
{
|
||||||
int mem = arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].site;
|
int mem = arrows_ptr[arrow_address_in_list].site;
|
||||||
|
|
||||||
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].load = arrows_ptr[arrows_nb].load;
|
arrows_ptr[arrow_address_in_list].load = arrows_ptr[arrows_nb].load;
|
||||||
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].site = arrows_ptr[arrows_nb].site;
|
arrows_ptr[arrow_address_in_list].site = arrows_ptr[arrows_nb].site;
|
||||||
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].x = arrows_ptr[arrows_nb].x;
|
arrows_ptr[arrow_address_in_list].x = arrows_ptr[arrows_nb].x;
|
||||||
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].y = arrows_ptr[arrows_nb].y;
|
arrows_ptr[arrow_address_in_list].y = arrows_ptr[arrows_nb].y;
|
||||||
arrows_ptr[address_of_the_arrow_to_erase_in_the_arrows_list].z = arrows_ptr[arrows_nb].z;
|
arrows_ptr[arrow_address_in_list].z = arrows_ptr[arrows_nb].z;
|
||||||
|
|
||||||
|
|
||||||
if (console) printf("in erase_arrow() : arrows_nb decreases from %d to %d. the erased arrow was at address : %d\n\
|
if (console) printf("in erase_arrow() : arrows_nb decreases from %d to %d. the erased arrow was at address : %d\n\
|
||||||
: arrows_ptr[%d].site (value: %d) was replaced by %d (%d was the value of the last arrow.site)\n",\
|
: arrows_ptr[%d].site (value: %d) was replaced by %d (%d was the value of the last arrow.site)\n",\
|
||||||
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, arrow_address_in_list, arrow_address_in_list, \
|
||||||
mem, arrows_ptr[arrows_nb].site, arrows_ptr[arrows_nb].site);
|
mem, arrows_ptr[arrows_nb].site, arrows_ptr[arrows_nb].site);
|
||||||
|
|
||||||
for (long i = 0 + address_of_the_arrow_to_erase_in_the_arrows_list * 6;
|
for (long i = 0 + arrow_address_in_list * 6; i < 6 + arrow_address_in_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_size - 6 + i];
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i]
|
|
||||||
= buffer_vertex_origin [buffer_vertex_size - 6 + i];
|
|
||||||
|
|
||||||
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 + i] = buffer_colors_origin [buffer_colors_size - 6 + i];
|
||||||
= buffer_colors_origin [buffer_colors_size - 6 + i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
||||||
|
@ -766,15 +765,15 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int spac
|
||||||
void main_test_graphics (void)
|
void main_test_graphics (void)
|
||||||
{
|
{
|
||||||
srand(time(NULL)); int rand(void); void srand(unsigned int seed);
|
srand(time(NULL)); int rand(void); void srand(unsigned int seed);
|
||||||
int arbitrary = 3, randomize = 1, console = 0;
|
int randomize = 0, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1;
|
||||||
int arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1;
|
|
||||||
if (randomize) {
|
if (randomize) {
|
||||||
space_X = 1 + rand() % arbitrary;
|
space_X = 1 + rand() % randomize;
|
||||||
space_Y = 1 + rand() % arbitrary;
|
space_Y = 1 + rand() % randomize;
|
||||||
space_Z = 1 + rand() % arbitrary;
|
space_Z = 1 + rand() % randomize;
|
||||||
}
|
}
|
||||||
int density_max = space_X * space_Y * space_Z, specified_arrows_nb = rand() % density_max;
|
int density_max = space_X * space_Y * space_Z, specified_arrows_nb = rand() % density_max;
|
||||||
printf("density_max = %d; specified_arrows_nb = %d\n", density_max, specified_arrows_nb);
|
if (randomize) printf("density_max = %d; specified_arrows_nb = %d\n",\
|
||||||
|
density_max, specified_arrows_nb);
|
||||||
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
||||||
|
|
||||||
/* S P A C E */
|
/* S P A C E */
|
||||||
|
@ -789,7 +788,7 @@ void main_test_graphics (void)
|
||||||
|
|
||||||
/* A R R O W S */
|
/* A R R O W S */
|
||||||
|
|
||||||
if (1) for (int i = 0; i < specified_arrows_nb; i++)
|
if (randomize) for (int i = 0; i < specified_arrows_nb; i++)
|
||||||
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, // load
|
1, // load
|
||||||
rand() % 6, // site
|
rand() % 6, // site
|
||||||
|
@ -797,9 +796,11 @@ void main_test_graphics (void)
|
||||||
rand() % space_Y, // y
|
rand() % space_Y, // y
|
||||||
rand() % space_Z, // z
|
rand() % space_Z, // z
|
||||||
console);
|
console);
|
||||||
|
else for (int i = 0; i < 6; i++)
|
||||||
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 1, i, 0, 0, 0, 1);
|
||||||
int max_arrows_nb = arrows_nb;
|
int max_arrows_nb = arrows_nb;
|
||||||
|
|
||||||
if (1) for (int i = 0; i < specified_arrows_nb * 6; i++)
|
if (randomize) for (int i = 0; i < specified_arrows_nb * 6; i++)
|
||||||
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,
|
||||||
0, // load
|
0, // load
|
||||||
rand() % 6, // site
|
rand() % 6, // site
|
||||||
|
@ -807,8 +808,10 @@ void main_test_graphics (void)
|
||||||
rand() % space_Y, // y
|
rand() % space_Y, // y
|
||||||
rand() % space_Z, // z
|
rand() % space_Z, // z
|
||||||
console);
|
console);
|
||||||
|
else for (int i = 0; i < 6; i++)
|
||||||
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 1);
|
||||||
|
|
||||||
if (1) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0);
|
if (randomize || 1) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0);
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue