WIP: Correction erreur variable globale/locale

This commit is contained in:
Jean Sirmai 2023-09-22 14:01:35 +02:00
parent 2d9526fb08
commit d7fb58872b
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 28 additions and 29 deletions

View File

@ -70,7 +70,7 @@ void write_arrow_lines_zenith_nadir (long s, int weight, int site);
void write_arrow_lines_south_north (long s, int weight, int site);
/*
* Writes the three lines that draw arrow basis (central star) into lines buffer
* Writes three lines that draw arrow basis (central star) into lines buffer
*
* @param n
*

View File

@ -153,9 +153,7 @@ void write_arrow_lines_south_north (long s, int weight, int site)
/*
* Writes lines for arrow basis into lines buffer
*
* @param n,
* weight,
* site
* @param n
*
* @return void
*/

View File

@ -35,7 +35,6 @@
static int model_space_size_x = 0;
static int model_space_size_y = 0;
static int model_space_size_z = 0;
static int central_stars_nb = 0;
static GLfloat *buffer_vertex_origin = NULL;
static GLfloat *buffer_colors_origin = NULL;
@ -52,44 +51,42 @@ static int buffer_plans_size = 0;
// assert : l'emplacement des flèches est contraint
// par model_space_size_x, y, z et le nombre de sites
static GLuint arrows[] = {
1, 0, 1, 0, 0,
1, 1, 1, 0, 0,
1, 2, 1, 0, 0,
1, 3, 1, 0, 0,
1, 4, 1, 0, 0,
1, 5, 1, 0, 0,
1, 0, 0, 0, 0,
1, 1, 0, 0, 0,
1, 2, 0, 0, 0,
1, 3, 0, 0, 0,
1, 4, 0, 0, 0,
1, 5, 0, 0, 0,
// load, site, x, y, z
};
static void show_user_choices(long space_size_x,
long space_size_y,
long space_size_z,
GLuint *arrows,
int prefer)
{
int arrows_nb = 3 * sizeof(arrows) / sizeof(arrows[0]);
int arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5;
printf("model + user constraints : space size x,y,z = %ld,%ld,%ld ", space_size_x, space_size_y, space_size_z);
if (arrows_nb > 0) printf("[%d] arrows ", arrows_nb);
if (prefer == 0) printf("prefer = %d <> show all grids ", prefer);
if (prefer == 1) printf("prefer = %d <> show no grid ", prefer);
if (prefer > 1) printf("pref_show_grids = %d ", prefer);
if (prefer == 0) printf("prefer = %d <> show all grids ", prefer);
if (prefer == 1) printf("prefer = %d <> show no grid ", prefer);
if (prefer > 1) printf("pref_show_grids = %d ", prefer);
if (arrows_nb == 0) printf("\tbuffer_vertex_size = %d\t lines = %d\n", buffer_vertex_size, buffer_lines_size);
if (arrows_nb > 0) printf("\n--- < arrows array >\
---\n[ n] load site x y z \n-----------------------------\n");
for (int i = 0; i < arrows_nb; i++) printf("[%2d] = %2d, %2d, %2d, %2d, %2d \n",\
if (arrows_nb > 0) printf("\n| < arrows array > \
|\n[ n] load site x y z \n-----------------------------\n");
for (int i = 0; i < arrows_nb; i++) printf("[%2d] = %2d, %2d, %2d, %2d, %2d\n",\
i, *(arrows + i * 5 + 0), *(arrows + i * 5 + 1), *(arrows + i * 5 + 2), *(arrows + i * 5 + 3), *(arrows + i * 5 + 4));
}
if (arrows_nb > 0) printf("-----------------------------\n");}
static void get_model_data_and_user_preferences()
{
model_space_size_x = 3; // 0 < model_space_size_x
model_space_size_x = 1; // 0 < model_space_size_x
model_space_size_y = 1; // 0 < model_space_size_y
model_space_size_z = 1; // 0 < model_space_size_z
central_stars_nb = sizeof(arrows) / sizeof(arrows[0]);
pref_show_grids = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
// xyz, 0, x, y, z, xy, xz, yz, xyz
show_user_choices(model_space_size_x, model_space_size_y, model_space_size_z,
arrows, pref_show_grids);
pref_show_grids);
}
/* -------------------------------------------------------------------------- */
@ -646,23 +643,24 @@ void main_test_graphics (void)
if (pref_show_grids > 0) grid_write_ridges (x, y, z);
int offset_after_grid = buffer_vertex_size / 3;
int offset_after_grids = buffer_vertex_size / 3;
if (1) printf("buffer_vertex_offset_after_ grid = %d\n", offset_after_grid);
if (1) printf("buffer_vertex_offset_after grids = %d (x+1)*(y+1)*(z+1) = %ld\n",\
offset_after_grids, (x+1)*(y+1)*(z+1));
/* ARROWS */
arrows_write_terminations (x, y, z);
int arrows_nb_ad_hoc = 6; // 3 * sizeof(arrows) / sizeof(arrows[0]) ??? TODO
int arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5;
for (int i = 0; i < arrows_nb_ad_hoc; i++) {
for (int i = 0; i < arrows_nb; i++) {
site = arrows[i * 5 + 1];
x = arrows[i * 5 + 2];
y = arrows[i * 5 + 3];
z = arrows[i * 5 + 4];
// cube coordinates = 12 * (stx * x + sty * y + stz * z);
arrow_offset = offset_after_grid + 12 * (stx * x + sty * y + stz * z);
arrow_offset = offset_after_grids + 12 * (stx * x + sty * y + stz * z);
arrows_write_basis (arrow_offset);
switch(site){
@ -673,8 +671,11 @@ void main_test_graphics (void)
}
}
int offset_after_arrows = buffer_vertex_size / 3, difference = offset_after_arrows - offset_after_grids;
// TODO Qu'est-ce que j'affiche, là ?! < À vérifier
if (1) printf("buffer_vertex_offset_after arrows = %d\n", offset_after_grid + arrows_nb_ad_hoc * 12);
if (1) printf("buffer_vertex_offset_after arrows = %d (%d - %d = %d, %d / 12 = %d cubes)\n",\
offset_after_arrows, offset_after_arrows, offset_after_grids,\
difference, difference, difference / 12);
if (0) printf("main_test_graphics [ok]\n");
}