WIP: code simplifié; erreurs systématiques set_arrow() / erase_arrow()
This commit is contained in:
parent
35fb51b7c7
commit
75e8d8dfa6
|
@ -47,7 +47,7 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int,
|
||||||
vz = (2 * k / space_Z_int - 1) * space_Z_int / max + (1 / max);
|
vz = (2 * k / space_Z_int - 1) * space_Z_int / max + (1 / max);
|
||||||
|
|
||||||
graphics_write_vertex(vx, vy, vz, print);
|
graphics_write_vertex(vx, vy, vz, print);
|
||||||
graphics_write_color(0.3f, 0.3f, 0.3f);
|
graphics_write_color(0.4f, 0.4f, 0.4f);
|
||||||
|
|
||||||
// réduit légèrement les longueurs des flèches
|
// réduit légèrement les longueurs des flèches
|
||||||
// pour qu'elles s'arrêtent avant les faces des cubes
|
// pour qu'elles s'arrêtent avant les faces des cubes
|
||||||
|
@ -64,15 +64,15 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int,
|
||||||
break;
|
break;
|
||||||
case ZENITH:
|
case ZENITH:
|
||||||
graphics_write_vertex (vx, vy - (site % 2 - 1) * (1 / max) + (site % 2 - 1) * arrow_tip_padding, vz, print);
|
graphics_write_vertex (vx, vy - (site % 2 - 1) * (1 / max) + (site % 2 - 1) * arrow_tip_padding, vz, print);
|
||||||
graphics_write_color(0.0f, 0.9f, 0.0f);
|
graphics_write_color(0.0f, 0.6f, 0.1f);
|
||||||
break;
|
break;
|
||||||
case NADIR:
|
case NADIR:
|
||||||
graphics_write_vertex (vx, vy - (site % 2) * (1 / max) + (site % 2) * arrow_tip_padding, vz, print);
|
graphics_write_vertex (vx, vy - (site % 2) * (1 / max) + (site % 2) * arrow_tip_padding, vz, print);
|
||||||
graphics_write_color(0.7f, 0.3f, 0.9f);
|
graphics_write_color(0.6f, 0.1f, 0.7f);
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
graphics_write_vertex (vx, vy, vz + (site % 2 - 1) * (1 / max) - (site % 2 - 1) * arrow_tip_padding, print);
|
graphics_write_vertex (vx, vy, vz + (site % 2 - 1) * (1 / max) - (site % 2 - 1) * arrow_tip_padding, print);
|
||||||
graphics_write_color(0.0f, 0.4f, 1.0f);
|
graphics_write_color(0.05f, 0.4f, 1.0f);
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
graphics_write_vertex (vx, vy, vz + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, print);
|
graphics_write_vertex (vx, vy, vz + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, print);
|
||||||
|
|
|
@ -555,6 +555,69 @@ bool graphics_shutdown(const void *gl_area)
|
||||||
|
|
||||||
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
||||||
int current_weight, int site, int x, int y, int z);
|
int current_weight, int site, int x, int y, int z);
|
||||||
|
static inline void print_buffers_array_head () {printf(" [rank] load | site x y z [address] buffer-vertex-1 buffer-vertex-2 buffer-lines\n");}
|
||||||
|
static inline void print_empty_buffers_array () {printf(" [NULL] ---- | ---- --- --- --- -1 --- --- ---\n");}
|
||||||
|
|
||||||
|
static void print_one_arrow_in_buffers (struct arrow_t *arrows, int i, int arrows_nb, int address) {
|
||||||
|
printf(" [%4d] = %2d | %2d, %2d, %2d, %2d, (%2d) %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %4d %4d\n",\
|
||||||
|
i,
|
||||||
|
arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z,
|
||||||
|
address,
|
||||||
|
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 0],
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 1],
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 2],
|
||||||
|
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 3],
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 4],
|
||||||
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 5],
|
||||||
|
|
||||||
|
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 0],
|
||||||
|
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
||||||
|
int current_weight, int site, int x, int y, int z)
|
||||||
|
{
|
||||||
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_vertex_origin [buffer_vertex_0_arrow + i]); printf("\n"); */
|
||||||
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_lines_origin [buffer_lines_0_arrow + i]); printf("\n"); */
|
||||||
|
print_buffers_array_head ();
|
||||||
|
for (int i = 0; i < arrows_nb; i++)
|
||||||
|
print_one_arrow_in_buffers(arrows_ptr, i, arrows_nb, address);
|
||||||
|
if (arrows_nb == 0) print_empty_buffers_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assigns a new load to the arrow at address (address)
|
* Assigns a new load to the arrow at address (address)
|
||||||
*/
|
*/
|
||||||
|
@ -610,6 +673,7 @@ static inline int erase_arrow (int arrows_nb, int address,
|
||||||
int console)
|
int console)
|
||||||
{
|
{
|
||||||
arrows_nb --;
|
arrows_nb --;
|
||||||
|
assert (arrows_nb);
|
||||||
|
|
||||||
arrows_ptr[address].load = arrows_ptr[arrows_nb].load;
|
arrows_ptr[address].load = arrows_ptr[arrows_nb].load;
|
||||||
arrows_ptr[address].site = arrows_ptr[arrows_nb].site;
|
arrows_ptr[address].site = arrows_ptr[arrows_nb].site;
|
||||||
|
@ -617,19 +681,14 @@ static inline int erase_arrow (int arrows_nb, int address,
|
||||||
arrows_ptr[address].y = arrows_ptr[arrows_nb].y;
|
arrows_ptr[address].y = arrows_ptr[arrows_nb].y;
|
||||||
arrows_ptr[address].z = arrows_ptr[arrows_nb].z;
|
arrows_ptr[address].z = arrows_ptr[arrows_nb].z;
|
||||||
|
|
||||||
/* for (int j = 0 + address; j < 4 + address; j++) */
|
|
||||||
/* buffer_lines_origin [(long) buffer_lines_0_arrow + j] = buffer_lines_origin[(long) buffer_lines_size - 4 + j]; */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (arrows_nb > 0) {
|
|
||||||
|
|
||||||
buffer_lines_size -= 2;
|
buffer_lines_size -= 2;
|
||||||
|
|
||||||
void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat));
|
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); */
|
||||||
if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr;
|
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
||||||
else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n");
|
/* else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); */
|
||||||
|
|
||||||
|
if (console) printf("arrows_nb = %d address = %d\n", arrows_nb, address);
|
||||||
|
|
||||||
// Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6)
|
// Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6)
|
||||||
|
|
||||||
|
@ -637,23 +696,9 @@ static inline int erase_arrow (int arrows_nb, int address,
|
||||||
buffer_vertex_origin [(long) buffer_vertex_0_arrow + i]
|
buffer_vertex_origin [(long) buffer_vertex_0_arrow + i]
|
||||||
= buffer_vertex_origin [(long) buffer_vertex_size - 6 + i];
|
= buffer_vertex_origin [(long) buffer_vertex_size - 6 + i];
|
||||||
|
|
||||||
/* for (int i = 0; i < 6; i++) */
|
for (int i = 0; i < 6; i++)
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + i] */
|
buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + i]
|
||||||
/* = buffer_colors_origin [(long) buffer_colors_size - 6 + i]; */
|
= buffer_colors_origin [(long) buffer_colors_size - 6 + i];
|
||||||
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_vertex_origin[(long) buffer_vertex_size - 4]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1]; */
|
|
||||||
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; */
|
|
||||||
|
|
||||||
buffer_vertex_size -= 6;
|
buffer_vertex_size -= 6;
|
||||||
buffer_colors_size -= 6;
|
buffer_colors_size -= 6;
|
||||||
|
@ -662,38 +707,11 @@ static inline int erase_arrow (int arrows_nb, int address,
|
||||||
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr;
|
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr;
|
||||||
else perror("In graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
||||||
if (1) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
|
||||||
|
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
}
|
}
|
||||||
/* if (0) { */
|
|
||||||
|
|
||||||
/* int some_nb = 12; if (arrows_nb == 1) some_nb = 9; */
|
|
||||||
|
|
||||||
/* void *new_arrows_list_ptr = g_realloc(arrows_ptr, arrows_nb * sizeof(struct arrow_t)); */
|
|
||||||
/* if (new_arrows_list_ptr) arrows_ptr = new_arrows_list_ptr; */
|
|
||||||
/* else perror("In erase arrow, can't re_allocate for arrow list.\n"); */
|
|
||||||
|
|
||||||
/* long unit = 24 * 3 * sizeof(GLfloat); // 4 * 3 * 4 = 48 sizeof(GLfloat) = 3 * 8 bits */
|
|
||||||
/* printf(" - erase_arrow() invoked with address = %d buffer_vertex_size - buffer_vertex_0_arrow = %d (for %d arrows)\n",\ */
|
|
||||||
/* address, (long) buffer_vertex_size - buffer_vertex_0_arrow, arrows_nb + 1); */
|
|
||||||
/* for (int i = 24; i < 36; i ++) printf(" %5.2f", buffer_vertex_origin[i]); printf("\n"); */
|
|
||||||
|
|
||||||
/* if (0) printf("buffer_vertex_0_arrow = %d arrows_nb * 3 = %d <<<<\n", buffer_vertex_0_arrow, arrows_nb * 3); */
|
|
||||||
/* void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_0_arrow + some_nb * 3 * sizeof(GLfloat)); */
|
|
||||||
/* if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; */
|
|
||||||
/* else perror("In erase arrow, can't re_allocate for arrow vertex buffer.\n"); */
|
|
||||||
|
|
||||||
/* if (0) printf("buffer_lines_0_arrow = %d arrows_nb * 2 = %d <<<<\n", buffer_lines_0_arrow, arrows_nb * 2); */
|
|
||||||
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_0_arrow + some_nb * 2 * sizeof(GLfloat)); */
|
|
||||||
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
|
||||||
/* else perror("In erase arrow, can't re_allocate for arrow lines buffer.\n"); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -729,19 +747,20 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (console) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
|
||||||
if (1) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
|
||||||
|
|
||||||
if (requested_weight == 0 && console)
|
/* if (console) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); */
|
||||||
printf(" - set_arrow() invoked with requested weight = %2d bf_vrtx = %d bf_ln = %d add: %d",\
|
/* if (0) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); */
|
||||||
requested_weight, buffer_vertex_size / 3, buffer_lines_size / 2, address);
|
/* if (requested_weight == 0 && console) */
|
||||||
|
/* printf(" - set_arrow() invoked with requested weight = %2d bf_vrtx = %d bf_ln = %d add: %d",\ */
|
||||||
|
/* requested_weight, buffer_vertex_size / 3, buffer_lines_size / 2, address); */
|
||||||
|
/* if (console) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); */
|
||||||
|
|
||||||
|
|
||||||
if (console) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
|
||||||
|
|
||||||
if (address == -1 && requested_weight > 0)
|
if (address == -1 && requested_weight > 0)
|
||||||
return create_arrow (arrows_nb, space_X, space_Y, space_Z, requested_weight, site, x, y, z, console);
|
return create_arrow (arrows_nb, space_X, space_Y, space_Z, requested_weight, site, x, y, z, console);
|
||||||
|
|
||||||
if (address >= 0 && requested_weight == 0)
|
if (address >= 0 && requested_weight == 0) // address >= 0 if and only if arrows_nb > 0
|
||||||
return erase_arrow (arrows_nb, address, site, x, y, z, console);
|
return erase_arrow (arrows_nb, address, site, x, y, z, console);
|
||||||
|
|
||||||
if (address >= 0 && current_weight != requested_weight)
|
if (address >= 0 && current_weight != requested_weight)
|
||||||
|
@ -754,38 +773,6 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void print_buffers_array_head () {printf(" [rank] load | site x y z [address] buffer-vertex-1 buffer-vertex-2 buffer-lines\n");}
|
|
||||||
static inline void print_empty_buffers_array () {printf(" [NULL] ---- | ---- --- --- --- -1 --- --- ---\n");}
|
|
||||||
|
|
||||||
static void print_one_arrow_in_buffers (struct arrow_t *arrows, int i, int arrows_nb, int address) {
|
|
||||||
printf(" [%4d] = %2d | %2d, %2d, %2d, %2d, (%2d) %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %4d %4d\n",\
|
|
||||||
i,
|
|
||||||
arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z,
|
|
||||||
address,
|
|
||||||
|
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 0],
|
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 1],
|
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 2],
|
|
||||||
|
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 3],
|
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 4],
|
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 5],
|
|
||||||
|
|
||||||
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 0],
|
|
||||||
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
|
||||||
int current_weight, int site, int x, int y, int z)
|
|
||||||
{
|
|
||||||
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_vertex_origin [buffer_vertex_0_arrow + i]); printf("\n"); */
|
|
||||||
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_lines_origin [buffer_lines_0_arrow + i]); printf("\n"); */
|
|
||||||
print_buffers_array_head ();
|
|
||||||
for (int i = 0; i < arrows_nb; i++)
|
|
||||||
print_one_arrow_in_buffers(arrows_ptr, i, arrows_nb, address);
|
|
||||||
if (arrows_nb == 0) print_empty_buffers_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -801,28 +788,23 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
// assert : no more than one arrow per address
|
// assert : no more than one arrow per address
|
||||||
// notify : weights are replaced, NOT added (could be !)
|
// notify : weights are replaced, NOT added (could be !)
|
||||||
|
|
||||||
struct timespec ts;
|
|
||||||
srand(time(NULL)); // Initialisation du générateur pseudo-aléatoire
|
srand(time(NULL)); // Initialisation du générateur pseudo-aléatoire
|
||||||
int rand(void);
|
int rand(void);
|
||||||
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
||||||
|
|
||||||
int arbitrary = 3;
|
int arbitrary = 4;
|
||||||
int space_X = rand() % arbitrary,
|
int space_X = 1,// + rand() % arbitrary,
|
||||||
space_Y = rand() % arbitrary,
|
space_Y = 1,// + rand() % arbitrary,
|
||||||
space_Z = rand() % arbitrary;
|
space_Z = 1;// + rand() % arbitrary;
|
||||||
int density_max = space_X * space_Y * space_Z;
|
int density_max = space_X * space_Y * space_Z;
|
||||||
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
||||||
|
|
||||||
int print_arrows_data = 0;
|
int print_arrows_data = 0, console = 0;
|
||||||
|
|
||||||
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
||||||
int specif_arrows_nb = rand() % density_max / 2;
|
int specif_arrows_nb = rand() % density_max / 2;
|
||||||
int arrows_nb = 0, cpt = 0, t_initial = 0;
|
int arrows_nb = 0, cpt = 0, t_initial = 0;
|
||||||
|
|
||||||
int print_inter_results = 0;
|
|
||||||
if (print_inter_results) clock_gettime(CLOCK_REALTIME, &ts); t_initial = ts.tv_sec;
|
|
||||||
if (print_inter_results) printf("%10d | ", specif_arrows_nb / 1000);
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -832,100 +814,32 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* V E R T E X F I R S T */
|
|
||||||
|
|
||||||
/* S P A C E */
|
/* S P A C E */
|
||||||
|
|
||||||
if (0) printf("buffer_vertex_size before writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size);
|
|
||||||
|
|
||||||
write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z);
|
write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z);
|
||||||
/* buffer_colors_size = buffer_vertex_size; */
|
|
||||||
|
|
||||||
if (0) printf("buffer_vertex_size after writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size);
|
|
||||||
|
|
||||||
write_grids_on_space_faces_vertex (space_X, space_Y, space_Z);
|
|
||||||
/* buffer_colors_size = buffer_vertex_size; */
|
|
||||||
|
|
||||||
if (0) printf("buffer_vertex_size after writing %3d space_faces_vertex : %3d (x 3 = %4d)\n\n", buffer_vertex_size / 3 - 8, buffer_vertex_size / 3, buffer_vertex_size);
|
|
||||||
/* if (0) printf("(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4 = %3d (x 3 = %4d)\n\n",\ */
|
|
||||||
/* (space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4, ((space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4) * 3); */
|
|
||||||
|
|
||||||
|
|
||||||
/* A R R O W S */
|
|
||||||
|
|
||||||
/* if (0) printf("buffer_vertex_size before writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */
|
|
||||||
|
|
||||||
/* for (int i = 0; i < arrows_nb; i++) { */
|
|
||||||
/* load = arrows_ptr[i].load; */
|
|
||||||
/* site = arrows_ptr[i].site; */
|
|
||||||
/* x = arrows_ptr[i].x; */
|
|
||||||
/* y = arrows_ptr[i].y; */
|
|
||||||
/* z = arrows_ptr[i].z; */
|
|
||||||
|
|
||||||
/* write_one_arrow_vertex(space_X, space_Y, space_Z, */
|
|
||||||
/* load, site, x, y, z); */
|
|
||||||
/* buffer_colors_size = buffer_vertex_size; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* if (0) printf("buffer_vertex_size after writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* L I N E S S E C O N D */
|
|
||||||
|
|
||||||
// buffer_vertex_size = 0; buffer_colors_size = 0; buffer_lines_size = 0;
|
|
||||||
|
|
||||||
/* S P A C E */
|
|
||||||
|
|
||||||
if (0) printf("buffer_lines_size before writing 12 space_ridges_lines : %2d (* 2 = %2d)\n", buffer_lines_size / 2, buffer_lines_size);
|
|
||||||
write_space_ridges_lines ();
|
write_space_ridges_lines ();
|
||||||
if (0) printf("buffer_lines_size after writing 12 space_ridges_lines : %2d (* 2 = %2d)\n", buffer_lines_size / 2, buffer_lines_size);
|
write_grids_on_space_faces_vertex (space_X, space_Y, space_Z);
|
||||||
|
|
||||||
if (0) printf("buffer_lines_size before writing (n) space_faces_lines : %2d (* 2 = %2d)\n", buffer_lines_size / 2, buffer_lines_size);
|
|
||||||
write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z);
|
write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z);
|
||||||
if (0) printf("buffer_lines_size after writing (n) space_faces_lines : %d (* 2 = %d)\n\n", buffer_lines_size / 2, buffer_lines_size);
|
|
||||||
|
|
||||||
/* Ce programme définit et crée séquentiellement les caractéristiques puis les images de l'espace puis celles des flèches
|
|
||||||
* Pour pouvoir effacer une flèche (n'importe laquelle),
|
|
||||||
* il est nécéssaire de connaître la taille des buffers au moment de la création de la première flèche */
|
|
||||||
|
|
||||||
buffer_vertex_0_arrow = buffer_vertex_size; // Attention, à ce stade, pas de vertex redondant
|
buffer_vertex_0_arrow = buffer_vertex_size; // Attention, à ce stade, pas de vertex redondant
|
||||||
buffer_lines_0_arrow = buffer_lines_size;
|
buffer_lines_0_arrow = buffer_lines_size;
|
||||||
if (0) printf("buffer_vertex_0_arrow = %d (%d points) buffer_lines_0_arrow = %d (%d lines)\n",\
|
|
||||||
buffer_vertex_0_arrow, buffer_vertex_0_arrow / 3, buffer_lines_0_arrow, buffer_lines_0_arrow / 2);
|
|
||||||
|
|
||||||
/* A R R O W S */
|
/* A R R O W S */
|
||||||
|
|
||||||
/* #pragma omp parallel */
|
for (int i = 0; i < 6; i++)
|
||||||
/* { */
|
|
||||||
/* while (arrows_nb < specif_arrows_nb){ */
|
|
||||||
|
|
||||||
arrows_nb = 0;
|
|
||||||
|
|
||||||
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
||||||
1 + rand() % arbitrary, // load / weight
|
1, // load
|
||||||
0,//rand() % 6, // site,
|
i % 6, // site
|
||||||
rand() % space_X, // x
|
0,//rand() % space_X, // x
|
||||||
rand() % space_Y, // y
|
0,//rand() % space_Y, // y
|
||||||
rand() % space_Z, 0); // z
|
0,//rand() % space_Z, // z
|
||||||
|
console);
|
||||||
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
||||||
1 + rand() % arbitrary, // load / weight
|
|
||||||
1,//rand() % 6, // site,
|
|
||||||
rand() % space_X, // x
|
|
||||||
rand() % space_Y, // y
|
|
||||||
rand() % space_Z, 0); // z
|
|
||||||
|
|
||||||
/* clock_gettime(CLOCK_REALTIME, &ts); < Je n'arrive pas à afficher les temps en cours d'exécutuion */
|
|
||||||
/* if (arrows_nb % 1000 == 0) {cpt++; printf("%8d", arrows_nb / 1000); if (cpt % 22 == 0) printf(" %f\n%10d | ", specif_arrows_nb / 1000, ts.tv_sec - t_initial);} */
|
|
||||||
if (print_inter_results && arrows_nb % 1000 == 0) {cpt++; printf("%8d", arrows_nb / 1000); if (cpt % 24 == 0) printf("\n%10d | ", specif_arrows_nb / 1000);}
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* N E W D A T A W I L L N O W B E S P E C I F I E D */
|
/* N E W D A T A W I L L N O W B E S P E C I F I E D */
|
||||||
|
|
||||||
|
@ -933,201 +847,28 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* if (0) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
console = 1;
|
||||||
|
|
||||||
|
/* If load == 0 then erase the arrow at this address */
|
||||||
|
|
||||||
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
||||||
1 + rand() % arbitrary, // load / weight
|
0, // load
|
||||||
2,//rand() % 6, // site,
|
0, // site
|
||||||
rand() % space_X, // x
|
0, // x
|
||||||
rand() % space_Y, // y
|
0, // y
|
||||||
rand() % space_Z, 0); // z
|
0, // z
|
||||||
|
console);
|
||||||
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
|
||||||
|
|
||||||
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
||||||
1 + rand() % arbitrary, // load / weight
|
|
||||||
3,//rand() % 6, // site,
|
|
||||||
rand() % space_X, // x
|
|
||||||
rand() % space_Y, // y
|
|
||||||
rand() % space_Z, 0); // z
|
|
||||||
|
|
||||||
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
||||||
0,//rand() % arbitrary + 1, // load / weight
|
|
||||||
0,//rand() % 6, // site,
|
|
||||||
rand() % space_X, // x
|
|
||||||
rand() % space_Y, // y
|
|
||||||
rand() % space_Z, 0); // z
|
|
||||||
|
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
||||||
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
||||||
/* 1,//rand() % 6, // site, */
|
|
||||||
/* 0,//rand() % space_X, // x */
|
|
||||||
/* 0,//rand() % space_Y, // y */
|
|
||||||
/* 0, 0);//rand() % space_Z); // z */
|
|
||||||
|
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
||||||
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
||||||
/* 2,//rand() % 6, // site, */
|
|
||||||
/* 0,//rand() % space_X, // x */
|
|
||||||
/* 0,//rand() % space_Y, // y */
|
|
||||||
/* 0, 0);//rand() % space_Z); // z */
|
|
||||||
|
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
||||||
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
||||||
/* 3,//rand() % 6, // site, */
|
|
||||||
/* 0,//rand() % space_X, // x */
|
|
||||||
/* 0,//rand() % space_Y, // y */
|
|
||||||
/* 0, 0);//rand() % space_Z); // z */
|
|
||||||
|
|
||||||
/* int address = 1; */
|
|
||||||
|
|
||||||
/* if (0) printf("buffer_lines_0_arrow = %d address = %d buffer_lines_size = %d >>>",\ */
|
|
||||||
/* buffer_lines_0_arrow, address, buffer_lines_size); */
|
|
||||||
/* //buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 0] = buffer_lines_origin[(long) buffer_lines_size - 2]; */
|
|
||||||
/* //buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 1] = buffer_lines_origin[(long) buffer_lines_size - 1]; */
|
|
||||||
|
|
||||||
/* buffer_lines_size -= 2; */
|
|
||||||
|
|
||||||
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); */
|
|
||||||
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
|
||||||
/* else perror("In experience, can't re_allocate for arrows lines buffer.\n"); */
|
|
||||||
/* if (0) printf(">>> buffer_lines_size = %d\n", buffer_lines_size); */
|
|
||||||
|
|
||||||
|
|
||||||
/* // Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6) */
|
|
||||||
/* if (0) printf("buffer_vertex_0_arrow = %d address = %d buffer_vertex_size = %d >>>", buffer_vertex_0_arrow, address, buffer_vertex_size); */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_vertex_origin[(long) buffer_vertex_size - 4]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2]; */
|
|
||||||
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1]; */
|
|
||||||
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; */
|
|
||||||
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; */
|
|
||||||
|
|
||||||
/* buffer_vertex_size -= 6; */
|
|
||||||
/* buffer_colors_size -= 6; */
|
|
||||||
|
|
||||||
/* void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat)); */
|
|
||||||
/* if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; */
|
|
||||||
/* else perror("In experience, can't re_allocate for arrows vertex buffer.\n"); */
|
|
||||||
/* if (0) printf(">>> buffer_vertex_size = %d\n", buffer_vertex_size); */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* F R E E */
|
||||||
|
|
||||||
|
/* ( F R E E 'S P A C E' : S E E G R A P H I C S H U T D O W N ) */
|
||||||
|
|
||||||
if (0) printf("buffer_lines_0_arrow = %d\n", buffer_lines_0_arrow);
|
/*--------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
if (0) for (long h = buffer_lines_0_arrow; h < buffer_lines_size; h++) {
|
free(arrows_ptr); arrows_ptr = NULL; arrows_nb = 0;
|
||||||
if (h == buffer_lines_0_arrow) printf("\n");
|
|
||||||
if (h % 2 == 0) printf("\n");
|
|
||||||
printf("%2d ", buffer_lines_origin [h]);
|
|
||||||
}
|
|
||||||
if (0) printf("\n");
|
|
||||||
|
|
||||||
if (0) for (long a = buffer_vertex_0_arrow; a < buffer_vertex_size; a++) {
|
|
||||||
if (a % 6 == 0) printf("\n");
|
|
||||||
if (a % 3 == 0) printf("\n");
|
|
||||||
printf("[%d] %5.2f ", a/3, buffer_vertex_origin [a]);
|
|
||||||
}
|
|
||||||
if (0) printf("\n");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
||||||
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
||||||
/* 0,//rand() % 6, // site, */
|
|
||||||
/* 0,//rand() % space_X, // x */
|
|
||||||
/* 0,//rand() % space_Y, // y */
|
|
||||||
/* 0, 0);//rand() % space_Z); // z */
|
|
||||||
|
|
||||||
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
|
||||||
|
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, */
|
|
||||||
/* 1,//rand() % arbitrary + 1, // load / weight */
|
|
||||||
/* 2,//rand() % 6, // site, */
|
|
||||||
/* 0,//rand() % space_X, // x */
|
|
||||||
/* 0,//rand() % space_Y, // y */
|
|
||||||
/* 0, 0);//rand() % space_Z); // z */
|
|
||||||
|
|
||||||
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, */
|
|
||||||
/* 1,//rand() % arbitrary + 1, // load / weight */
|
|
||||||
/* 3,//rand() % 6, // site, */
|
|
||||||
/* 0,//rand() % space_X, // x */
|
|
||||||
/* 0,//rand() % space_Y, // y */
|
|
||||||
/* 0, 0);//rand() % space_Z); // z */
|
|
||||||
|
|
||||||
/* printf("On devrait avoir deux flèches Y+Y- (Zénith-Nadir) dessinées (au lieu des deux flèches X+X- Est-Ouest)...\n"); */
|
|
||||||
|
|
||||||
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
|
||||||
|
|
||||||
// buffer_vertex_size -= 2;
|
|
||||||
// buffer_vertex_size += 3;
|
|
||||||
|
|
||||||
|
|
||||||
/* assert : arrows_nb > arbitrary; */
|
|
||||||
/* int random_choice, modified = 0, deleted = 0; */
|
|
||||||
|
|
||||||
/* #pragma omp parallel */
|
|
||||||
/* { */
|
|
||||||
/* while (modified < arbitrary) { */
|
|
||||||
|
|
||||||
/* random_choice = rand() % 6; */
|
|
||||||
/* if (random_choice == 0) deleted++; */
|
|
||||||
|
|
||||||
/* modified = set_arrow (arrows_ptr, arrows_nb + modified, */
|
|
||||||
/* random_choice, // load / weight */
|
|
||||||
/* rand() % 6, // site, */
|
|
||||||
/* rand() % space_X, // x */
|
|
||||||
/* rand() % space_Y, // y */
|
|
||||||
/* rand() % space_Z, 0); // z */
|
|
||||||
/* } */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* #pragma omp parallel */
|
|
||||||
/* { */
|
|
||||||
/* for (int i = 0; i < arrows_nb + modified; i++) { */
|
|
||||||
/* load = arrows_ptr[i].load; */
|
|
||||||
/* site = arrows_ptr[i].site; */
|
|
||||||
/* x = arrows_ptr[i].x; */
|
|
||||||
/* y = arrows_ptr[i].y; */
|
|
||||||
/* z = arrows_ptr[i].z; */
|
|
||||||
|
|
||||||
/* buffer_vertex_size += write_one_arrow_vertex(space_X, space_Y, space_Z, */
|
|
||||||
/* load, site, x, y, z); */
|
|
||||||
/* buffer_colors_size = buffer_vertex_size; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* for (int i = 0; i < arrows_nb + modified; i++) { */
|
|
||||||
/* load = arrows_ptr[i].load; */
|
|
||||||
/* site = arrows_ptr[i].site; */
|
|
||||||
/* x = arrows_ptr[i].x; */
|
|
||||||
/* y = arrows_ptr[i].y; */
|
|
||||||
/* z = arrows_ptr[i].z; */
|
|
||||||
|
|
||||||
/* buffer_vertex_size += write_one_arrow_line (buffer_vertex_size); */
|
|
||||||
/* } */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* print_evolution (arrows_ptr, arrows_nb, arbitrary, deleted, print_arrows_data); */
|
|
||||||
|
|
||||||
|
|
||||||
// ? free (space) TODO
|
|
||||||
|
|
||||||
free(arrows_ptr);
|
|
||||||
arrows_ptr = NULL;
|
|
||||||
arrows_nb = 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,14 @@ int write_space_ridges_vertex (long offset_vertex, long x, long y, long z)
|
||||||
|
|
||||||
graphics_write_vertex (offset_vertex + x / max, + y / max, + z / max, 0);
|
graphics_write_vertex (offset_vertex + x / max, + y / max, + z / max, 0);
|
||||||
|
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.8f, 0.6f, 0.5f);
|
||||||
|
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ long write_grids_on_space_faces_vertex (long x, long y, long z)
|
||||||
graphics_write_vertex ((2 * i / x - 1) * x / max, y / max, z / max, 0);
|
graphics_write_vertex ((2 * i / x - 1) * x / max, y / max, z / max, 0);
|
||||||
graphics_write_vertex ((2 * i / x - 1) * x / max, y / max, - z / max, 0);
|
graphics_write_vertex ((2 * i / x - 1) * x / max, y / max, - z / max, 0);
|
||||||
|
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* offset_vertex += (x - 1) * 4; */ /* offset_colors += (x - 1) * 4; */
|
/* offset_vertex += (x - 1) * 4; */ /* offset_colors += (x - 1) * 4; */
|
||||||
|
@ -92,10 +92,10 @@ long write_grids_on_space_faces_vertex (long x, long y, long z)
|
||||||
graphics_write_vertex ( x / max, (2 * i / y - 1) * y / max, z / max, 0);
|
graphics_write_vertex ( x / max, (2 * i / y - 1) * y / max, z / max, 0);
|
||||||
graphics_write_vertex ( x / max, (2 * i / y - 1) * y / max, - z / max, 0);
|
graphics_write_vertex ( x / max, (2 * i / y - 1) * y / max, - z / max, 0);
|
||||||
|
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* offset_vertex += (y - 1) * 4; */ /* offset_colors += (y - 1) * 4; */
|
/* offset_vertex += (y - 1) * 4; */ /* offset_colors += (y - 1) * 4; */
|
||||||
|
@ -107,10 +107,10 @@ long write_grids_on_space_faces_vertex (long x, long y, long z)
|
||||||
graphics_write_vertex ( x / max, y / max, (2 * i / z - 1) * z / max, 0);
|
graphics_write_vertex ( x / max, y / max, (2 * i / z - 1) * z / max, 0);
|
||||||
graphics_write_vertex ( x / max, - y / max, (2 * i / z - 1) * z / max, 0);
|
graphics_write_vertex ( x / max, - y / max, (2 * i / z - 1) * z / max, 0);
|
||||||
|
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.55f, 0.55f, 0.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (x + y + z - 3) * 3;
|
return (x + y + z - 3) * 3;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<requires lib="gtk" version="4.6"/>
|
<requires lib="gtk" version="4.6"/>
|
||||||
<template class="GemGraphClientWindow" parent="GtkApplicationWindow">
|
<template class="GemGraphClientWindow" parent="GtkApplicationWindow">
|
||||||
<property name="icon-name">application-x-executable</property>
|
<property name="icon-name">application-x-executable</property>
|
||||||
<property name="title">Bac à sable</property>
|
<property name="title">WIP</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<child>
|
<child>
|
||||||
|
|
|
@ -156,7 +156,7 @@ void ui_setup_glarea(GtkGLArea *target, GtkBox *target_controls)
|
||||||
// The main "draw" call for GtkGLArea
|
// The main "draw" call for GtkGLArea
|
||||||
g_signal_connect(gl_area, "render", G_CALLBACK(on_render), NULL);
|
g_signal_connect(gl_area, "render", G_CALLBACK(on_render), NULL);
|
||||||
|
|
||||||
gtk_widget_set_hexpand(controls, TRUE);
|
//gtk_widget_set_hexpand(controls, TRUE);
|
||||||
|
|
||||||
for(i = 0; i < N_AXIS; i++)
|
for(i = 0; i < N_AXIS; i++)
|
||||||
gtk_box_append(GTK_BOX(controls), create_axis_slider(i));
|
gtk_box_append(GTK_BOX(controls), create_axis_slider(i));
|
||||||
|
|
Loading…
Reference in New Issue