From 650cf66c073358ee5e395184f857cf897abaa4a2 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Thu, 19 Oct 2023 22:42:23 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20preuve=20graphique=20(six=20fl=C3=A8ches?= =?UTF-8?q?=20vers=20six=20p=C3=B4les=20dessin=C3=A9es=20par=20un=20trait)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/arrows.c | 24 ++++++++++++++++++------ src/graphics/graphics.c | 16 ++++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index 754860f..9933c65 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -135,18 +135,30 @@ int write_one_arrow_vertex (int offset_vertex, GLfloat arrow_tip_padding = (1 / max) / 10; switch(site){ - case EAST: case WEST: - graphics_write_vertex (vx + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, vy, vz); + case EAST: + graphics_write_vertex (vx + (site % 2 - 1) * (1 / max) - (site % 2 - 1) * arrow_tip_padding, vy, vz); graphics_write_color (1.0f, 0.0f, 0.0f); break; - case ZENITH: case NADIR: - graphics_write_vertex (vx, vy + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, vz); + case WEST: + graphics_write_vertex (vx + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, vy, vz); + graphics_write_color (0.0f, 1.0f, 1.0f); + break; + case ZENITH: + graphics_write_vertex (vx, vy + (site % 2 - 1) * (1 / max) - (site % 2 - 1) * arrow_tip_padding, vz); graphics_write_color(0.0f, 1.0f, 0.0f); break; - case SOUTH: case NORTH: - graphics_write_vertex (vx, vy, vz + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding); + case NADIR: + graphics_write_vertex (vx, vy + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, vz); + graphics_write_color(1.0f, 0.0f, 1.0f); + break; + case SOUTH: + graphics_write_vertex (vx, vy, vz + (site % 2 - 1) * (1 / max) - (site % 2 - 1) * arrow_tip_padding); graphics_write_color(0.0f, 0.0f, 1.0f); break; + case NORTH: + graphics_write_vertex (vx, vy, vz + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding); + graphics_write_color(1.0f, 1.0f, 0.0f); + break; default: break; } diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 49150e8..f317cc4 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -677,25 +677,25 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min); int arbitrary = 8; - int space_X = 1 + rand() % arbitrary, - space_Y = 1 + rand() % arbitrary, - space_Z = 1 + rand() % arbitrary; + int space_X = 6,//1 + rand() % arbitrary, + space_Y = 1,// + rand() % arbitrary, + space_Z = 1;// + rand() % arbitrary; int density_max = space_X * space_Y * space_Z; int max = fmax(space_X, space_Y); max = fmax(max, space_Z); int show_space_design = 1, print_arrows_data = 1; int load = 0, site = 0, x = 0, y = 0, z = 0; - int specif_arrows_nb = rand() % density_max / 3; + int specif_arrows_nb = 6;//rand() % density_max / 3; int arrows_nb = 0; while (arrows_nb < specif_arrows_nb){ arrows_nb = set_arrow (arrows, arrows_nb, rand() % arbitrary, // load / weight - rand() % 6, // site, - rand() % space_X, // x - rand() % space_Y, // y - rand() % space_Z); // z + arrows_nb,//rand() % 6, // site, + arrows_nb,//rand() % space_X, // x + 0,//rand() % space_Y, // y + 0);//rand() % space_Z); // z } print_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, show_space_design);