WIP: utilisation de set_arrow (weight, site, x, y, z) pour la lecture de l'état initial OK
This commit is contained in:
parent
17f220dabd
commit
039e247bff
|
@ -83,7 +83,7 @@ static void show_user_choices(int space_size_x,
|
||||||
i, *(arrows + i * 5 + 0), *(arrows + i * 5 + 1), *(arrows + i * 5 + 2), *(arrows + i * 5 + 3), *(arrows + i * 5 + 4));
|
i, *(arrows + i * 5 + 0), *(arrows + i * 5 + 1), *(arrows + i * 5 + 2), *(arrows + i * 5 + 3), *(arrows + i * 5 + 4));
|
||||||
if (arrows_nb > 0) printf(" -------------------------------\n");}
|
if (arrows_nb > 0) printf(" -------------------------------\n");}
|
||||||
|
|
||||||
static int set_arrow (GLuint *arrows, int weight, int site, int x, int y, int z);
|
static int set_arrow (int weight, int site, int x, int y, int z);
|
||||||
|
|
||||||
static void get_model_data_and_user_preferences()
|
static void get_model_data_and_user_preferences()
|
||||||
{
|
{
|
||||||
|
@ -106,8 +106,7 @@ static void get_model_data_and_user_preferences()
|
||||||
|
|
||||||
|
|
||||||
#define DETAIL 0
|
#define DETAIL 0
|
||||||
static bool rewrite_arrow (GLuint *arrows, int address, int weight,
|
static bool rewrite_arrow (int address, int weight, int site, int x, int y, int z)
|
||||||
int site, int x, int y, int z)
|
|
||||||
{
|
{
|
||||||
if (DETAIL) printf("write the arrow weight to %d at (%d, %d, %d, %d)\n",\
|
if (DETAIL) printf("write the arrow weight to %d at (%d, %d, %d, %d)\n",\
|
||||||
weight, site, x, y, z);
|
weight, site, x, y, z);
|
||||||
|
@ -117,7 +116,7 @@ static bool rewrite_arrow (GLuint *arrows, int address, int weight,
|
||||||
return 1; /* replaces the load of the existing arrow by the load 'weight' */
|
return 1; /* replaces the load of the existing arrow by the load 'weight' */
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool create_arrow (GLuint *arrows, int weight, int site, int x, int y, int z)
|
static bool create_arrow (int weight, int site, int x, int y, int z)
|
||||||
{
|
{
|
||||||
int arrows_nb = get_arrows_nb();
|
int arrows_nb = get_arrows_nb();
|
||||||
arrows_nb ++;
|
arrows_nb ++;
|
||||||
|
@ -136,8 +135,7 @@ static bool create_arrow (GLuint *arrows, int weight, int site, int x, int y, in
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool erase_arrow (GLuint *arrows, int address,
|
static bool erase_arrow (int address, int site, int x, int y, int z)
|
||||||
int site, int x, int y, int z)
|
|
||||||
{
|
{
|
||||||
int arrows_nb = get_arrows_nb();
|
int arrows_nb = get_arrows_nb();
|
||||||
if (DETAIL) printf("erase arrow at address %d with values (%d, %d, %d, %d)",\
|
if (DETAIL) printf("erase arrow at address %d with values (%d, %d, %d, %d)",\
|
||||||
|
@ -162,7 +160,7 @@ static bool erase_arrow (GLuint *arrows, int address,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_for_arrow (GLuint *arrows, int site, int x, int y, int z)
|
static int check_for_arrow (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;
|
||||||
|
@ -189,7 +187,7 @@ static int check_for_arrow (GLuint *arrows, int site, int x, int y, int z)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void show_arrows_array (GLuint *arrows, int address, int weight, int site, int x, int y, int z)
|
static void show_arrows_array (int address, int weight, int site, int x, int y, int z)
|
||||||
{
|
{
|
||||||
int arrows_nb = get_arrows_nb();
|
int arrows_nb = get_arrows_nb();
|
||||||
printf("\n [ n] load | site x y z ----- < arrows_nb = %d > ------", arrows_nb);
|
printf("\n [ n] load | site x y z ----- < arrows_nb = %d > ------", arrows_nb);
|
||||||
|
@ -215,15 +213,15 @@ static void show_arrows_array (GLuint *arrows, int address, int weight, int site
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int set_arrow (GLuint *arrows, 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 (arrows, site, x, y, z));
|
int address = (check_for_arrow (site, x, y, z));
|
||||||
show_arrows_array(arrows, 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;
|
||||||
if (address == -1 && weight > 0) return create_arrow (arrows, weight, site, x, y, z);
|
if (address == -1 && weight > 0) return create_arrow (weight, site, x, y, z);
|
||||||
if (address >= 0 && weight == 0) return erase_arrow (arrows, address, site, x, y, z);
|
if (address >= 0 && weight == 0) return erase_arrow (address, site, x, y, z);
|
||||||
if (address >= 0 && weight > 0) return rewrite_arrow (arrows, address, weight, site, x, y, z);
|
if (address >= 0 && weight > 0) return rewrite_arrow (address, weight, site, x, y, z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -764,7 +762,7 @@ bool graphics_shutdown(const void *gl_area)
|
||||||
|
|
||||||
void main_test_graphics (void)
|
void main_test_graphics (void)
|
||||||
{
|
{
|
||||||
long site = 0,
|
long weight = 0, site = 0,
|
||||||
x = model_space_size_x,
|
x = model_space_size_x,
|
||||||
y = model_space_size_y,
|
y = model_space_size_y,
|
||||||
z = model_space_size_z;
|
z = model_space_size_z;
|
||||||
|
@ -795,12 +793,15 @@ void main_test_graphics (void)
|
||||||
int arrows_nb = get_arrows_nb();
|
int arrows_nb = get_arrows_nb();
|
||||||
|
|
||||||
for (int i = 0; i < arrows_nb; i++) {
|
for (int i = 0; i < arrows_nb; i++) {
|
||||||
site = arrows[i * 5 + 1];
|
weight = arrows[i * 5 + 0];
|
||||||
x = arrows[i * 5 + 2];
|
site = arrows[i * 5 + 1];
|
||||||
y = arrows[i * 5 + 3];
|
x = arrows[i * 5 + 2];
|
||||||
z = arrows[i * 5 + 4];
|
y = arrows[i * 5 + 3];
|
||||||
|
z = arrows[i * 5 + 4];
|
||||||
|
|
||||||
// cube coordinates = 12 * (stx * x + sty * y + stz * z);
|
set_arrow (weight, site, x, y, z);
|
||||||
|
|
||||||
|
/* // cube coordinates = 12 * (stx * x + sty * y + stz * z); */
|
||||||
arrow_offset = offset_after_grids + 12 * (stx * x + sty * y + stz * z);
|
arrow_offset = offset_after_grids + 12 * (stx * x + sty * y + stz * z);
|
||||||
arrows_write_basis (arrow_offset);
|
arrows_write_basis (arrow_offset);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue