Compare commits

...

3 Commits

2 changed files with 43 additions and 14 deletions

View File

@ -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, 1.0f, 0.0f); graphics_write_color(0.0f, 0.9f, 0.0f);
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.2f, 0.2f); graphics_write_color(0.7f, 0.3f, 0.9f);
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.3f, 0.1f, 0.6f); graphics_write_color(0.0f, 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

@ -182,7 +182,7 @@ void graphics_write_line (GLuint a, GLuint b, int print)
buffer_lines_origin[buffer_lines_size + 0] = a; buffer_lines_origin[buffer_lines_size + 0] = a;
buffer_lines_origin[buffer_lines_size + 1] = b; buffer_lines_origin[buffer_lines_size + 1] = b;
if (print) printf("In graphics_write_line() buffer_lines_size => [%2d] [%2d > %2d] (%3u > %3u ) (= buffer_vertex_size / 3 - 2 > -1)\n",\ if (print) printf("In graphics_write_line() buffer_lines_size => [%2d] [%2d > %2d] (%3u > %3u )\n\n",\
buffer_lines_size / 2, buffer_lines_size + 0, buffer_lines_size + 1, a, b); buffer_lines_size / 2, buffer_lines_size + 0, buffer_lines_size + 1, a, b);
buffer_lines_size += 2; buffer_lines_size += 2;
@ -562,7 +562,7 @@ static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x,
{ {
arrows_ptr[address].load = load; arrows_ptr[address].load = load;
print_arrows_array (arrows_ptr, arrows_nb, 2); if (0) print_arrows_array (arrows_ptr, arrows_nb, 2);
return arrows_nb; return arrows_nb;
} }
@ -597,7 +597,7 @@ static inline int create_arrow (int arrows_nb,
arrows_nb ++; arrows_nb ++;
if (1) print_arrows_array (arrows_ptr, arrows_nb, 1); if (0) print_arrows_array (arrows_ptr, arrows_nb, 1);
return arrows_nb; return arrows_nb;
} }
@ -646,7 +646,7 @@ static inline int erase_arrow (int arrows_nb, int address, int site, int x, int
} }
printf(" >> bf_vrtx = %d bf_ln = %d\n", (buffer_vertex_size - 6) / 3, (buffer_lines_size - 4) / 2); printf(" >> bf_vrtx = %d bf_ln = %d\n", (buffer_vertex_size - 6) / 3, (buffer_lines_size - 4) / 2);
print_arrows_array (arrows_ptr, arrows_nb,0); if (0) print_arrows_array (arrows_ptr, arrows_nb, 0);
return arrows_nb; return arrows_nb;
} }
@ -905,17 +905,19 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
int address = 0; int address = 0;
if (1) printf("buffer_lines_0_arrow = %d address = %d buffer_lines_size = %d >>>", buffer_lines_0_arrow, address, buffer_lines_size); if (1) printf("buffer_lines_0_arrow = %d address = %d buffer_lines_size = %d >>>",\
/* buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 0] = buffer_lines_origin[(long) buffer_lines_size - 2]; */ buffer_lines_0_arrow, address, buffer_lines_size);
/* 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; */ 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 experience, can't re_allocate for arrow lines buffer.\n"); else perror("In experience, can't re_allocate for arrows lines buffer.\n");
if (1) printf(">>> buffer_lines_size = %d\n", buffer_lines_size); if (1) printf(">>> buffer_lines_size = %d\n", buffer_lines_size);
if (1) printf("buffer_vertex_0_arrow = %d address = %d buffer_vertex_size = %d >>>", buffer_vertex_0_arrow, address, buffer_vertex_size); 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 + 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 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5];
@ -928,11 +930,39 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat)); 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; if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr;
else perror("In experience, can't re_allocate for arrow vertex buffer.\n"); else perror("In experience, can't re_allocate for arrows vertex buffer.\n");
if (1) printf(">>> buffer_vertex_size = %d\n", buffer_vertex_size); if (1) printf(">>> buffer_vertex_size = %d\n", buffer_vertex_size);
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++) {
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++) {
if (a % 6 == 0) printf("\n");
if (a % 3 == 0) printf("\n");
printf("%5.2f ", buffer_vertex_origin [a]);
}
printf("\n");
/* 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, */
/* 0,//rand() % arbitrary + 1, // load / weight */ /* 0,//rand() % arbitrary + 1, // load / weight */
/* 0,//rand() % 6, // site, */ /* 0,//rand() % 6, // site, */
@ -1017,4 +1047,3 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
arrows_ptr = NULL; arrows_ptr = NULL;
arrows_nb = 0; arrows_nb = 0;
} }