WIP: Et maintenant, il faut distinguer les arrows-data des arrows-en-place

This commit is contained in:
Jean Sirmai 2023-09-22 22:28:56 +02:00
parent 039e247bff
commit 7b76a54756
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 13 additions and 11 deletions

View File

@ -53,11 +53,11 @@ static int buffer_plans_size = 0;
static GLuint arrows[] = { static GLuint arrows[] = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
1, 1, 1, 0, 0, 1, 1, 1, 0, 0,
/* 1, 1, 0, 0, 0, */ 1, 1, 0, 0, 0,
/* 1, 2, 0, 0, 0, */ 1, 2, 0, 0, 0,
/* 1, 3, 0, 0, 0, */ 1, 3, 0, 0, 0,
/* 1, 4, 0, 0, 0, */ 1, 4, 0, 0, 0,
/* 1, 5, 0, 0, 0, */ 1, 5, 0, 0, 0,
// load, site, x, y, z // load, site, x, y, z
}; };
@ -160,7 +160,7 @@ static bool erase_arrow (int address, int site, int x, int y, int z)
return 1; return 1;
} }
static int check_for_arrow (int site, int x, int y, int z) static int check_for_arrow (int weight, int site, int x, int y, int z)
{ {
int arrows_nb = get_arrows_nb(); int arrows_nb = get_arrows_nb();
if (arrows_nb == 0) return -1; if (arrows_nb == 0) return -1;
@ -174,7 +174,7 @@ static int check_for_arrow (int site, int x, int y, int z)
f_y = *(arrows + i * 5 + 3); f_y = *(arrows + i * 5 + 3);
f_z = *(arrows + i * 5 + 4); f_z = *(arrows + i * 5 + 4);
if (f_site == site && f_x == x && f_y == y && f_z == z) { if (f_weight == weight && f_site == site && f_x == x && f_y == y && f_z == z) {
address = i * 5; address = i * 5;
if (DETAIL) printf("arrows_nb = %d checked arrow (%d,%d,%d,%d) found at address %d (line %d)",\ if (DETAIL) printf("arrows_nb = %d checked arrow (%d,%d,%d,%d) found at address %d (line %d)",\
arrows_nb, site, x, y, z, address, address / 5); arrows_nb, site, x, y, z, address, address / 5);
@ -215,7 +215,7 @@ static void show_arrows_array (int address, int weight, int site, int x, int y,
static int set_arrow (int weight, int site, int x, int y, int z) static int set_arrow (int weight, int site, int x, int y, int z)
{ {
int address = (check_for_arrow (site, x, y, z)); int address = (check_for_arrow (weight, site, x, y, z));
show_arrows_array(address, weight, site, x, y, z); show_arrows_array(address, weight, site, x, y, z);
if (address == -1 && weight == 0) return 0; if (address == -1 && weight == 0) return 0;
@ -790,7 +790,7 @@ void main_test_graphics (void)
/* ARROWS */ /* ARROWS */
arrows_write_terminations (x, y, z); arrows_write_terminations (x, y, z);
int arrows_nb = get_arrows_nb(); int arrows_nb = get_arrows_nb(), cube_coord = 0;
for (int i = 0; i < arrows_nb; i++) { for (int i = 0; i < arrows_nb; i++) {
weight = arrows[i * 5 + 0]; weight = arrows[i * 5 + 0];
@ -801,8 +801,8 @@ void main_test_graphics (void)
set_arrow (weight, site, x, y, z); set_arrow (weight, site, x, y, z);
/* // cube coordinates = 12 * (stx * x + sty * y + stz * z); */ cube_coord = 12 * (stx * x + sty * y + stz * z);
arrow_offset = offset_after_grids + 12 * (stx * x + sty * y + stz * z); arrow_offset = offset_after_grids + cube_coord;
arrows_write_basis (arrow_offset); arrows_write_basis (arrow_offset);
switch(site){ switch(site){
@ -819,6 +819,8 @@ void main_test_graphics (void)
offset_after_arrows, offset_after_arrows, offset_after_grids,\ offset_after_arrows, offset_after_arrows, offset_after_grids,\
difference, difference, difference / 12); difference, difference, difference / 12);
if (0) printf("main_test_graphics [ok]\n"); if (0) printf("main_test_graphics [ok]\n");
if (1) printf("\n Et maintenant, il faut distinguer les arrows-data des arrows-en-place\n\
[to be] vs. [done]\n\n");
} }