From 9b1c6bc77324bbdbeec647c3a8fdb6f63891a610 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 23 Jul 2023 23:40:12 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20Pourquoi=20ne=20puis-je=20=C3=A9tendre?= =?UTF-8?q?=20l'espace=20au-del=C3=A0=20de=207=20x=205=20x=204=20(x=20y=20?= =?UTF-8?q?z)=20=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/buffers.c | 101 ++++++++++++++++++++++++++++++++-------- src/graphics/graphics.c | 6 +-- 2 files changed, 84 insertions(+), 23 deletions(-) diff --git a/src/graphics/buffers.c b/src/graphics/buffers.c index 42d4000..78462aa 100644 --- a/src/graphics/buffers.c +++ b/src/graphics/buffers.c @@ -324,7 +324,7 @@ static bool compute_space_3D (int x, vy = (2 * j / (y - 1) - 1) * (y - 1) / max; vz = (2 * k / (z - 1) - 1) * (z - 1) / max; - *(vertex_origin + vertex_ndx + 0) = vx / 2; + *(vertex_origin + vertex_ndx + 0) = vx; *(vertex_origin + vertex_ndx + 1) = vy; *(vertex_origin + vertex_ndx + 2) = vz; @@ -332,7 +332,7 @@ static bool compute_space_3D (int x, *(color_origin + colors_ndx + 0) = vx; *(color_origin + colors_ndx + 1) = 3 * vy / 2; - *(color_origin + colors_ndx + 2) = vz; + *(color_origin + colors_ndx + 2) = 3 * vz / 2; colors_ndx += 3; // if (C) printf(" => colors_ndx = %3d\n", colors_ndx);23. @@ -343,26 +343,86 @@ static bool compute_space_3D (int x, if (P) printf("\n"); }; - for (int u = 0; u < y; u ++){ - for (int w = 0; w < z; w ++){ - *(line_origin + lines_ndx) = w + z * u; lines_ndx += 1; - *(line_origin + lines_ndx) = x * y * z - y * z + w + z * u; lines_ndx += 1; - } - } + int step_z = 1, step_y = z, step_x = y * z;//(y - 1) * (z - 1); - for (int u = 0; u < y; u ++){ - for (int w = 0; w < x; w ++){ - *(line_origin + lines_ndx) = z * y * w + z * u; lines_ndx += 1; - *(line_origin + lines_ndx) = z * y * w + z - 1 + z * u; lines_ndx += 1; - } - } + /* for (int u = 0; u < y; u ++){ */ + /* for (int w = 0; w < z; w ++){ */ + /* *(line_origin + lines_ndx) = w + z * u; lines_ndx += 1; */ + /* *(line_origin + lines_ndx) = x * y * z - y * z + w + z * u; lines_ndx += 1; */ + /* } */ + /* } */ + + /* for (int u = 0; u < y; u ++){ */ + /* for (int w = 0; w < x; w ++){ */ + /* *(line_origin + lines_ndx) = z * y * w + z * u; lines_ndx += 1; */ + /* *(line_origin + lines_ndx) = z * y * w + z - 1 + z * u; lines_ndx += 1; */ + /* } */ + /* } */ + + /* for (int u = 0; u < x; u ++){ */ + /* for (int w = 0; w < z; w ++){ */ + /* *(line_origin + lines_ndx) = z * y * u + w; lines_ndx += 1; */ + /* *(line_origin + lines_ndx) = z * y * u + z * y - z + w; lines_ndx += 1; */ + /* } */ + /* } */ + + *(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * 0; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * (x - 1); lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * 0; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 0 + step_y * (y - 1) + step_x * 0; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * 0; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * (z - 1) + step_y * 0 + step_x * 0; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 0 + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * 0; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * (z - 1) + step_y * 0 + step_x * (x - 1); lines_ndx += 1; + + + + *(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 3; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 3; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 4; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 3; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 4; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 4; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 4; lines_ndx += 1; + + + *(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 4; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 4; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 3; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 3; lines_ndx += 1; + *(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 3; lines_ndx += 1; - for (int u = 0; u < x; u ++){ - for (int w = 0; w < z; w ++){ - *(line_origin + lines_ndx) = z * y * u + w; lines_ndx += 1; - *(line_origin + lines_ndx) = z * y * u + z * (y - 1) + w; lines_ndx += 1; - } - } //if (S3) printf("space 3D buffer_lines (from-to) "); printf("nb lines / nb vertex = %d/%d ", lines_ndx / 2, vertex_ndx / 3); @@ -605,3 +665,4 @@ bool compute_space_and_arrows(int model_size_x, + diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index a741234..4f3b371 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -539,9 +539,9 @@ GLubyte arrows[] = { static void get_model_data_and_user_preferences(){ - model_space_size_x = 3; // 0 < model_space_size_x - model_space_size_y = 8; // 0 < model_space_size_y - model_space_size_z = 5; // 0 < model_space_size_z + model_space_size_x = 7; // 0 < model_space_size_x + model_space_size_y = 5; // 0 < model_space_size_y + model_space_size_z = 4; // 0 < model_space_size_z model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint // par model_space_size_x, y, z et le nombre de sites