WIP: set_arrow() OK (printf + drawing) with no more than two calls < to check ++

This commit is contained in:
Jean Sirmai 2023-10-03 16:19:54 +02:00
parent 5fd28b0464
commit 58f5cd8beb
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 14 additions and 13 deletions

View File

@ -79,19 +79,19 @@ void arrows_write_terminations (long x, long y, long z)
graphics_write_color(0.3f, 0.3f, 0.3f); graphics_write_color(0.3f, 0.3f, 0.3f);
graphics_write_color(0.3f, 0.3f, 0.3f); graphics_write_color(0.3f, 0.3f, 0.3f);
// X - X (EAST - WEST) axis - arrows tips // X - X (EAST - WEST) axis - arrows tips (red - green)
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 / 3, 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 (cyan - magenta)
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 / 3, 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 (blue - yellow)
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 / 4); graphics_write_color(0.0f + nuance, 0.0f + nuance, 1.0f - nuance / 4);

View File

@ -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 arrows with different weights are drawn superimposed (check the list).\n"); printf("\n WARNING In this test, it may happens that some arrows (whatever their weights) are drawn superimposed (check the list).\n");
} }
@ -880,13 +880,15 @@ void main_test_graphics (void)
// xyz, 0, x, y, z, xy, xz, yz, xyz // xyz, 0, x, y, z, xy, xz, yz, xyz
GLuint arrows[arrows_nb * 5]; GLuint arrows[arrows_nb * 5];
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 0); show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 0);
// WARNING arrows with same address will be drawn superimposed
if (arrows_nb > 0) if (arrows_nb > 0)
for (int i = 0; i < arrows_nb; i ++) { for (int i = 0; i < arrows_nb; i ++) {
arrows[i * 5 + 0] = 1 + rand() % arbitrary; // load / weight arrows[i * 5 + 0] = 1 + rand() % arbitrary; // load / weight
arrows[i * 5 + 1] = rand() % 6; // site arrows[i * 5 + 1] = rand() % 6; // site
arrows[i * 5 + 2] = rand() % space_X; // x arrows[i * 5 + 2] = rand() % space_X; // x
arrows[i * 5 + 3] = rand() % space_Y; // y arrows[i * 5 + 3] = rand() % space_Y; // y
arrows[i * 5 + 4] = rand() % space_Z; // z arrows[i * 5 + 4] = rand() % space_Z; // z
}; };
// forget the next two lines during the random tests // forget the next two lines during the random tests
@ -913,12 +915,11 @@ void main_test_graphics (void)
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,
MIN (rand() % space_X, space_X - 1), // x TODO rand() % space_X, // x
// Qu'est-ce que c'est que ce truc pas net !... rand() % space_Y, // y
MIN (rand() % space_Y, space_Y - 1), // y rand() % space_Z); // z
MIN (rand() % space_Z, space_Z - 1)); // z
// ligne suivante inutile: < ce sont les sous-fonctions de set_arrow() qui le font // ligne suivante inutile: < ce sont les sous-fonctions de set_arrow() qui appellent
// show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 1); // show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 1);
int weight = 0, site = 0, int weight = 0, site = 0,