WIP: 90% OK = affichages concordants sans erreurs (détectées) pour deux appels de set_arrow() (mais pas plus)

This commit is contained in:
Jean Sirmai 2023-10-03 15:57:23 +02:00
parent 8014cc2a60
commit 5fd28b0464
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 18 additions and 18 deletions

View File

@ -42,7 +42,7 @@
*/ */
void arrows_write_terminations (long x, long y, long z) void arrows_write_terminations (long x, long y, long z)
{ {
float max, i, j, k, vx, vy, vz, arrow_basis_width, arrow_tip_padding, nuance = 0.12f; float max, i, j, k, vx, vy, vz, arrow_basis_width, arrow_tip_padding, nuance = 0.24f;
max = fmax(x, y); max = fmax(max, z); max = fmax(x, y); max = fmax(max, z);
@ -82,20 +82,20 @@ void arrows_write_terminations (long x, long y, long z)
// X - X (EAST - WEST) axis - arrows tips // X - X (EAST - WEST) axis - arrows tips
graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz); graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz);
graphics_write_vertex (vx - (1 / max) + arrow_tip_padding, vy, vz); graphics_write_vertex (vx - (1 / max) + arrow_tip_padding, vy, vz);
graphics_write_color(1.0f - nuance, 0.0f + nuance, 0.0f + nuance); graphics_write_color(1.0f - nuance / 3, 0.0f + nuance, 0.0f + nuance);
graphics_write_color(0.0f + nuance, 1.0f - nuance, 1.0f - nuance); graphics_write_color(0.0f + nuance, 1.0f - nuance, 1.0f - nuance);
// Y - Y (ZENITH - NADIR) axis - arrows tips // Y - Y (ZENITH - NADIR) axis - arrows tips
graphics_write_vertex (vx, vy + (1 / max) - arrow_tip_padding, vz); graphics_write_vertex (vx, vy + (1 / max) - arrow_tip_padding, vz);
graphics_write_vertex (vx, vy - (1 / max) + arrow_tip_padding, vz); graphics_write_vertex (vx, vy - (1 / max) + arrow_tip_padding, vz);
graphics_write_color(0.0f + nuance, 1.0f - nuance, 0.0f + nuance); graphics_write_color(0.0f + nuance, 1.0f - nuance / 3, 0.0f + nuance);
graphics_write_color(1.0f - nuance, 0.0f + nuance, 1.0f - nuance); graphics_write_color(1.0f - nuance, 0.0f + nuance, 1.0f - nuance);
// Z - Z (NORTH - SOUTH) axis - arrows tips // Z - Z (NORTH - SOUTH) axis - arrows tips
graphics_write_vertex (vx, vy, vz + (1 / max) - arrow_tip_padding); graphics_write_vertex (vx, vy, vz + (1 / max) - arrow_tip_padding);
graphics_write_vertex (vx, vy, vz - (1 / max) + arrow_tip_padding); graphics_write_vertex (vx, vy, vz - (1 / max) + arrow_tip_padding);
graphics_write_color(0.0f + nuance, 0.0f + nuance, 1.0f - nuance); graphics_write_color(0.0f + nuance, 0.0f + nuance, 1.0f - nuance / 4);
graphics_write_color(1.0f - nuance, 1.0f - nuance, 0.0f + nuance); graphics_write_color(1.0f - nuance / 3, 1.0f - nuance / 3, 0.0f + nuance);
}; };
} }

View File

@ -604,7 +604,7 @@ static void show_user_choices(GLuint *arrows, int arrows_nb,
if (prefer == 1) printf("prefer = %d <> show no grid", prefer); if (prefer == 1) printf("prefer = %d <> show no grid", prefer);
if (prefer > 1) printf("show grids according rule (%d)", prefer); if (prefer > 1) printf("show grids according rule (%d)", prefer);
if (show_all) printf("\n\ if (show_all) printf("\n\
initial arrows data arrows_nb = %d", arrows_nb); initial arrows data with arrows_nb = %d", arrows_nb);
if (show_array) show_arrows_array (arrows, arrows_nb, space_size_x, space_size_y, space_size_z); if (show_array) show_arrows_array (arrows, arrows_nb, space_size_x, space_size_y, space_size_z);
} }
@ -643,7 +643,7 @@ static void show_buffers_states(int space_X, int space_Y, int space_Z, int arrow
(arrows_nb * 14 - (buffer_lines_size - buffer_lines_size_after_cubes)) / arrows_nb, arrows_nb); (arrows_nb * 14 - (buffer_lines_size - buffer_lines_size_after_cubes)) / arrows_nb, arrows_nb);
if (arrows_nb > 1) if (arrows_nb > 1)
printf("\n WARNING In this test, it may happens that two or several arrow basis are drawn superimposed (check the list).\n"); printf("\n WARNING In this test, it may happens that arrows with different weights are drawn superimposed (check the list).\n");
} }
@ -753,7 +753,7 @@ static int set_arrow (GLuint *arrows, int arrows_nb, int requested_weight, int s
} }
} }
printf("\nset_arrow() invoked with requested weight = %2d > ", requested_weight); printf("\nset_arrow() invoked with requested weight = %2d + ", requested_weight);
show_user_action(arrows, arrows_nb, address, requested_weight, current_weight, site, x, y, z); show_user_action(arrows, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
@ -826,17 +826,17 @@ static void show_user_action(GLuint *arrows, int arrows_nb, int address, int req
if (address == -1 && requested_weight > 0) { // *(arrows + i * 5 + 0) if (address == -1 && requested_weight > 0) { // *(arrows + i * 5 + 0)
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); //arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]); printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); //arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
if (! TEST) printf("\n "); else printf(" "); if (! TEST) printf("\n "); else printf(" ");
printf("requested weight == %2d => CREATE", requested_weight); return;} printf("=> CREATE"); return;}
if (address >= 0 && requested_weight == 0) { if (address >= 0 && requested_weight == 0) {
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight); printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
if (! TEST) printf("\n "); else printf(" "); if (! TEST) printf("\n "); else printf(" ");
printf("requested weight == %2d => ERASE", requested_weight); return;} printf("=> ERASE"); return;}
if (address >= 0 && current_weight != requested_weight) { if (address >= 0 && current_weight != requested_weight) {
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight); printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
if (! TEST) printf("\n "); else printf(" "); if (! TEST) printf("\n "); else printf(" ");
printf("requested weight != current weight => MODIFY"); return;} printf("=> MODIFY"); return;}
if (address >= 0 && current_weight == requested_weight){ if (address >= 0 && current_weight == requested_weight){
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d;", site, x, y, z, address); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5); printf("arrow (%2d,%2d,%2d,%2d) found at address %2d;", site, x, y, z, address); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5);
@ -846,7 +846,7 @@ static void show_user_action(GLuint *arrows, int arrows_nb, int address, int req
if (address == -1 && requested_weight == 0) { if (address == -1 && requested_weight == 0) {
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]); printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
if (! TEST) printf("\n "); else printf(" "); if (! TEST) printf("\n "); else printf(" ");
printf("requested weight == 0 => END"); return;} printf("=> END"); return;}
} }
@ -909,7 +909,7 @@ void main_test_graphics (void)
/* Therefore: if (arrows_nb > 0) is not required (next line) */ /* Therefore: if (arrows_nb > 0) is not required (next line) */
arrows_write_terminations (space_X, space_Y, space_Z); arrows_write_terminations (space_X, space_Y, space_Z);
for (int k = 0; k < 3; k++) // for (int k = 0; k < arbitrary; k++) TODO for (int k = 0; k < 2; k++) // for (int k = 0; k < arbitrary; k++) TODO
arrows_nb = set_arrow (arrows, arrows_nb, arrows_nb = set_arrow (arrows, arrows_nb,
rand() % arbitrary, // load / weight rand() % arbitrary, // load / weight
rand() % 6, // site, rand() % 6, // site,