From 8309eb1e5729b254e2274e178e4648bb409371e8 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 23 Oct 2023 18:34:40 +0200 Subject: [PATCH] WIP: cleaning : space ridges & grids OK > let's do the arrows, now... --- src/graphics/graphics.c | 26 +++++++++++++------------- src/graphics/grid.c | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 50193d3..c97f560 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -684,10 +684,10 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) int rand(void); void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min); - int arbitrary = 3; - int space_X = 2,// + rand() % arbitrary, - space_Y = 1,// + rand() % arbitrary, - space_Z = 1;// + rand() % arbitrary; + int arbitrary = 7; + int space_X = 1 + rand() % arbitrary, + space_Y = 1 + rand() % arbitrary, + space_Z = 1 + rand() % arbitrary; int density_max = space_X * space_Y * space_Z; int max = fmax(space_X, space_Y); max = fmax(max, space_Z); @@ -777,17 +777,17 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) /* S P A C E */ - if (1) printf("buffer_lines_size before writing 12 space_ridges_lines : %d (x 2 = %d)\n", buffer_lines_size, buffer_lines_size * 2); + if (1) printf("buffer_lines_size before writing 12 space_ridges_lines : %d (* 2 = %d)\n", buffer_lines_size / 2, buffer_lines_size); write_space_ridges_lines (); - if (1) printf("buffer_lines_size after writing 12 space_ridges_lines : %d (x 2 = %d)\n\n", buffer_lines_size, buffer_lines_size * 2); + if (1) printf("buffer_lines_size after writing 12 space_ridges_lines : %d (* 2 = %d)\n\n", buffer_lines_size / 2, buffer_lines_size); - if (1) printf("buffer_lines_size before writing_space_faces_lines : %d (x 2 = %d)\n", buffer_lines_size, buffer_lines_size * 2); - /* write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z); */ - graphics_write_line (8, 9); - graphics_write_line (9, 10); - graphics_write_line (10, 11); - graphics_write_line (11, 8); - if (1) printf("buffer_lines_size after writing_space_faces_lines : %d (x 2 = %d)\n\n", buffer_lines_size, buffer_lines_size * 2); + if (1) printf("buffer_lines_size before writing_space_faces_lines : %d (* 2 = %d)\n", buffer_lines_size / 2, buffer_lines_size); + write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z); + /* graphics_write_line (8, 9); */ + /* graphics_write_line (9, 10); */ + /* graphics_write_line (10, 11); */ + /* graphics_write_line (11, 8); */ + if (1) printf("buffer_lines_size after writing_space_faces_lines : %d (* 2 = %d)\n\n", buffer_lines_size / 2, buffer_lines_size); /* A R R O W S */ diff --git a/src/graphics/grid.c b/src/graphics/grid.c index e23a5fa..8f218f6 100644 --- a/src/graphics/grid.c +++ b/src/graphics/grid.c @@ -119,6 +119,8 @@ long write_grids_on_space_faces_vertex (long x, long y, long z) long write_grids_on_space_faces_lines (long offset_vertex, long x, long y, long z) { + offset_vertex = offset_vertex / 3; + for (int i = 0; i < x - 1; i ++) { /* graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1); */