From 0870df7ff1b8fc89cc0c5c66c31c6ad80991646e Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 19 Jul 2023 17:49:30 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20Premi=C3=A8re=20repr=C3=A9sentation=20pa?= =?UTF-8?q?rfaite=20d'une=20matrice=20cubique.=20Reste=20deux=20boucles=20?= =?UTF-8?q?=C3=A0=20parametrer.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/buffers.c | 73 ++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/src/graphics/buffers.c b/src/graphics/buffers.c index bc26c45..0c87aad 100644 --- a/src/graphics/buffers.c +++ b/src/graphics/buffers.c @@ -332,7 +332,7 @@ static bool compute_space_3D (int space_size_x, // if (V) printf(" => vertex_ndx = %3d\n", vertex_ndx); *(color_origin + colors_ndx + 0) = x; - *(color_origin + colors_ndx + 1) = y / 2; + *(color_origin + colors_ndx + 1) = 3 * y / 2; *(color_origin + colors_ndx + 2) = z; colors_ndx += 3; @@ -345,42 +345,59 @@ static bool compute_space_3D (int space_size_x, if (P) printf("\n"); }; - for (int u = 0; u < vertex_ndx / 2; u ++){ - *(line_origin + lines_ndx) = u * 2; + for (int u = 0; u < (space_size_x + 1) * (space_size_y + 1); u ++){ + *(line_origin + lines_ndx) = u * (space_size_z + 1); lines_ndx += 1; - *(line_origin + lines_ndx) = u * 2 + 1; + *(line_origin + lines_ndx) = u * (space_size_z + 1) + 1; lines_ndx += 1; } - /* *(line_origin + lines_ndx) = 0; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 2; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 1; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 3; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 2; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 3; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 0; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 1; lines_ndx += 1; */ + *(line_origin + lines_ndx) = 0; lines_ndx += 1; + *(line_origin + lines_ndx) = 18; lines_ndx += 1; - /* *(line_origin + lines_ndx) = 20; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 22; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 21; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 23; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 22; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 23; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 20; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 21; lines_ndx += 1; */ + *(line_origin + lines_ndx) = 2; lines_ndx += 1; + *(line_origin + lines_ndx) = 20; lines_ndx += 1; - /* *(line_origin + lines_ndx) = 0; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 20; lines_ndx += 1; */ + *(line_origin + lines_ndx) = 4; lines_ndx += 1; + *(line_origin + lines_ndx) = 22; lines_ndx += 1; - /* *(line_origin + lines_ndx) = 1; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 21; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 2; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 22; lines_ndx += 1; */ + *(line_origin + lines_ndx) = 1; lines_ndx += 1; + *(line_origin + lines_ndx) = 19; lines_ndx += 1; + + *(line_origin + lines_ndx) = 3; lines_ndx += 1; + *(line_origin + lines_ndx) = 21; lines_ndx += 1; + + *(line_origin + lines_ndx) = 5; lines_ndx += 1; + *(line_origin + lines_ndx) = 23; lines_ndx += 1; + + + + *(line_origin + lines_ndx) = 0; lines_ndx += 1; + *(line_origin + lines_ndx) = 4; lines_ndx += 1; + + *(line_origin + lines_ndx) = 1; lines_ndx += 1; + *(line_origin + lines_ndx) = 5; lines_ndx += 1; + + *(line_origin + lines_ndx) = 6; lines_ndx += 1; + *(line_origin + lines_ndx) = 10; lines_ndx += 1; + + *(line_origin + lines_ndx) = 7; lines_ndx += 1; + *(line_origin + lines_ndx) = 11; lines_ndx += 1; + + + *(line_origin + lines_ndx) = 12; lines_ndx += 1; + *(line_origin + lines_ndx) = 16; lines_ndx += 1; + + *(line_origin + lines_ndx) = 13; lines_ndx += 1; + *(line_origin + lines_ndx) = 17; lines_ndx += 1; + + *(line_origin + lines_ndx) = 18; lines_ndx += 1; + *(line_origin + lines_ndx) = 22; lines_ndx += 1; + + *(line_origin + lines_ndx) = 19; lines_ndx += 1; + *(line_origin + lines_ndx) = 23; lines_ndx += 1; - /* *(line_origin + lines_ndx) = 3; lines_ndx += 1; */ - /* *(line_origin + lines_ndx) = 23; 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);