From f030bd72fbc05846cfba620ec1ff4ac55ef17558 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 11 Aug 2023 11:28:13 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20pr=C3=A9paration=20fonctions=20add/remov?= =?UTF-8?q?e=20arrow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/buffers.h | 4 +++- src/graphics/buffers.c | 9 +++++---- src/graphics/graphics.c | 11 +++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/buffers.h b/include/buffers.h index 5df5e51..2d7d759 100644 --- a/include/buffers.h +++ b/include/buffers.h @@ -44,5 +44,7 @@ bool compute_space_and_arrows(long model_space_size_x, GLuint *line_origin, GLuint *plan_origin); - +bool draw_some_arrows (GLuint *lines_origin, + long s, long stx, long sty, + GLuint *arrows, int arrows_nb); diff --git a/src/graphics/buffers.c b/src/graphics/buffers.c index 470b051..0cc81b8 100644 --- a/src/graphics/buffers.c +++ b/src/graphics/buffers.c @@ -467,7 +467,7 @@ static void draw_some_arrows_demo (GLuint *lines_origin, draw_an_arrow_North_or_South (lines_origin, s + 1 + 12 * (stx * a + sty * b + stz * c), 1, SOUTH); } -static void draw_some_arrows (GLuint *lines_origin, long s, long stx, long sty, +bool draw_some_arrows (GLuint *lines_origin, long s, long stx, long sty, GLuint *arrows, int arrows_nb) { long stz = 1; @@ -485,6 +485,7 @@ static void draw_some_arrows (GLuint *lines_origin, long s, long stx, long sty, if (site > 3 && site < 6) draw_an_arrow_North_or_South (lines_origin, s + 1 + 12 * (stx * x + sty * y + stz * z), 1, site); if (site > 1 && site < 4) draw_an_arrow_Zenith_or_Nadir (lines_origin, s + 1 + 12 * (stx * x + sty * y + stz * z), 1, site); } + return 1; } @@ -589,10 +590,10 @@ bool compute_space_and_arrows(long model_size_x, long model_size_y, long model_s if (pref_show_grid > 0) draw_ridges_3D (model_size_x, model_size_y, model_size_z, step_x, step_y, step_z, lines_origin); if (pref_test_diagonal) diagonal_test (model_size_x, model_size_y, model_size_z, step_x, step_y, step_z, lines_origin); - long s = step_z * model_size_z + step_y * model_size_y + step_x * model_size_x; +// long s = step_z * model_size_z + step_y * model_size_y + step_x * model_size_x; - if (0) draw_some_arrows_demo (lines_origin, s, model_size_x, model_size_y, model_size_z, arrows, model_arrows_nb); - if (1) draw_some_arrows (lines_origin, s, model_size_z * model_size_y, model_size_z, arrows, model_arrows_nb); +// if (0) draw_some_arrows_demo (lines_origin, s, model_size_x, model_size_y, model_size_z, arrows, model_arrows_nb); +// if (0) draw_some_arrows (lines_origin, s, model_size_z * model_size_y, model_size_z, arrows, model_arrows_nb); // draw_a_cube_at(1, 1, 1, lines_origin, model_size_x, model_size_y, model_size_z, 0); diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 34620d8..03263bb 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -721,6 +721,16 @@ void graphics_init_buffers(const void *gl_area) buffer_lines_origin, buffer_plans_origin); + long step_z = 1, + step_y = model_space_size_z + 1, + step_x = (model_space_size_z + 1) * (model_space_size_y + 1); + long s = step_z * model_space_size_z + step_y * model_space_size_y + + step_x * model_space_size_x; + + draw_some_arrows (buffer_lines_origin, s, + model_space_size_z * model_space_size_y, model_space_size_z, + arrows, model_arrows_nb); + GLuint vao, vertex_buffer, color_buffer; glGenBuffers(1, &vertex_buffer); @@ -822,3 +832,4 @@ void graphics_draw(const void *gl_area) +