diff --git a/console -- ++.png b/console -- ++.png new file mode 100644 index 0000000..8d2a345 Binary files /dev/null and b/console -- ++.png differ diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 483ea00..f5fe21d 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -543,6 +543,26 @@ bool graphics_init_shaders(const void *gl_area) + +#define un_nombre_ad_hoc_que_je_mets_a_la_fin_du_tableau_pour_en_mesurer_la_taille 919191919 +#define c_est_idiot__ce_nombre_est_donné_à_la_lecture_du_fichier_XML 0 +#define ça_me_sert_juste_à_éviter_des_erreurs_pendant_le_débuguage 0 +GLuint arrows[] = { + /* 1, 0, 0, 0, 0, */ + /* 1, 1, 1, 0, 0, */ + /* 1, 2, 2, 1, 1, */ + /* 1, 3, 2, 2, 1, */ +// 1, 4, 3, 0, 0, +// 1, 5, 3, 0, 1, + /* 1, 1, 3, 0, 0, */ + /* 1, 0, 2, 0, 0, */ + /* 1, 5, 2, 1, 1, */ + /* 1, 4, 2, 1, 0, */ + /* 1, 4, 0, 1, 0, */ + /* 1, 5, 0, 1, 1, */ + un_nombre_ad_hoc_que_je_mets_a_la_fin_du_tableau_pour_en_mesurer_la_taille +// load, site, x, y, z +}; static void get_model_data_and_user_preferences(){ @@ -553,7 +573,12 @@ static void get_model_data_and_user_preferences(){ // XXX ONLY space drawed, no arrows yet - arrows_nb = 12; // assert : l'emplacement des flèches est contraint + long arrows_array_size = 0; + while (*(arrows + arrows_array_size) != un_nombre_ad_hoc_que_je_mets_a_la_fin_du_tableau_pour_en_mesurer_la_taille) + arrows_array_size ++; + printf("get_model_data_and_user_preferences (579) arrows_array_size = %ld (arrows_nb = %ld)\n", arrows_array_size, arrows_array_size / 5); + + arrows_nb = arrows_array_size / 5; // assert : l'emplacement des flèches est contraint // par model_space_size_x, y, z et le nombre de sites // central_stars_nb sera à calculer pour éviter de redessiner les central_stars TODO @@ -569,23 +594,6 @@ static void get_model_data_and_user_preferences(){ pref_test_diagonal = 0; } -GLuint arrows[] = { - 1, 0, 0, 0, 0, - 1, 1, 1, 0, 0, - 1, 2, 2, 1, 1, - 1, 3, 2, 2, 1, - 1, 4, 3, 0, 0, - 1, 5, 3, 0, 1, - 1, 1, 3, 0, 0, - 1, 0, 2, 0, 0, - 1, 5, 2, 1, 1, - 1, 4, 2, 1, 0, - 1, 4, 0, 1, 0, - 1, 5, 0, 1, 1, -// load, site, x, y, z -}; - - @@ -668,18 +676,21 @@ static bool rewrite_arrow (GLuint *arrows, long address, long weight, static bool create_arrow (GLuint *arrows, long weight, long site, long x, long y, long z) { - if (DETAIL) printf("create a new arrow with weight = %ld at (%ld, %ld, %ld, %ld)\n",\ + if (1) printf("create a new arrow with weight = %ld at (%ld, %ld, %ld, %ld)\n",\ weight, site, x, y, z); arrows_nb ++; + if (arrows_nb == 1) arrows = g_malloc(arrows_nb * 5 * sizeof(GLuint) * 2); + else arrows = g_realloc(arrows, arrows_nb * 5 * sizeof(GLuint) * 2); + buffer_lines_size += 14; buffer_lines_origin = g_realloc(buffer_lines_origin, buffer_lines_size * 2 * sizeof(GLuint) * 2); - *(arrows + arrows_nb + 0) = weight; - *(arrows + arrows_nb + 1) = site; - *(arrows + arrows_nb + 2) = x; - *(arrows + arrows_nb + 3) = y; - *(arrows + arrows_nb + 4) = z; + *(arrows + arrows_nb * 5 + 0) = weight; + *(arrows + arrows_nb * 5 + 1) = site; + *(arrows + arrows_nb * 5 + 2) = x; + *(arrows + arrows_nb * 5 + 3) = y; + *(arrows + arrows_nb * 5 + 4) = z; return 1; } @@ -711,7 +722,8 @@ static bool erase_arrow (GLuint *arrows, long address, static long check_for_arrow (GLuint *arrows, long site, long x, long y, long z) { - if (arrows_nb == 0) return -1; + if (arrows_nb <= 1) return -1; + printf("check_for_arrow (723) arrows_nb = %ld\n", arrows_nb); long address = -1, f_weight = -1, f_site = -1, f_x = -1, f_y = -1, f_z = -1; for (int i = 0; i < arrows_nb; i++) @@ -846,35 +858,35 @@ void graphics_init_buffers(const void *gl_area) model_space_size_z * model_space_size_y, model_space_size_z, arrows, arrows_nb); - sleep(0); +// sleep(0); - set_arrow(arrows, 0, 4, 3, 0, 0); - set_arrow(arrows, 0, 5, 3, 0, 1); - set_arrow(arrows, 0, 5, 2, 1, 1); - set_arrow(arrows, 0, 4, 2, 1, 0); - set_arrow(arrows, 0, 2, 2, 1, 1); - set_arrow(arrows, 0, 3, 2, 2, 1); - set_arrow(arrows, 0, 0, 0, 0, 0); - set_arrow(arrows, 0, 1, 1, 0, 0); - set_arrow(arrows, 0, 1, 3, 0, 0); - set_arrow(arrows, 0, 0, 2, 0, 0); - set_arrow(arrows, 0, 4, 0, 1, 0); - set_arrow(arrows, 0, 5, 0, 1, 1); +// set_arrow(arrows, 0, 4, 3, 0, 0); +// set_arrow(arrows, 0, 5, 3, 0, 1); + /* set_arrow(arrows, 0, 5, 2, 1, 1); */ + /* set_arrow(arrows, 0, 4, 2, 1, 0); */ + /* set_arrow(arrows, 0, 2, 2, 1, 1); */ + /* set_arrow(arrows, 0, 3, 2, 2, 1); */ + /* set_arrow(arrows, 0, 0, 0, 0, 0); */ + /* set_arrow(arrows, 0, 1, 1, 0, 0); */ + /* set_arrow(arrows, 0, 1, 3, 0, 0); */ + /* set_arrow(arrows, 0, 0, 2, 0, 0); */ + /* set_arrow(arrows, 0, 4, 0, 1, 0); */ + /* set_arrow(arrows, 0, 5, 0, 1, 1); */ - sleep(0); +// sleep(0); - set_arrow(arrows, 1, 0, 0, 0, 2); - set_arrow(arrows, 1, 1, 1, 0, 2); +// set_arrow(arrows, 1, 0, 0, 0, 2); + set_arrow(arrows, 4, 1, 1, 0, 2); // set_arrow(arrows, 0, 0, 0, 0, 2); // set_arrow(arrows, 0, 1, 1, 0, 2); - set_arrow(arrows, 1, 2, 0, 0, 2); - set_arrow(arrows, 1, 3, 0, 1, 2); +// set_arrow(arrows, 1, 2, 0, 0, 2); +// set_arrow(arrows, 1, 3, 0, 1, 2); - set_arrow(arrows, 3, 1, 1, 0, 2); +// set_arrow(arrows, 3, 1, 1, 0, 2); - if (1) set_arrow(arrows, -1, -1, -1, -1, -1); // I use this to see the variables state - // before "drawing_some_arrows + if (1) set_arrow(arrows, -1, -1, -1, -1, -1); // I use this to fprint the variables state + // before "drawing_some_arrows" draw_some_arrows (buffer_lines_origin, s, model_space_size_z * model_space_size_y, model_space_size_z,