WIP: affichage Ok graphisme Ok pour l'effacement de la 1ère flèche (pas la 2ème)
This commit is contained in:
parent
fd6f36ae45
commit
a111d4e51d
|
@ -72,11 +72,11 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int,
|
||||||
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.05f, 0.4f, 1.0f);
|
graphics_write_color(1.0f, 1.0f, 0.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);
|
||||||
graphics_write_color(1.0f, 1.0f, 0.0f);
|
graphics_write_color(0.05f, 0.4f, 1.0f);
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ static void print_one_arrow_in_buffers (struct arrow_t *arrows,
|
||||||
GLfloat *buffer_lines_origin, long buffer_lines_0_arrow,
|
GLfloat *buffer_lines_origin, long buffer_lines_0_arrow,
|
||||||
int i, int arrows_nb, int address)
|
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",\
|
printf(" [%4d] = %2d | %2d, %2d, %2d, %2d, (%2d) %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %4f %4f\n",\
|
||||||
i,
|
i,
|
||||||
arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z,
|
arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z,
|
||||||
address,
|
address,
|
||||||
|
|
|
@ -42,13 +42,13 @@ GLuint *buffer_lines_origin = NULL;
|
||||||
GLuint *buffer_plans_origin = NULL;
|
GLuint *buffer_plans_origin = NULL;
|
||||||
|
|
||||||
volatile long buffer_vertex_size = 0;
|
volatile long buffer_vertex_size = 0;
|
||||||
volatile long buffer_lines_size = 0;
|
|
||||||
volatile long buffer_colors_size = 0;
|
volatile long buffer_colors_size = 0;
|
||||||
|
volatile long buffer_lines_size = 0;
|
||||||
volatile long buffer_plans_size = 0;
|
volatile long buffer_plans_size = 0;
|
||||||
|
|
||||||
volatile long buffer_vertex_0_arrow = 0;
|
volatile long buffer_vertex_0_arrow = 0;
|
||||||
volatile long buffer_lines_0_arrow = 0;
|
|
||||||
volatile long buffer_colors_0_arrow = 0;
|
volatile long buffer_colors_0_arrow = 0;
|
||||||
|
volatile long buffer_lines_0_arrow = 0;
|
||||||
volatile long buffer_plans_0_arrow = 0;
|
volatile long buffer_plans_0_arrow = 0;
|
||||||
|
|
||||||
#define TEST 0
|
#define TEST 0
|
||||||
|
@ -649,23 +649,6 @@ static inline int erase_arrow (int arrows_nb, int arrow_address_in_list,
|
||||||
assert (arrows_nb);
|
assert (arrows_nb);
|
||||||
arrows_nb --;
|
arrows_nb --;
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
buffer_vertex_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_vertex()
|
|
||||||
buffer_colors_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_colors()
|
|
||||||
buffer_lines_size -= 2; // <<< l'inverse de ce qui est fait dans : graphics_write_line()
|
|
||||||
|
|
||||||
/* 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 (arrow_address_in_list < arrows_nb)
|
if (arrow_address_in_list < arrows_nb)
|
||||||
{
|
{
|
||||||
int mem = arrows_ptr[arrow_address_in_list].site;
|
int mem = arrows_ptr[arrow_address_in_list].site;
|
||||||
|
@ -685,10 +668,27 @@ static inline int erase_arrow (int arrows_nb, int arrow_address_in_list,
|
||||||
for (long i = 0 + arrow_address_in_list * 6; i < 6 + arrow_address_in_list * 6; i++)
|
for (long i = 0 + arrow_address_in_list * 6; i < 6 + arrow_address_in_list * 6; i++)
|
||||||
buffer_vertex_origin [buffer_vertex_0_arrow + i] = buffer_vertex_origin [buffer_vertex_size - 6 + i];
|
buffer_vertex_origin [buffer_vertex_0_arrow + i] = buffer_vertex_origin [buffer_vertex_size - 6 + i];
|
||||||
|
|
||||||
for (long i = 0; i < 6; i++)
|
for (long i = 0 + arrow_address_in_list * 6; i < 6 + arrow_address_in_list * 6; i++)
|
||||||
buffer_colors_origin [buffer_colors_0_arrow + i] = buffer_colors_origin [buffer_colors_size - 6 + i];
|
buffer_colors_origin [buffer_colors_0_arrow + i] = buffer_colors_origin [buffer_colors_size - 6 + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffer_vertex_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_vertex()
|
||||||
|
buffer_colors_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_colors()
|
||||||
|
buffer_lines_size -= 2; // <<< l'inverse de ce qui est fait dans : graphics_write_line()
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
/* 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 (1) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
if (1) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
||||||
|
|
||||||
return arrows_nb;
|
return arrows_nb;
|
||||||
|
@ -749,6 +749,7 @@ void main_test_graphics (void)
|
||||||
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);
|
||||||
|
|
||||||
buffer_vertex_0_arrow = buffer_vertex_size;
|
buffer_vertex_0_arrow = buffer_vertex_size;
|
||||||
|
buffer_colors_0_arrow = buffer_colors_size;
|
||||||
buffer_lines_0_arrow = buffer_lines_size;
|
buffer_lines_0_arrow = buffer_lines_size;
|
||||||
|
|
||||||
/* A R R O W S */
|
/* A R R O W S */
|
||||||
|
@ -776,7 +777,7 @@ void main_test_graphics (void)
|
||||||
rand() % space_Z, // z
|
rand() % space_Z, // z
|
||||||
console);
|
console);
|
||||||
else for (int i = 0; i < 1; i++)
|
else for (int i = 0; i < 1; i++)
|
||||||
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 0);
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 1);
|
||||||
|
|
||||||
if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0);
|
if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue