diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 1098b4b..32702f1 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -70,7 +70,7 @@ static void show_user_choices(GLuint *arrows, int arrows_nb, static void get_model_data_and_user_preferences(GLuint *arrows, int arrows_nb) { - xxx = 8; // 0 < model_space_size_x + xxx = 1; // 0 < model_space_size_x yyy = 1; // 0 < model_space_size_y zzz = 1; // 0 < model_space_size_z pref_show_grids = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc @@ -158,7 +158,7 @@ static bool erase_arrow (GLuint *arrows, int arrows_nb, int address, int site, i *(arrows + address + 4) = *(arrows + arrows_nb * 5 + 4); } buffer_lines_size -= (3 + 4) * 2; - buffer_lines_origin = g_realloc(buffer_lines_origin, buffer_lines_size * 2 * sizeof(GLuint)); + buffer_lines_origin = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLuint)); show_arrows_array(arrows, arrows_nb, address, -1, 0, site, x, y, z); @@ -188,11 +188,11 @@ static void show_arrows_array (GLuint *arrows, int arrows_nb, int address, int c printf(" [%4d] = %2d | %2d, %2d, %2d, %2d ",\ i, *(arrows + i * 5 + 0), *(arrows + i * 5 + 1), *(arrows + i * 5 + 2),\ *(arrows + i * 5 + 3), *(arrows + i * 5 + 4)); - if (weight == 0 && i == address / 5) printf(" <<<| < - > (%d, %d, %d, %d) @ [%d]",\ + if (weight == 0 && i == address / 5) printf(" <<<| < - > (%d, %d, %d, %d) moved at [%2d]",\ *(arrows + i * 5 + 1), *(arrows + i * 5 + 2),\ *(arrows + i * 5 + 3), *(arrows + i * 5 + 4), address / 5); if (weight > 0 && current_weigh != weight && i == arrows_nb - 1 && address >= 0) - printf(" <<< < + > (%d, %d, %d, %d) @ [%d]",\ + printf(" <<< < + > (%d, %d, %d, %d) added at [%2d]",\ *(arrows + i * 5 + 1), *(arrows + i * 5 + 2),\ *(arrows + i * 5 + 3), *(arrows + i * 5 + 4), address / 5); if (weight > 0 && current_weigh == weight && i == address / 5) printf(" <"); @@ -827,17 +827,18 @@ void main_test_graphics (void) GLuint arrows[] = { 1, 0, 0, 0, 0, -// 1, 1, 0, 0, 0, + 1, 1, 0, 0, 0, // 1, 1, 0, 0, 0, // 1, 0, 2, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 2, 0, 0, - 1, 1, 3, 0, 0, - 1, 1, 4, 0, 0, - 1, 1, 5, 0, 0, - 1, 1, 6, 0, 0, - 1, 1, 7, 0, 0, - 1, 0, 7, 0, 0, + /* 1, 1, 1, 0, 0, */ + /* 1, 1, 2, 0, 0, */ + /* 1, 1, 3, 0, 0, */ + /* 1, 0, 4, 0, 0, */ + /* 1, 1, 4, 0, 0, */ + /* 1, 1, 5, 0, 0, */ + /* 1, 1, 6, 0, 0, */ + /* 1, 1, 7, 0, 0, */ + /* 1, 0, 7, 0, 0, */ // 1, 2, 0, 0, 0, // 1, 3, 0, 0, 0, // 1, 4, 0, 0, 0, @@ -874,7 +875,7 @@ void main_test_graphics (void) // set_arrow (arrows, arrows_nb, 0, 1, 1, 0, 0); arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5; // arrows_nb --; // set_arrow (arrows, arrows_nb, 0, 1, 0, 0, 0); arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5; // arrows_nb --; -// set_arrow (arrows, arrows_nb, 1, 0, 1, 0, 0); arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5; // arrows_nb ++; +// set_arrow (arrows, arrows_nb, 1, 0, 5, 0, 0); arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5; // arrows_nb ++; // set_arrow (arrows, arrows_nb, 1, 1, 1, 0, 0); arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5; // arrows_nb ++; // set_arrow (arrows, arrows_nb, 1, 0, 0, 0, 0); arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5; // arrows_nb ++; @@ -899,18 +900,17 @@ void main_test_graphics (void) int offset_after_arrows = buffer_vertex_size / 3, difference = offset_after_arrows - offset_after_grids; - if (1) printf("\nbuffer_vertex_offset_after grids = %d\t\t(x+1)*(y+1)*(z+1) = %d (x,y,z = %d,%d,%d)",\ + if (1) printf("\n buffer_vertex_offset_after grids = %6d\t%6d = (x+1)*(y+1)*(z+1); <--> (x,y,z = %d,%d,%d)",\ offset_after_grids, (xxx + 1)*(yyy + 1)*(zzz + 1), xxx, yyy, zzz); - if (1) printf("\nbuffer_vertex_offset_after arrows = %d\t\t(%d - %d = %d, %d / 12 <> %d cubes)",\ + if (1) printf("\n buffer_vertex_offset_after arrows = %6d\t%6d = %d + %d; <--> %d = 12 x %d (there are %d cubes)",\ offset_after_arrows, offset_after_arrows, offset_after_grids,\ - difference, difference, difference / 12); - if (1) printf("\nbuffer_lines_size after cubes = %d\t\t(%d x %d + %d x %d + %d x %d = %d) (x 2 = %d)",\ - buffer_lines_size_after_cubes, xxx+1, yyy+1, xxx+1, zzz+1, yyy+1, zzz+1,\ - (xxx+1) * (yyy+1) + (xxx+1) * (zzz+1) + (yyy+1) * (zzz+1),\ - ((xxx+1) * (yyy+1) + (xxx+1) * (zzz+1) + (yyy+1) * (zzz+1)) * 2); - if (1) printf("\nbuffer_lines_size after arrows = %d\t\t(%d - %d = %d;\t(3 + 4) x %d = %d (x 2 = %d)\n", buffer_lines_size,\ + difference, difference, difference / 12, difference / 12); + if (1) printf("\n buffer_lines_offset after cubes = %6d\t%6d = 2 * (%dx%d + %dx%d + %dx%d); <--> 2 * (x*y + x*z + y*z)",\ + buffer_lines_size_after_cubes, ((xxx+1) * (yyy+1) + (xxx+1) * (zzz+1) + (yyy+1) * (zzz+1)) * 2, + xxx+1, yyy+1, xxx+1, zzz+1, yyy+1, zzz+1); + if (1) printf("\n buffer_lines_offset after arrows = %6d\t%6d = %d + %d; <--> %d = (3 + 4) x 2 x %d (arrows_nb = %d)\n", buffer_lines_size,\ buffer_lines_size, buffer_lines_size_after_cubes, buffer_lines_size - buffer_lines_size_after_cubes,\ - arrows_nb, arrows_nb * 7, arrows_nb * 14); + arrows_nb * 14, arrows_nb, arrows_nb); if (0) printf("main_test_graphics [ok]\n"); }