From 8fc9f6c0e3482afd682a2c84333b4f88b930f5ba Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 14 Aug 2023 11:01:08 +0200 Subject: [PATCH] WIP: CUBES (preparing a dedicated branch) --- src/graphics/buffers.c | 26 +++++++++++++++++++------- src/graphics/graphics.c | 10 ++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/graphics/buffers.c b/src/graphics/buffers.c index a3ad2fa..ca4dd62 100644 --- a/src/graphics/buffers.c +++ b/src/graphics/buffers.c @@ -343,6 +343,10 @@ static void draw_a_central_star(GLuint *lines_origin, long n) draw_line (lines_origin, n + 4, n + 5); } +static void draw_a_central_star_in_a_cube(GLuint *lines_origin, long n, int side_size) +{ +} + // I'm standing on Earth (any planet or star or spinning spheroid, in fact) // and looking towards its North pole @@ -371,17 +375,25 @@ bool compute_space(long space_x, long space_y, long space_z, draw_grids_3D (space_x, space_y, space_z, step_x, step_y, step_z, lines_origin, pref_show_grid); if (pref_show_grid > 0) draw_ridges_3D (space_x, space_y, space_z, step_x, step_y, step_z, lines_origin); - long s = step_z * space_z + step_y * space_y + step_x * space_x; - draw_a_central_star (lines_origin, s + 1 + 171 * 6); + long s = step_z * space_z + step_y * space_y + step_x * space_x + 1; + int side_size = space_x; /* IT IS A CUBE ! space_x = space_y = space_z */ + draw_a_central_star_in_a_cube (lines_origin, s, side_size); + + + draw_a_central_star (lines_origin, s + 13 * 6); + +/* DANS UN CUBE DE COTE 3 LE CENTRE EST À 3 x 3 x 3 = 27 / 2 = 14 >> 13 * 6 + * DANS UN CUBE DE COTE 5 LE CENTRE EST À 5 x 5 x 5 = 125 / 2 = 62 >> 62 * 6 + * DANS UN CUBE DE COTE 7 LE CENTRE EST À 7 x 7 x 7 = 342 / 2 = 171 >> 171 * 6 + * JE CHOISIS DES CUBES AYANT DES COTÉS IMPAIRS POUR QU'IL Y AIT UNE CASE CENTRALE + */ - - - draw_line (lines_origin, 2800, 3500); - draw_line (lines_origin, 3500, 2422);// - draw_line (lines_origin, 3500, 2606); +// draw_line (lines_origin, 2800, 3500); +// draw_line (lines_origin, 3500, 2422);// +// draw_line (lines_origin, 3500, 2606); diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index ebdd52c..d9f3650 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -556,9 +556,9 @@ GLuint arrows[] = { static void get_model_data_and_user_preferences(){ - model_space_size_x = 7; // 0 < model_space_size_x - model_space_size_y = 7; // 0 < model_space_size_y - model_space_size_z = 7; // 0 < model_space_size_z + model_space_size_x = 3; // 0 < model_space_size_x + model_space_size_y = 3; // 0 < model_space_size_y + model_space_size_z = 3; // 0 < model_space_size_z long arrows_array_size = 0; while (*(arrows + arrows_array_size) != un_nombre_ad_hoc_que_je_mets_a_la_fin_du_tableau_pour_en_mesurer_la_taille) @@ -614,14 +614,12 @@ static void compute_buffers_sizes(int model_space_size_x, if (pref_show_grid != 1) buffer_lines_size = grids_lines * 2; if (pref_show_grid > 0) buffer_lines_size += 12 * 2; // space ridges - // sinon, les arêtes de l'espace sont tracées par les grilles + // sinon, les arêtes de l'espace sont tracées par les grilles if (pref_test_diagonal) buffer_lines_size += 2; // la diagonale test [0 - max] buffer_lines_size += 6 * central_stars_nb; // test central stars - buffer_lines_size += 6; - // buffer_lines_size -= 2; // == TEST LINES BUFFER SIZE if (0) printf("allocated buffers sizes :%4ld/3 = %3ld vertices, %4ld/3 = %3ld colors,\