Compare commits

...

3 Commits

6 changed files with 239 additions and 479 deletions

View File

@ -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);

View File

@ -29,6 +29,60 @@
#include "../../include/displays.h" #include "../../include/displays.h"
/* TO REMEMBER : Ici, tout ce qui gène la lecture du code en cours de debugging
* #pragma omp parallel schedule(static, 12)
* void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
{
// assert : space dimensions (x,y,z) > 0
// assert : arrows localization within space and sites
// assert : no more than one arrow per address
// notify : weights are replaced, NOT added (could be !)
/*
* Init space and arrows (= initial state)
* and allows ulterior creations, suppressions or modifications of the arrows[] array
*
* Draws space and arrows
*
* // Initialisation du générateur pseudo-aléatoire
* // Attention, à ce stade, pas de vertex redondant
*/
/* in set_arrow() : */
/* if (console) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); */
/* if (0) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); */
/* 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); */
/*
* Calls one of the functions create_arrow(), erase_arrow() or rewrite_arrow()
* according to requested weight and address (coord site, x, y, z)
*
* May not call any of these three functions if :
* - Current_weight of an arrow located at the requested address == requested_weight
* - No arrow was found at the requested addres AND current_weight == requested_weight
*/
/*
* Removes an arrow at address (address)
*/
/*
* Creates a new arrow at address (address)
* NB Weights (or loads) are NOT added
*/
/*
* Assigns a new load to the arrow at address (address)
*/
/*--------------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------------------*/
/* Prints the arrows[] array /* Prints the arrows[] array
* *
@ -41,9 +95,9 @@ void print_arrows_array (struct arrow_t *arrows, int arrows_nb, int invoked_by)
{ {
printf(" [rank] load | site x y z ("); printf(" [rank] load | site x y z (");
switch (invoked_by) { switch (invoked_by) {
case 0: printf("delete)"); break; case 0: printf("after deletion)"); break;
case 1: printf("create)"); break; case 1: printf("after creation)"); break;
case 2: printf("modify)"); break; case 2: printf("after modification)"); break;
case 3: printf("address >= 0 && current_weight == requested_weight)"); break; case 3: printf("address >= 0 && current_weight == requested_weight)"); break;
case 4: printf("address == -1 && requested_weight == 0)"); break; case 4: printf("address == -1 && requested_weight == 0)"); break;
case 5: printf("print_user_choices)"); break; case 5: printf("print_user_choices)"); break;
@ -67,7 +121,7 @@ void print_user_choices(struct arrow_t *arrows, int arrows_nb,
int space_size_x, int space_size_y, int space_size_z, int space_size_x, int space_size_y, int space_size_z,
int show_array, int show_space_design) int show_array, int show_space_design)
{ {
printf("model + user constraints :\tspace size x,y,z (%3d,%3d,%3d)\tarrows nb : %6d\t",\ printf("model + user constraints :\tspace size x,y,z (%3d,%3d,%3d)\t\tarrows nb : %6d\t",\
space_size_x, space_size_y, space_size_z, arrows_nb); space_size_x, space_size_y, space_size_z, arrows_nb);
if (show_space_design) printf(" (grilles alternées)"); if (show_space_design) printf(" (grilles alternées)");

View File

@ -35,8 +35,7 @@
#define VERTEX_SHADER_FILE "src/shaders/shader.vert" #define VERTEX_SHADER_FILE "src/shaders/shader.vert"
#define FRAG_SHADER_FILE "src/shaders/shader.frag" #define FRAG_SHADER_FILE "src/shaders/shader.frag"
static struct arrow_t *arrows_ptr; /* nom modifié pour pouvoir plus facilement distinguer le tableau static struct arrow_t *arrows_ptr;
* des autres noms incluant "arrows" (de arrows_nb, par ex.) */
GLfloat *buffer_vertex_origin = NULL; GLfloat *buffer_vertex_origin = NULL;
GLfloat *buffer_colors_origin = NULL; GLfloat *buffer_colors_origin = NULL;
GLuint *buffer_lines_origin = NULL; GLuint *buffer_lines_origin = NULL;
@ -555,9 +554,81 @@ 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");}
* Assigns a new load to the arrow at address (address) 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();
}
static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x, int y, int z, int console) static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x, int y, int z, int console)
{ {
arrows_ptr[address].load = load; arrows_ptr[address].load = load;
@ -567,10 +638,6 @@ static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x,
return arrows_nb; return arrows_nb;
} }
/*
* Creates a new arrow at address (address)
* NB Weights (or loads) are NOT added
*/
static inline int create_arrow (int arrows_nb, static inline int create_arrow (int arrows_nb,
int space_X, int space_Y, int space_Z, int space_X, int space_Y, int space_Z,
int load, int site, int x, int y, int z, int load, int site, int x, int y, int z,
@ -602,219 +669,98 @@ static inline int create_arrow (int arrows_nb,
return arrows_nb; return arrows_nb;
} }
/*
* Removes an arrow at address (address)
*/
static inline int erase_arrow (int arrows_nb, int address, static inline int erase_arrow (int arrows_nb, int address,
int site, int x, int y, int z, int site, int x, int y, int z,
int console) int console)
{ {
arrows_nb --; arrows_nb --;
assert (arrows_nb);
arrows_ptr[address].load = arrows_ptr[arrows_nb].load; int mem = arrows_ptr[address].site;
arrows_ptr[address].site = arrows_ptr[arrows_nb].site;
arrows_ptr[address].x = arrows_ptr[arrows_nb].x;
arrows_ptr[address].y = arrows_ptr[arrows_nb].y;
arrows_ptr[address].z = arrows_ptr[arrows_nb].z;
/* for (int i = 0 + address; i < 6 + address; i++) */ arrows_ptr[address].load = arrows_ptr[arrows_nb].load;
/* buffer_vertex_origin [(long) buffer_vertex_0_arrow + i] = buffer_vertex_origin[(long) buffer_vertex_size - 6 + i]; */ arrows_ptr[address].site = arrows_ptr[arrows_nb].site;
arrows_ptr[address].x = arrows_ptr[arrows_nb].x;
/* for (int j = 0 + address; j < 4 + address; j++) */ arrows_ptr[address].y = arrows_ptr[arrows_nb].y;
/* buffer_lines_origin [(long) buffer_lines_0_arrow + j] = buffer_lines_origin[(long) buffer_lines_size - 4 + j]; */ arrows_ptr[address].z = arrows_ptr[arrows_nb].z;
if (console) printf("in erase_arrow() : arrows_nb = %d > %d arrow to erase > (address = %d, site = %d)\n\
: arrows_ptr[%d].site = %d >> %d (%d is last arrow.site)\n",\
arrows_nb + 1, arrows_nb, address, address, site, mem, arrows_ptr[address].site, arrows_ptr[arrows_nb].site);
if (arrows_nb > 0) { // Attention : lors de la création des vertex des flèches, tous les vertex centraux sont redondants (au maximum 6)
buffer_lines_size -= 2; for (int i = 0 + address * 6; i < 6 + address * 6; i++)
buffer_vertex_origin [(long) buffer_vertex_0_arrow + i]
= buffer_vertex_origin [(long) buffer_vertex_size - 6 + i];
void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); for (int i = 0; i < 6; i++)
if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + i]
else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); = buffer_colors_origin [(long) buffer_colors_size - 6 + i];
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 graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
void *new_arrows_colors_ptr = g_realloc(buffer_colors_origin, buffer_colors_size * sizeof(GLfloat));
if (new_arrows_colors_ptr) buffer_colors_origin = new_arrows_colors_ptr;
else perror("In graphics.erase_arrow(), can't re_allocate for arrows colors buffer.\n");
// Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6) /* buffer_vertex_size -= 6; <<< ceci est fait dans : graphics_write_vertex() */
/* buffer_colors_size -= 6; <<< ceci est fait dans : graphics_write_colors() */
buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; /* buffer_lines_size -= 2; <<< ceci est fait dans : graphics_write_line() */
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_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 graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
}
/* Il ne faut pas réécrire ce qui suit: ces lignes dessinent maintenant à partir d'autres vertex */
/* 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 graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); */
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0); if (console) 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"); */
/* } */
static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int space_X, int space_Y, int space_Z,
static inline void print_vertex_and_lines_buffers(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight, int requested_weight, int site, int arrow_x, int arrow_y, int arrow_z, int console)
int current_weight, int site, int x, int y, int z);
static inline void show_user_action(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
int current_weight, int site, int x, int y, int z);
/*
* Calls one of the functions create_arrow(), erase_arrow() or rewrite_arrow()
* according to requested weight and address (coord site, x, y, z)
*
* May not call any of these three functions if :
* - Current_weight of an arrow located at the requested address == requested_weight
* - No arrow was found at the requested addres AND current_weight == requested_weight
*/
static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
int space_X, int space_Y, int space_Z,
int requested_weight, int site, int x, int y, int z, int console)
{ {
int address = -1, current_weight = -1; int address = -1, current_weight = -1;
#pragma omp parallel schedule(static, 12) for (int i = 0; i < arrows_nb; i++)
{ if ((site == arrows_ptr[i].site)
for (int i = 0; i < arrows_nb; i++) { && (arrow_x == arrows_ptr[i].x)
if ((site == arrows_ptr[i].site) && (arrow_y == arrows_ptr[i].y)
&& (x == arrows_ptr[i].x) && (arrow_z == arrows_ptr[i].z))
&& (y == arrows_ptr[i].y)
&& (z == arrows_ptr[i].z))
{ {
address = i * 5; address = i;
current_weight = arrows_ptr[i].load; current_weight = arrows_ptr[i].load;
break; break;
} }
}
}
// print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
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 (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, arrow_x, arrow_y, arrow_z, console);
if (address >= 0 && requested_weight == 0) // address >= 0 if and only if arrows_nb > 0
if (address >= 0 && requested_weight == 0) return erase_arrow (arrows_nb, address, site, arrow_x, arrow_y, arrow_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)
return rewrite_arrow (arrows_nb, address/5, requested_weight, site, x, y, z, console); return rewrite_arrow (arrows_nb, address/5, requested_weight, site, arrow_x, arrow_y, arrow_z, console);
if (address >= 0 && current_weight == requested_weight && console) print_arrows_array(arrows_ptr, arrows_nb, 3);
if (address >= 0 && current_weight == requested_weight && console) print_arrows_array(arrows_ptr, arrows_nb, 3); if (address == -1 && requested_weight == 0 && console) print_arrows_array(arrows_ptr, arrows_nb, 4);
if (address == -1 && requested_weight == 0 && console) print_arrows_array(arrows_ptr, arrows_nb, 4);
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 %6.2f %6.2f\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 * 3 + 0], void main_test_graphics (void)
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 1],
buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 2],
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 3],
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 4],
buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 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"); */ srand(time(NULL)); int rand(void); void srand(unsigned int seed); int arbitrary = 4, randomize = 0, console = 0;
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_lines_origin [buffer_lines_0_arrow + i]); printf("\n"); */ int space_X = 1, space_Y = 1, space_Z = 1, density_max = space_X * space_Y * space_Z;
print_buffers_array_head (); if (randomize) {space_X = 1 + rand() % arbitrary; space_Y = 1 + rand() % arbitrary; space_Z = 1 + rand() % arbitrary;}
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();
}
/*
* Init space and arrows (= initial state)
* and allows ulterior creations, suppressions or modifications of the arrows[] array
*
* Draws space and arrows
*/
void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
{
// assert : space dimensions (x,y,z) > 0
// assert : arrows localization within space and sites
// assert : no more than one arrow per address
// notify : weights are replaced, NOT added (could be !)
struct timespec ts;
srand(time(NULL)); // Initialisation du générateur pseudo-aléatoire
int rand(void);
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
int arbitrary = 5;
int space_X = 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 max = fmax(space_X, space_Y); max = fmax(max, space_Z);
int load = 0, site = 0, x = 0, y = 0, z = 0, arrows_nb = 0, specif_arrows_nb = rand() % density_max / 2;
int print_arrows_data = 0;
int load = 0, site = 0, x = 0, y = 0, z = 0;
int specif_arrows_nb = rand() % density_max / 2;
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);
/*--------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------*/
@ -825,302 +771,62 @@ 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 buffer_vertex_0_arrow = buffer_vertex_size;
* 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_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 */ if (1) 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,
rand() % arbitrary + 1, // load / weight 1, i % 6, 0, 0, 0, console);
0,//rand() % 6, // site, if (0) for (int i = 0; i < rand() % density_max; i++)
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, arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
rand() % arbitrary + 1, // load / weight 1, // load
1,//rand() % 6, // site, rand() % 6, // site
0,//rand() % space_X, // x rand() % space_X, // x
0,//rand() % space_Y, // y rand() % space_Y, // y
0, 0);//rand() % space_Z); // z rand() % space_Z, // z
console);
/* clock_gettime(CLOCK_REALTIME, &ts); < Je n'arrive pas à afficher les temps en cours d'exécutuion */ if (1) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0);
/* 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);}
/* } */
/* 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 */
/* A N D T H E N D R A W N E D */
/*--------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------*/
/* if (0) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 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 */
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, /* A N D T H E N D R A W N E D */
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
/* 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, console = 1;
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
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, /* If load == 0 then erase the arrow at this address v */
0,//rand() % arbitrary + 1, // load / weight arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0, 0, 0, 0, console);
0,//rand() % 6, // site, arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 1, 0, 0, 0, console);
0,//rand() % space_X, // x arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 2, 0, 0, 0, console);
0,//rand() % space_Y, // y /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 3, 0, 0, 0, console); */
0, 0);//rand() % space_Z); // z /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 4, 0, 0, 0, console); */
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 5, 0, 0, 0, console); */
/* 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;
} }

View File

@ -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;

View File

@ -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>

View File

@ -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));