From 35bd253b3d4d146f3d597704d7e854f1bc4990ab Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 15 Oct 2023 23:19:52 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20avant=20de=20reprendre=20enti=C3=A8remen?= =?UTF-8?q?t=20cette=20fonction:=20vx=20=3D=20(2=20*=20i=20/=20x=20-=201)?= =?UTF-8?q?=20*=20x=20/=20max=20+=20(1=20/=20max);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/arrows.c | 26 +++++++++++++------------- src/graphics/graphics.c | 9 ++++++--- src/graphics/grid.c | 13 +++++++++++-- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index bc099e7..c46c9da 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -173,14 +173,14 @@ static void show_one_arrow_data_1(int offset_vertex, int offset_colors, offset_vertex, offset_colors, weight, site, x, y, z); } -static void show_one_arrow_data_2(int offset_vertex, float max, int uxi, int uyi, int uzi, - float ux, float uy, float uz, float vx, float vy, float vz) +static void show_one_arrow_data_2(int offset_vertex, int max, int uxi, int uyi, int uzi, + int ux, int uy, int uz, float vx, float vy, float vz) { - printf("offset_vertex = %d max = %8.5f\n\ - xi = %6d yi = %6d zi = %6d\n\ - ux = %8.5f uy = %8.5f uz = %8.5f\n\ - vx = %8.5f vy = %8.5f vz = %8.5f\n",\ - offset_vertex, max, ux, uy, uz, vx, vy, vz); + printf("offset_vertex = %d (x3 = %d) max = %d\n\ + xi = %d yi = %d zi = %d\n\ + ux = %d uy = %d uz = %d\n\ + vx = %6.3f vy = %6.3f vz = %6.3f\n",\ + offset_vertex, offset_vertex * 3, max, ux, uy, uz, vx, vy, vz); } @@ -200,17 +200,17 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines, uyi = (2 * y) / space_Y_int, uzi = (2 * z) / space_Z_int; - float ux = uxi, uy = uyi, uz = uzi; + int ux = uxi, uy = uyi, uz = uzi; - float vx = (ux - 1.0f) * (space_X / max) + (1.0f / max), - vy = (uy - 1.0f) * (space_Y / max) + (1.0f / max), - vz = (uz - 1.0f) * (space_Z / max) + (1.0f / max); + float vx = (ux - 1) * (space_X / max) + (1.0f / max), + vy = (uy - 1) * (space_Y / max) + (1.0f / max), + vz = (uz - 1) * (space_Z / max) + (1.0f / max); show_one_arrow_data_2 (offset_vertex, max, uxi, uyi, uzi, ux, uy, uz, vx, vy, vz); // arrow_basis_width donne la dimension de l'étoile centrale - float arrow_basis_width = 0.3f * (1 / max), + GLfloat arrow_basis_width = 0.3f * (1 / max), // décale légèrement les pointes des flèches // pour qu'elles n'aillent pas jusqu'aux faces des cubes @@ -245,7 +245,7 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines, - float nuance = 0.24f; + GLfloat nuance = 0.24f; // X - X (EAST - WEST) axis - arrows tips (red - green) graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz); diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 60bfef1..178b2b1 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -153,7 +153,7 @@ void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z) buffer_vertex_size += 3; - //printf("Created vertex (%f,%f,%f), size is %d\n", x,y,z, buffer_vertex_size); + printf("new vertex : (%9.6f, %9.6f, %9.6f) <> buffer size : %3d\n", x,y,z, buffer_vertex_size); } /* @@ -891,11 +891,12 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style); - long offset_vertex = 0, offset_colors = 0, offset_lines = 0; // if this function is called first + int offset_vertex = 0, offset_colors = 0, offset_lines = 0; // if this function is called first write_space_ridges (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z); offset_vertex = 8, offset_colors = 8, offset_lines = 12; // if space edges are drawn - write_grids_on_space_faces (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, style); + write_grids_on_space_faces (offset_vertex, offset_colors, offset_lines, + space_X, space_Y, space_Z, style); /* ARROWS */ @@ -926,6 +927,8 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) weight, site, x, y, z); } + show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style); + free(arrows); arrows = NULL; arrows_nb = 0; diff --git a/src/graphics/grid.c b/src/graphics/grid.c index c09496c..58606f6 100644 --- a/src/graphics/grid.c +++ b/src/graphics/grid.c @@ -19,16 +19,25 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * aint with this program. If not, see . + * along with this program. If not, see . */ #include "../../include/base.h" #include "../../include/graphics.h" +/* void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z) { */ +/* buffer_vertex_origin = g_realloc (buffer_vertex_origin, (buffer_vertex_size + 3) * sizeof(GLfloat)); */ +/* buffer_vertex_origin[buffer_vertex_size + 0] = x; */ +/* buffer_vertex_origin[buffer_vertex_size + 1] = y; */ +/* buffer_vertex_origin[buffer_vertex_size + 2] = z; */ +/* buffer_vertex_size += 3; */ +/* //printf("Created vertex (%f,%f,%f), size is %d\n", x,y,z, buffer_vertex_size); */ +/* } */ + + void write_space_ridges (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z) { float max = fmax(x, y); max = fmax(max, z); - graphics_write_vertex (offset_vertex - x / max, offset_vertex - y / max, - z / max); graphics_write_vertex (offset_vertex + x / max, offset_vertex - y / max, - z / max);