REF: X,Y,Z quelconques +/-grid(vol/surface) +/-stars +/-centers test-diagonal OK+

This commit is contained in:
Jean Sirmai 2023-08-15 13:02:48 +02:00
parent d05bde8f7c
commit 4abffdce6e
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 23 additions and 21 deletions

View File

@ -35,6 +35,7 @@ bool compute_space(int space_X, int space_Y, int space_Z,
// int pref_style_lines_planes,
// int pref_style_mix_colors,
int pref_show_grid,
int pref_central_stars_nb,
int pref_test_diagonal,
GLfloat *vertex_origin,

View File

@ -211,7 +211,7 @@ static bool centers (int x, int y, int z,
float i, j, k, vx, vy, vz,
ad = 1 / max,
eps = 0.1 * ad; // eps(ilon) servira à décaler légèrement les deux vertex centraux
eps = 0.0001 * ad; // eps(ilon) servira à décaler légèrement les deux vertex centraux
// l'un source, l'autre cible, de couleurs différentes
@ -428,11 +428,12 @@ bool draw_some_arrows (GLuint *lines_origin, int s, int stx, int sty,
bool compute_space(int space_X, int space_Y, int space_Z,
GLuint *arrows, int model_arrows_nb,
int pref_show_grid,
int pref_show_grid, int pref_central_stars_nb,
int pref_test_diagonal,
GLfloat *vertex_origin, GLfloat *colors_origin,
GLuint *lines_origin, GLuint *plans_origin)
{
int cubes_nb = space_X * space_Y * space_Z;
grids_intersections_volume (space_X, space_Y, space_Z, vertex_origin, colors_origin);
central_stars (space_X, space_Y, space_Z, vertex_origin, colors_origin);
centers (space_X, space_Y, space_Z, vertex_origin, colors_origin);
@ -440,16 +441,17 @@ bool compute_space(int space_X, int space_Y, int space_Z,
if (pref_show_grid > 0) draw_ridges_3D (space_X, space_Y, space_Z, step_x, step_y, step_z, lines_origin);
draw_grids_3D(space_X, space_Y, space_Z, step_x, step_y, step_z, lines_origin, pref_show_grid);
int s = step_z * space_Z + step_y * space_Y + step_x * space_X + 1;
if (1) for (int i = 0; i < space_X * space_Y * space_Z; i ++)
draw_a_central_star (lines_origin, s + i * 6);
if (pref_central_stars_nb == 1) draw_a_central_star (lines_origin, s + cubes_nb * 3 - 3);
if (pref_central_stars_nb == cubes_nb)
for (int i = 0; i < space_X * space_Y * space_Z; i ++) draw_a_central_star (lines_origin, s + i * 6);
int CUBE = 0, side_size = 0;
if ((space_X == space_Y) && (space_X == space_Z)) CUBE = 1;
if (CUBE) side_size = space_X; /* IF IT IS A CUBE, space_x = space_y = space_z */
if (CUBE) draw_a_central_star_in_a_cubic_space (lines_origin, s, side_size);
if (CUBE) draw_EW_ZA_SN_in_a_cubic_space (lines_origin, s, side_size);
if (CUBE) draw_3_x_4_around_6_poles (lines_origin, s, side_size);
printf("side = %d step_x = %d step_y = %d step_z = %d\n",\
space_X, (space_Z + 1) * (space_Y + 1), space_Z + 1, 1);
printf("space (%d x %d x %d) steps [ %d | %d | %d ]\n",\
space_X, space_Y, space_Z, (space_Z + 1) * (space_Y + 1), space_Z + 1, 1);
if (pref_test_diagonal) diagonal_test (space_X, space_Y, space_Z, step_x, step_y, step_z, lines_origin);
printf(" Prochain objectif : dessiner les croix E, W, N, S, Z A puis EN, ES, etc.\n\
Puis dessiner toutes les croix limitant un voisinage de Moore 3D sphérique.\n");

View File

@ -49,6 +49,7 @@
// int model_dim; < INUTILE : dim est fonction de space_X, Y ,Z) */
int space_X = 0, space_Y = 0, space_Z = 0;
int cubes_nb = 0;
int arrows_nb = 0;
int nb_of_central_stars_to_draw = 0;
@ -63,6 +64,7 @@ GLuint *buffer_plans_origin = NULL;
//int pref_style_lines_planes = 0; // arrows as lines = 0, as planes = 1
//int pref_style_mix_colors = 0; // ... don't know yet ...
int pref_test_diagonal = 0; // diagonal test
int pref_central_stars_nb = 0; // diagonal test
int pref_show_grid = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
int pref_grid_anchors_on_faces_only = 0; // A vertex at all intersections
// oron faces only (which is enough to draw the grids)
@ -555,9 +557,10 @@ GLuint arrows[] = {
static void get_model_data_and_user_preferences(){
space_X = 5; // 0 < space_X assert TODO
space_Y = 4; // 0 < space_Y assert TODO
space_X = 7; // 0 < space_X assert TODO
space_Y = 5; // 0 < space_Y assert TODO
space_Z = 3; // 0 < space_Z assert TODO
cubes_nb = space_X * space_Y * space_Z;
pref_grid_anchors_on_faces_only = 0; // 0 = on faces only
pref_show_grid = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc.
// xyz, 0, x, y, z, xy, xz, yz, xyz (repeat)
@ -567,8 +570,9 @@ static void get_model_data_and_user_preferences(){
arrows_nb = arrows_array_size / 5; // L'emplacement des flèches est contraint
// par space_size_x, y, z et le nombre de sites
// >>> assert TODO
nb_of_central_stars_to_draw = 0; // 1 + 6 + 24; // max = space_X * space_Y * space_Z
nb_of_central_stars_to_draw = space_X * space_Y * space_Z;
pref_central_stars_nb = cubes_nb; // cubes_nb = max = space_X * space_Y * space_Z
pref_central_stars_nb = 0; // 1 + 6 + 24;
pref_central_stars_nb = 1;
pref_test_diagonal = 1;
}
@ -599,14 +603,8 @@ static void compute_buffers_sizes(int space_X, int space_Y, int space_Z,
// ex : x = 40, y = 5, z = 5 >>> 30258 (volume) vs. 30258 (surface) !!!
// ex : x = 40, y = 6, z = 6 >>> 6027 (volume) vs. 30258 (surface) !!!
// ex : x = 40, y = 7, z = 7 >>> 7872 (volume) vs. 30258 (surface) !!!
int central_stars = (space_X)
* (space_Y)
* (space_Z)
* 6; // 6 is to draw the small central star
int centers = (space_X)
* (space_Y)
* (space_Z)
* 2; // and 2 is to draw two centers for each cube
int central_stars = cubes_nb * 6; // 6 is to draw the small central star
int centers = cubes_nb * 2; // 2 is to draw two centers for each cube
// one will be for the arrows sources (blue ?)
// and the other, for their targets (red ?)
// NB In this git branch, I forget the six faces centers
@ -614,9 +612,9 @@ static void compute_buffers_sizes(int space_X, int space_Y, int space_Z,
if (pref_grid_anchors_on_faces_only)
buffer_vertex_size = grids_intersections_volume * 3;
else buffer_vertex_size = grids_intersections_surface * 3;
printf("draw_grids_3D_surface buffer_vertex_size = %d\n", buffer_vertex_size);
if (0) printf("draw_grids_3D_surface buffer_vertex_size = %d\n", buffer_vertex_size);
buffer_vertex_size += central_stars * 3;
buffer_vertex_size += centers * 3; // 3 numbers per vertex
if (arrows_nb > 0) buffer_vertex_size += centers * 3; // 3 numbers per vertex
buffer_colors_size = buffer_vertex_size;
buffer_plans_size = 0;
@ -631,7 +629,7 @@ static void compute_buffers_sizes(int space_X, int space_Y, int space_Z,
if (pref_test_diagonal) buffer_lines_size += 2; // la diagonale test [0 - max]
buffer_lines_size += 6 * nb_of_central_stars_to_draw; // test central stars
buffer_lines_size += 6 * pref_central_stars_nb; // test central stars
// buffer_lines_size -= 2; // == TESTS LINES BUFFER SIZE ON THE DIAGONAL
@ -687,6 +685,7 @@ void graphics_init_buffers(const void *gl_area)
arrows_nb,
pref_show_grid,
pref_central_stars_nb,
pref_test_diagonal,
buffer_vertex_origin,