From 4d6ba3951a909edfd8b8a1e276badcfdf1cc672b Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 9 Aug 2023 13:56:22 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20=20Bon.=20=20Pour=20les=20petites=20?= =?UTF-8?q?=C3=A9toiles=20au=20centre=20des=20cubes,=20c'est=20OK.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/buffers.c | 61 ++++++++++++++++++++++------------------- src/graphics/graphics.c | 6 ++-- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/graphics/buffers.c b/src/graphics/buffers.c index d74f9ea..af368e7 100644 --- a/src/graphics/buffers.c +++ b/src/graphics/buffers.c @@ -230,9 +230,9 @@ static bool grids_intersections (long x, long y, long z, vertex_index += 3; - *(colors_origin + colors_index + 0) = 1;// 3 * vx / 2; - *(colors_origin + colors_index + 1) = 1;// 3 * vy / 2; - *(colors_origin + colors_index + 2) = 1;// 3 * vz / 2; + *(colors_origin + colors_index + 0) = 0.64f;// 3 * vx / 2; + *(colors_origin + colors_index + 1) = 0.64f;// 3 * vy / 2; + *(colors_origin + colors_index + 2) = 0.64f;// 3 * vz / 2; colors_index += 3; }; @@ -444,13 +444,6 @@ static bool draw_line (GLuint *lines_origin, int a, int b) *(lines_origin + lines_index) = b; lines_index ++; } -static bool draw_a_central_star(GLuint *lines_origin, long s, int x, int y, int z) -{ - draw_line (lines_origin, s + x * 12 + 0, s + x * 12 + 1); - draw_line (lines_origin, s + x * 12 + 2, s + x * 12 + 3); - draw_line (lines_origin, s + x * 12 + 4, s + x * 12 + 5); -} - static bool draw_an_arrow_0(GLuint *lines_origin, long s, int weight, int site, int x, int y, int z) { @@ -511,22 +504,39 @@ static bool draw_an_arrow_5(GLuint *lines_origin, long s, int weight, int site, draw_line (lines_origin, s + site + x * 12 + 3, s + site + x * 12 + 11); } -static bool draw_some_arrows (GLuint *lines_origin, long s, GLuint *arrows, int arrows_nb) +static bool draw_a_central_star(GLuint *lines_origin, long n) { - draw_a_central_star(lines_origin, s + 1, 0, 0, 0); - draw_a_central_star(lines_origin, s + 1, 1, 0, 0); - draw_a_central_star(lines_origin, s + 1, 2, 0, 0); + draw_line (lines_origin, n + 0, n + 1); + draw_line (lines_origin, n + 2, n + 3); + draw_line (lines_origin, n + 4, n + 5); +} + +static bool draw_some_arrows (GLuint *lines_origin, + long s, long x, long y, long z, + GLuint *arrows, int arrows_nb) +{ + long stx = z * y, sty = z, stz = 1; + long a = 0, b = 0, c = 0; + + a = 0, b = 0, c = 0; draw_a_central_star(lines_origin, s + 1 + 12 * (stx * a + sty * b + stz * c)); + a = 0, b = 0, c = 1; draw_a_central_star(lines_origin, s + 1 + 12 * (stx * a + sty * b + stz * c)); + a = 1, b = 1, c = 1; draw_a_central_star(lines_origin, s + 1 + 12 * (stx * a + sty * b + stz * c)); + a = 2, b = 2, c = 2; draw_a_central_star(lines_origin, s + 1 + 12 * (stx * a + sty * b + stz * c)); + +/* + draw_an_arrow_0(lines_origin, s, 1, 1, 0, 0, 0); + draw_an_arrow_1(lines_origin, s, 1, 1, 0, 0, 0); + draw_an_arrow_2(lines_origin, s, 1, 1, 0, 0, 0); + draw_an_arrow_3(lines_origin, s, 1, 1, 0, 0, 0); + draw_an_arrow_4(lines_origin, s, 1, 1, 0, 0, 0); + draw_an_arrow_5(lines_origin, s, 1, 1, 0, 0, 0); + draw_an_arrow_0(lines_origin, s, 1, 1, 1, 0, 0); - draw_an_arrow_1(lines_origin, s, 1, 1, 1, 0, 0); - draw_an_arrow_2(lines_origin, s, 1, 1, 1, 0, 0); - draw_an_arrow_3(lines_origin, s, 1, 1, 1, 0, 0); - draw_an_arrow_4(lines_origin, s, 1, 1, 1, 0, 0); - draw_an_arrow_5(lines_origin, s, 1, 1, 1, 0, 0); + draw_an_arrow_1(lines_origin, s, 1, 1, 1, 1, 0); - draw_an_arrow_0(lines_origin, s, 1, 1, 0, 0, 0); - draw_an_arrow_1(lines_origin, s, 1, 1, 2, 0, 0); +*/ } @@ -542,6 +552,7 @@ static bool draw_some_arrows (GLuint *lines_origin, long s, GLuint *arrows, int + static void show_user_choices(long model_size_x, long model_size_y, long model_size_z, @@ -618,17 +629,11 @@ bool compute_space_and_arrows(long model_size_x, long model_size_y, long model_s long s = step_z * model_size_z + step_y * model_size_y + step_x * model_size_x; - draw_some_arrows (lines_origin, s, arrows, model_arrows_nb); + draw_some_arrows (lines_origin, s, model_size_x, model_size_y, model_size_z, arrows, model_arrows_nb); return 0; } - // OLD ARROWS (DEPRECATED) - /* old_arrows (model_arrows_nb, model_size_x, model_size_y, model_size_z, arrows, */ - /* pref_style_lines_planes, pref_style_mix_colors, */ - /* vertex_origin, colors_origin, lines_origin, plans_origin); */ - - diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 54d50ed..0494706 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -567,14 +567,14 @@ static void get_model_data_and_user_preferences(){ model_space_size_x = 3; // 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 + model_space_size_y = 3; // 0 < model_space_size_y + model_space_size_z = 3; // 0 < model_space_size_z // XXX ONLY space drawed, no arrows model_arrows_nb = 8; // assert : l'emplacement des flèches est contraint // par model_space_size_x, y, z et le nombre de sites // OLD ARROWS (DEPRECATED) - nombre_de_cases_contenant_des_fleches = 3; // à calculer TODO + nombre_de_cases_contenant_des_fleches = 4; // à calculer TODO // pref_1D_shown_as_3D_xor_2D_space = 0; // 0 = 3D 1 = 2D // pref_1D_shown_as_3D_xor_2D_arrows = 0; // 0 = 3D 1 = 2D