WIP: une erreur sur la position x ? Commentaires à voir

This commit is contained in:
Jean Sirmai 2023-11-05 17:34:25 +01:00
parent 26f3d2eb2b
commit 214eebc378
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 15 additions and 9 deletions

View File

@ -36,6 +36,7 @@
#define FRAG_SHADER_FILE "src/shaders/shader.frag" #define FRAG_SHADER_FILE "src/shaders/shader.frag"
static struct arrow_t *arrows_ptr; static struct arrow_t *arrows_ptr;
static GLuint *address_ptr;
GLfloat *buffer_vertex_origin = NULL; GLfloat *buffer_vertex_origin = NULL;
GLfloat *buffer_colors_origin = NULL; GLfloat *buffer_colors_origin = NULL;
@ -697,6 +698,8 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int spac
if (console) printf("in set_arrow (begin) arrows_nb = %d requested site: %d > ", arrows_nb, site); if (console) printf("in set_arrow (begin) arrows_nb = %d requested site: %d > ", arrows_nb, site);
/* if (console) for (int i = 0; i < arrows_nb; i++) {printf(" [%d] = %d ", i, arrows_ptr[i].site); if (site == arrows_ptr[i].site) break;} */ /* if (console) for (int i = 0; i < arrows_nb; i++) {printf(" [%d] = %d ", i, arrows_ptr[i].site); if (site == arrows_ptr[i].site) break;} */
if (0) printf("In set_arrow() address_ptr \n");
for (int i = 0; i < arrows_nb; i++) for (int i = 0; i < arrows_nb; i++)
if ((site == arrows_ptr[i].site) if ((site == arrows_ptr[i].site)
&& (arrow_x == arrows_ptr[i].x) && (arrow_x == arrows_ptr[i].x)
@ -758,7 +761,7 @@ 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 randomize = 0, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1; int randomize = 80, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1;
if (randomize) { if (randomize) {
space_X = 1 + rand() % randomize; space_X = 1 + rand() % randomize;
space_Y = 1 + rand() % randomize; space_Y = 1 + rand() % randomize;
@ -767,6 +770,9 @@ void main_test_graphics (void)
int density_max = space_X * space_Y * space_Z, specified_arrows_nb = density_max; int density_max = space_X * space_Y * space_Z, specified_arrows_nb = density_max;
/* int max = fmax(space_X, space_Y); max = fmax(max, space_Z); */ /* int max = fmax(space_X, space_Y); max = fmax(max, space_Z); */
int sites_nb = 6;
address_ptr = g_malloc(space_X * space_Y * space_Z * sites_nb);
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
@ -819,15 +825,15 @@ void main_test_graphics (void)
/* else for (int i = 0; i < 6; i++) */ /* else for (int i = 0; i < 6; i++) */
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 0); */ /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 0); */
/* int angle = 9; */ int angle = 9;
/* if (space_X > angle && space_Y > angle && space_Z > angle) for (int i = 0; i < angle; i++) */ if (space_X > angle && space_Y > angle && space_Z > angle) for (int i = 0; i < angle; i++)
/* for (int u = 0; u < angle; u++) for (int v = 0; v < angle; v++) for (int w = 0; w < angle; w++) */ for (int u = 0; u < angle; u++) for (int v = 0; v < angle; v++) for (int w = 0; w < angle; w++)
/* if (u + v + w < angle * 3) */ if (u + v + w < angle * 3)
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, u, v, w, 0); */ arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, u, v, w, 0);
/* if (space_X > angle && space_Y > angle && space_Z > angle) */ if (space_X > angle && space_Y > angle && space_Z > angle)
/* printf("+ effacement des flèches dans l'angle-origine\ */ printf("+ effacement des flèches dans l'angle-origine\
/* <=> contrôle graphique de la fonction erase_arrow()\n"); */ <=> contrôle graphique de la fonction erase_arrow()\n");
if (1) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 0, 0); if (1) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 0, 0);