diff --git a/première matrice 3D parametrable.png b/première matrice 3D parametrable.png new file mode 100644 index 0000000..204bff8 Binary files /dev/null and b/première matrice 3D parametrable.png differ diff --git a/src/graphics/buffers.c b/src/graphics/buffers.c index dd6c2f7..a45c412 100644 --- a/src/graphics/buffers.c +++ b/src/graphics/buffers.c @@ -52,8 +52,8 @@ int plans_ndx = 0; #define EDGE 0.999999 #define S 0 -#define S3 1 -#define SA 1 +#define S3 0 +#define SA 0 #define A3 0 #define L 0 @@ -328,15 +328,13 @@ static bool compute_space_3D (int size_x, *(vertex_origin + vertex_ndx + 1) = y; *(vertex_origin + vertex_ndx + 2) = z; - vertex_ndx += 3; - // if (V) printf(" => vertex_ndx = %3d\n", vertex_ndx); + vertex_ndx += 3; // if (V) printf(" => vertex_ndx = %3d\n", vertex_ndx); *(color_origin + colors_ndx + 0) = x; *(color_origin + colors_ndx + 1) = 3 * y / 2; *(color_origin + colors_ndx + 2) = z; - colors_ndx += 3; - // if (C) printf(" => colors_ndx = %3d\n", colors_ndx); + colors_ndx += 3; // if (C) printf(" => colors_ndx = %3d\n", colors_ndx); if (P) printf("(%1.0f*%1.0f*%1.0f)<>[%6.3f %6.3f %6.3f] ", i, j, k, x, y, z); } @@ -345,17 +343,25 @@ static bool compute_space_3D (int size_x, if (P) printf("\n"); }; - for (int u = 0; u < (size_x + 1) * (size_y + 1); u ++){ // << cette boucle est à remplacer, sur le modèle de la suivante. - *(line_origin + lines_ndx) = u * (size_z + 1); - lines_ndx += 1; - *(line_origin + lines_ndx) = u * (size_z + 1) + size_z; - lines_ndx += 1; + for (int u = 0; u < size_y + 1; u ++){ + for (int w = 0; w < size_z + 1; w ++){ + *(line_origin + lines_ndx) = w + (size_z + 1) * u; lines_ndx += 1; + *(line_origin + lines_ndx) = (size_x + 1) * (size_y + 1) * (size_z + 1) + - (size_y + 1) * (size_z + 1) + w + (size_z + 1) * u; lines_ndx += 1; + } + } + + for (int u = 0; u <= size_y; u ++){ + for (int w = 0; w < size_x + 1; w ++){ + *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * w + (size_z + 1) * u; lines_ndx += 1; + *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * w + size_z + (size_z + 1) * u; lines_ndx += 1; + } } for (int u = 0; u <= size_x; u ++){ for (int w = 0; w < size_y; w ++){ - *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + w; lines_ndx += 1; - *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + (size_z + 1) * size_y + w; lines_ndx += 1; + *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + w; lines_ndx += 1; + *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + (size_z + 1) * size_y + w; lines_ndx += 1; } } diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 7ca66cf..04f4fa2 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -539,7 +539,7 @@ GLubyte arrows[] = { static void get_model_data_and_user_preferences(){ - model_space_size_x = 5; // 0 < model_space_size_x + model_space_size_x = 10; // 0 < model_space_size_x model_space_size_y = 4; // 0 < model_space_size_y model_space_size_z = 3; // 0 < model_space_size_z model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint