WIP: main_test_graphics() et arrows simplifiés mais pb. calcul arrows_nb à partir de arrows[] cf. lignes 140, 170 et 647

This commit is contained in:
Jean Sirmai 2023-09-11 09:35:54 +02:00
parent d734bed39b
commit 1a780bd8f3
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 19 additions and 70 deletions

View File

@ -100,7 +100,7 @@ void arrows_write_terminations (long x, long y, long z)
} }
/* /*
* Writes lines for arrow oriented to the east into lines buffer * Writes lines for arrow oriented to the east or west into lines buffer
* *
* @param s, * @param s,
* weight, * weight,
@ -108,7 +108,7 @@ void arrows_write_terminations (long x, long y, long z)
* *
* @return void * @return void
*/ */
void write_arrow_lines_east (long s, int weight, int site) void write_arrow_lines_east_west (long s, int weight, int site)
{ {
graphics_write_line (s + 2, s + 6 + site % 2); graphics_write_line (s + 2, s + 6 + site % 2);
graphics_write_line (s + 3, s + 6 + site % 2); graphics_write_line (s + 3, s + 6 + site % 2);
@ -117,7 +117,7 @@ void write_arrow_lines_east (long s, int weight, int site)
} }
/* /*
* Writes lines for arrow oriented to the west into lines buffer * Writes lines for arrow oriented to the zenith or nadir into lines buffer
* *
* @param s, * @param s,
* weight, * weight,
@ -125,24 +125,7 @@ void write_arrow_lines_east (long s, int weight, int site)
* *
* @return void * @return void
*/ */
void write_arrow_lines_west (long s, int weight, int site) void write_arrow_lines_zenith_nadir (long s, int weight, int site)
{
graphics_write_line (s + 2, s + 6 + site % 2);
graphics_write_line (s + 3, s + 6 + site % 2);
graphics_write_line (s + 4, s + 6 + site % 2);
graphics_write_line (s + 5, s + 6 + site % 2);
}
/*
* Writes lines for arrow oriented to the zenith into lines buffer
*
* @param s,
* weight,
* site
*
* @return void
*/
void write_arrow_lines_zenith (long s, int weight, int site)
{ {
graphics_write_line (s + 0, s + 8 + site % 2); graphics_write_line (s + 0, s + 8 + site % 2);
graphics_write_line (s + 1, s + 8 + site % 2); graphics_write_line (s + 1, s + 8 + site % 2);
@ -151,7 +134,7 @@ void write_arrow_lines_zenith (long s, int weight, int site)
} }
/* /*
* Writes lines for arrow oriented to the nadir into lines buffer * Writes lines for arrow oriented to the south or north into lines buffer
* *
* @param s, * @param s,
* weight, * weight,
@ -159,41 +142,7 @@ void write_arrow_lines_zenith (long s, int weight, int site)
* *
* @return void * @return void
*/ */
void write_arrow_lines_nadir (long s, int weight, int site) void write_arrow_lines_south_north (long s, int weight, int site)
{
graphics_write_line (s + 0, s + 8 + site % 2);
graphics_write_line (s + 1, s + 8 + site % 2);
graphics_write_line (s + 4, s + 8 + site % 2);
graphics_write_line (s + 5, s + 8 + site % 2);
}
/*
* Writes lines for arrow oriented to the south into lines buffer
*
* @param s,
* weight,
* site
*
* @return void
*/
void write_arrow_lines_south (long s, int weight, int site)
{
graphics_write_line (s + 0, s + 10 + site % 2);
graphics_write_line (s + 1, s + 10 + site % 2);
graphics_write_line (s + 2, s + 10 + site % 2);
graphics_write_line (s + 3, s + 10 + site % 2);
}
/*
* Writes lines for arrow oriented to the north into lines buffer
*
* @param s,
* weight,
* site
*
* @return void
*/
void write_arrow_lines_north (long s, int weight, int site)
{ {
graphics_write_line (s + 0, s + 10 + site % 2); graphics_write_line (s + 0, s + 10 + site % 2);
graphics_write_line (s + 1, s + 10 + site % 2); graphics_write_line (s + 1, s + 10 + site % 2);

View File

@ -137,7 +137,7 @@ static void show_user_choices(long space_size_x,
GLuint *arrows, GLuint *arrows,
int prefer) int prefer)
{ {
int arrows_nb = sizeof(arrows) / (5 * 4); int arrows_nb = 3 * sizeof(arrows) / sizeof(arrows[0]);
printf("model + user constraints : space size x,y,z = %ld,%ld,%ld ", space_size_x, space_size_y, space_size_z); printf("model + user constraints : space size x,y,z = %ld,%ld,%ld ", space_size_x, space_size_y, space_size_z);
if (arrows_nb > 0) printf("[%d] arrows ", arrows_nb); if (arrows_nb > 0) printf("[%d] arrows ", arrows_nb);
if (prefer == 1) printf("prefer = %d <> show no grid ", prefer); if (prefer == 1) printf("prefer = %d <> show no grid ", prefer);
@ -167,7 +167,7 @@ static void get_model_data_and_user_preferences()
central_stars_nb = 0; // à calculer TODO central_stars_nb = 0; // à calculer TODO
// ! WARNING ! Pour l'instant égal au nombre de flèches ! (central stars réécrites) // ! WARNING ! Pour l'instant égal au nombre de flèches ! (central stars réécrites)
central_stars_nb = sizeof(arrows) / (5 * 4); central_stars_nb = sizeof(arrows) / sizeof(arrows[0]);
pref_show_grids = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc pref_show_grids = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
// xyz, 0, x, y, z, xy, xz, yz, xyz // xyz, 0, x, y, z, xy, xz, yz, xyz
@ -623,6 +623,7 @@ void main_test_graphics (void)
long stx = z * y, long stx = z * y,
sty = z, sty = z,
stz = 1; stz = 1;
long arrow_offset = 0;
printf("offset_before_grid = %d\n", buffer_vertex_size / 3); printf("offset_before_grid = %d\n", buffer_vertex_size / 3);
@ -636,29 +637,29 @@ void main_test_graphics (void)
if (pref_show_grids > 0) grid_write_ridges (x, y, z); if (pref_show_grids > 0) grid_write_ridges (x, y, z);
int offset_after_grid = buffer_vertex_size / 3, cube_coord = 0; int offset_after_grid = buffer_vertex_size / 3;
printf("offset_after_ grid = %d\n", offset_after_grid); printf("offset_after_ grid = %d\n", offset_after_grid);
/* ARROWS */ /* ARROWS */
arrows_write_terminations (x, y, z); arrows_write_terminations (x, y, z);
for (int i = 0; i < sizeof(arrows) / (5 * 4); i++) { int arrows_nb_ad_hoc = 6; // 3 * sizeof(arrows) / sizeof(arrows[0]) ???
for (int i = 0; i < arrows_nb_ad_hoc; i++) {
site = arrows[i * 5 + 1]; site = arrows[i * 5 + 1];
x = arrows[i * 5 + 2]; x = arrows[i * 5 + 2];
y = arrows[i * 5 + 3]; y = arrows[i * 5 + 3];
z = arrows[i * 5 + 4]; z = arrows[i * 5 + 4];
cube_coord = 12 * (stx * x + sty * y + stz * z); // cube coordinates = 12 * (stx * x + sty * y + stz * z);
arrows_write_basis (offset_after_grid + cube_coord); arrow_offset = offset_after_grid + 12 * (stx * x + sty * y + stz * z);
arrows_write_basis (arrow_offset);
switch(site){ switch(site){
case EAST: write_arrow_lines_east (offset_after_grid + cube_coord, 1, site); break; case EAST: case WEST: write_arrow_lines_east_west (arrow_offset, 1, site); break;
case WEST: write_arrow_lines_west (offset_after_grid + cube_coord, 1, site); break; case ZENITH: case NADIR: write_arrow_lines_zenith_nadir (arrow_offset, 1, site); break;
case ZENITH: write_arrow_lines_zenith(offset_after_grid + cube_coord, 1, site); break; case SOUTH: case NORTH: write_arrow_lines_south_north (arrow_offset, 1, site); break;
case NADIR: write_arrow_lines_nadir (offset_after_grid + cube_coord, 1, site); break;
case SOUTH: write_arrow_lines_south (offset_after_grid + cube_coord, 1, site); break;
case NORTH: write_arrow_lines_north (offset_after_grid + cube_coord, 1, site); break;
default: break; default: break;
} }
} }
@ -667,4 +668,3 @@ void main_test_graphics (void)
} }