WIP: deux flèches dans un espace d'un cube. affichage en cours (partiellement juste)
This commit is contained in:
parent
97b946d6c5
commit
89f6ffb83a
|
@ -553,7 +553,8 @@ bool graphics_shutdown(const void *gl_area)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
/*
|
/*
|
||||||
* Assigns a new load to the arrow at address (address)
|
* Assigns a new load to the arrow at address (address)
|
||||||
*/
|
*/
|
||||||
|
@ -649,6 +650,8 @@ static inline int erase_arrow (int arrows_nb, int address, int site, int x, int
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
static inline void show_user_action(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
static inline void show_user_action(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);
|
||||||
/*
|
/*
|
||||||
|
@ -679,6 +682,10 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("in set_arrow(), arrows_nb = %d address = %d\n", arrows_nb, address);
|
||||||
|
|
||||||
|
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\n", requested_weight);
|
if (requested_weight == 0) printf(" - set_arrow() invoked with requested weight = %2d\n", requested_weight);
|
||||||
|
|
||||||
if (TEST) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
if (TEST) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
||||||
|
@ -699,6 +706,39 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void print_buffers_array_head () {printf(" [rank] load | site x y z [address] buffer-vertex-1 buffer-vertex-2 buffer-lines\n");}
|
||||||
|
static inline void print_empty_buffers_array () {printf(" [NULL] ---- | ---- --- --- --- -1 --- --- ---\n");}
|
||||||
|
|
||||||
|
static void print_one_arrow_in_buffers (struct arrow_t *arrows, int i, int arrows_nb, int address) {
|
||||||
|
printf(" [%4d] = %2d | %2d, %2d, %2d, %2d, (%2d) %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n",\
|
||||||
|
i,
|
||||||
|
arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z,
|
||||||
|
address,
|
||||||
|
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 0],
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 1],
|
||||||
|
buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 2],
|
||||||
|
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 3],
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 4],
|
||||||
|
buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 5],
|
||||||
|
|
||||||
|
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 0],
|
||||||
|
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_vertex_origin [buffer_vertex_0_arrow + i]); printf("\n"); */
|
||||||
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_lines_origin [buffer_lines_0_arrow + i]); printf("\n"); */
|
||||||
|
print_buffers_array_head ();
|
||||||
|
for (int i = 0; i < arrows_nb; i++)
|
||||||
|
print_one_arrow_in_buffers(arrows_ptr, i, arrows_nb, address);
|
||||||
|
if (arrows_nb == 0) print_empty_buffers_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init space and arrows (= initial state)
|
* Init space and arrows (= initial state)
|
||||||
|
@ -804,7 +844,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
|
|
||||||
buffer_vertex_0_arrow = buffer_vertex_size;
|
buffer_vertex_0_arrow = buffer_vertex_size;
|
||||||
buffer_lines_0_arrow = buffer_lines_size;
|
buffer_lines_0_arrow = buffer_lines_size;
|
||||||
printf("buffer_vertex_0_arrow = %d (%d points) buffer_lines_0_arrow = %d (%d lines)\n",\
|
if (1) 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 */
|
||||||
|
@ -812,6 +852,9 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
/* #pragma omp parallel */
|
/* #pragma omp parallel */
|
||||||
/* { */
|
/* { */
|
||||||
/* while (arrows_nb < specif_arrows_nb){ */
|
/* while (arrows_nb < specif_arrows_nb){ */
|
||||||
|
|
||||||
|
arrows_nb = 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,
|
||||||
rand() % arbitrary + 1, // load / weight
|
rand() % arbitrary + 1, // load / weight
|
||||||
0,//rand() % 6, // site,
|
0,//rand() % 6, // site,
|
||||||
|
@ -836,24 +879,22 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N E W D A T A W I L L N O W B E S P E C I F I E D */
|
/* N E W D A T A W I L L N O W B E S P E C I F I E D */
|
||||||
|
|
||||||
/* A N D T H E N D R A W N E D */
|
/* A N D T H E N D R A W N E D */
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
if (1) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0);
|
/* if (1) 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, */
|
||||||
0,//rand() % arbitrary + 1, // load / weight
|
/* 0,//rand() % arbitrary + 1, // load / weight */
|
||||||
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);//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); */
|
||||||
|
|
||||||
/* 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,//rand() % arbitrary + 1, // load / weight */
|
/* 0,//rand() % arbitrary + 1, // load / weight */
|
||||||
|
@ -939,3 +980,4 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
arrows_ptr = NULL;
|
arrows_ptr = NULL;
|
||||||
arrows_nb = 0;
|
arrows_nb = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue