WIP: E R R O R F I X E D (start cleaning)
This commit is contained in:
parent
a6ea913337
commit
9d859b0469
|
@ -81,7 +81,7 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int,
|
|||
default: break;
|
||||
}
|
||||
|
||||
return 2;
|
||||
return 2*3;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,20 +37,20 @@
|
|||
|
||||
static struct arrow_t *arrows_ptr; /* nom modifié pour pouvoir plus facilement distinguer le tableau
|
||||
* des autres noms incluant "arrows" (de arrows_nb, par ex.) */
|
||||
static GLfloat *buffer_vertex_origin = NULL;
|
||||
static GLfloat *buffer_colors_origin = NULL;
|
||||
static GLuint *buffer_lines_origin = NULL;
|
||||
static GLuint *buffer_plans_origin = NULL;
|
||||
GLfloat *buffer_vertex_origin = NULL;
|
||||
GLfloat *buffer_colors_origin = NULL;
|
||||
GLuint *buffer_lines_origin = NULL;
|
||||
GLuint *buffer_plans_origin = NULL;
|
||||
|
||||
static volatile int buffer_vertex_size = 0;
|
||||
static volatile int buffer_lines_size = 0;
|
||||
static volatile int buffer_colors_size = 0;
|
||||
static volatile int buffer_plans_size = 0;
|
||||
volatile int buffer_vertex_size = 0;
|
||||
volatile int buffer_lines_size = 0;
|
||||
volatile int buffer_colors_size = 0;
|
||||
volatile int buffer_plans_size = 0;
|
||||
|
||||
static volatile int buffer_vertex_0_arrow = 0;
|
||||
static volatile int buffer_lines_0_arrow = 0;
|
||||
static volatile int buffer_colors_0_arrow = 0;
|
||||
static volatile int buffer_plans_0_arrow = 0;
|
||||
volatile int buffer_vertex_0_arrow = 0;
|
||||
volatile int buffer_lines_0_arrow = 0;
|
||||
volatile int buffer_colors_0_arrow = 0;
|
||||
volatile int buffer_plans_0_arrow = 0;
|
||||
|
||||
#define TEST 0
|
||||
|
||||
|
@ -842,7 +842,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
* 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;
|
||||
buffer_vertex_0_arrow = buffer_vertex_size; // Attention, à ce stade, pas de vertex redondant
|
||||
buffer_lines_0_arrow = buffer_lines_size;
|
||||
if (1) 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);
|
||||
|
@ -903,12 +903,12 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
0,//rand() % space_Y, // y
|
||||
0);//rand() % space_Z); // z
|
||||
|
||||
int address = 0;
|
||||
int address = 2;
|
||||
|
||||
if (1) 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_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;
|
||||
|
||||
|
@ -918,15 +918,24 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
if (1) 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 (1) 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 + 2] = buffer_git 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_vertex_0_arrow + address * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6];
|
||||
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5];
|
||||
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4];
|
||||
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3];
|
||||
buffer_colors_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2];
|
||||
buffer_colors_origin [(long) buffer_vertex_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;
|
||||
|
@ -941,18 +950,17 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
|
||||
printf("buffer_lines_0_arrow = %d\n", buffer_lines_0_arrow);
|
||||
|
||||
for (long h = buffer_lines_0_arrow - 6; h < buffer_lines_size + 6; h++) {
|
||||
for (long h = buffer_lines_0_arrow; h < buffer_lines_size; h++) {
|
||||
if (h == buffer_lines_0_arrow) printf("\n");
|
||||
if (h == buffer_lines_0_arrow + 6) printf("\n");
|
||||
if (h % 2 == 0) printf("\n");
|
||||
printf("%2d ", buffer_lines_origin [h]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
for (long a = buffer_vertex_0_arrow - 3; a < buffer_vertex_size; a++) {
|
||||
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("%5.2f ", buffer_vertex_origin [a]);
|
||||
printf("[%d] %5.2f ", a/3, buffer_vertex_origin [a]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
|
|
Loading…
Reference in New Issue