WIP: premières ébauches de flèches... ça fait plaisir; (on mettra de l'ordre demain...)
This commit is contained in:
parent
da89c4e963
commit
4cfa52b238
|
@ -171,10 +171,11 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
|
||||||
int weight, int site, int x, int y, int z)
|
int weight, int site, int x, int y, int z)
|
||||||
{
|
{
|
||||||
float nuance = 0.24f,
|
float nuance = 0.24f,
|
||||||
max = fmax(space_X, space_Y),
|
max = fmax(space_X, space_Y);
|
||||||
|
max = fmax(max, space_Z);
|
||||||
|
|
||||||
// arrow_basis_width donne la dimension de l'étoile centrale
|
// arrow_basis_width donne la dimension de l'étoile centrale
|
||||||
arrow_basis_width = 0.3f * (1 / max),
|
float arrow_basis_width = 0.3f * (1 / max),
|
||||||
|
|
||||||
// décale légèrement les pointes des flèches
|
// décale légèrement les pointes des flèches
|
||||||
// pour qu'elles n'aillent pas jusqu'aux faces des cubes
|
// pour qu'elles n'aillent pas jusqu'aux faces des cubes
|
||||||
|
@ -184,8 +185,6 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
|
||||||
vy = (2 * y / space_Y - 1) * space_Y / max + (1 / max),
|
vy = (2 * y / space_Y - 1) * space_Y / max + (1 / max),
|
||||||
vz = (2 * z / space_Z - 1) * space_Z / max + (1 / max);
|
vz = (2 * z / space_Z - 1) * space_Z / max + (1 / max);
|
||||||
|
|
||||||
max = fmax(max, space_Z);
|
|
||||||
|
|
||||||
// X - X axis - central star (basis)
|
// X - X axis - central star (basis)
|
||||||
graphics_write_vertex(vx + arrow_basis_width, vy, vz);
|
graphics_write_vertex(vx + arrow_basis_width, vy, vz);
|
||||||
graphics_write_vertex(vx - arrow_basis_width, vy, vz);
|
graphics_write_vertex(vx - arrow_basis_width, vy, vz);
|
||||||
|
@ -204,6 +203,18 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
|
||||||
graphics_write_color(0.3f, 0.3f, 0.3f);
|
graphics_write_color(0.3f, 0.3f, 0.3f);
|
||||||
graphics_write_color(0.3f, 0.3f, 0.3f);
|
graphics_write_color(0.3f, 0.3f, 0.3f);
|
||||||
|
|
||||||
|
offset_vertex += 6;
|
||||||
|
offset_colors += 6;
|
||||||
|
|
||||||
|
graphics_write_line (offset_vertex + 0, offset_vertex + 1);
|
||||||
|
graphics_write_line (offset_vertex + 2, offset_vertex + 3);
|
||||||
|
graphics_write_line (offset_vertex + 4, offset_vertex + 5);
|
||||||
|
|
||||||
|
offset_lines += 3; // inutile...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// X - X (EAST - WEST) axis - arrows tips (red - green)
|
// X - X (EAST - WEST) axis - arrows tips (red - green)
|
||||||
graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz);
|
graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz);
|
||||||
graphics_write_vertex (vx - (1 / max) + arrow_tip_padding, vy, vz);
|
graphics_write_vertex (vx - (1 / max) + arrow_tip_padding, vy, vz);
|
||||||
|
@ -222,13 +233,8 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
|
||||||
graphics_write_color(0.0f + nuance, 0.0f + nuance, 1.0f - nuance / 4);
|
graphics_write_color(0.0f + nuance, 0.0f + nuance, 1.0f - nuance / 4);
|
||||||
graphics_write_color(1.0f - nuance / 3, 1.0f - nuance / 3, 0.0f + nuance);
|
graphics_write_color(1.0f - nuance / 3, 1.0f - nuance / 3, 0.0f + nuance);
|
||||||
|
|
||||||
|
offset_vertex += 6;
|
||||||
|
offset_colors += 6;
|
||||||
graphics_write_line (offset_vertex + 0, offset_vertex + 1);
|
|
||||||
graphics_write_line (offset_vertex + 2, offset_vertex + 3);
|
|
||||||
graphics_write_line (offset_vertex + 4, offset_vertex + 5);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch(site){
|
switch(site){
|
||||||
case EAST: case WEST: write_arrow_lines_east_west (offset_vertex, weight, site); break;
|
case EAST: case WEST: write_arrow_lines_east_west (offset_vertex, weight, site); break;
|
||||||
|
@ -237,6 +243,7 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offset_lines += 4; // inutile...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ static void show_user_choices(struct arrow_t *arrows, int arrows_nb,
|
||||||
if (show_all && prefer == 0) printf("prefer = %d <> show all grids", prefer);
|
if (show_all && prefer == 0) printf("prefer = %d <> show all grids", prefer);
|
||||||
if (show_all && prefer == 1) printf("prefer = %d <> show no grid", prefer);
|
if (show_all && prefer == 1) printf("prefer = %d <> show no grid", prefer);
|
||||||
if (show_all && prefer > 1) printf("show grids according rule (%d)", prefer);
|
if (show_all && prefer > 1) printf("show grids according rule (%d)", prefer);
|
||||||
if (style) printf("design... 'trop stylé' !");
|
if (style) printf("orientations grilles alternées");
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
int pref_show_grids = 1; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
|
int pref_show_grids = 1; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
|
||||||
// xyz, 0, x, y, z, xy, xz, yz, xyz
|
// xyz, 0, x, y, z, xy, xz, yz, xyz
|
||||||
int weight = 0, site = 0, x = 0, y = 0, z = 0;// stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;
|
int weight = 0, site = 0, x = 0, y = 0, z = 0;// stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;
|
||||||
int style = 1;
|
int style = 0;
|
||||||
|
|
||||||
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style);
|
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style);
|
||||||
|
|
||||||
|
@ -909,10 +909,10 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
}
|
}
|
||||||
show_arrows_array (arrows, arrows_nb);
|
show_arrows_array (arrows, arrows_nb);
|
||||||
|
|
||||||
offset_vertex += 8 + (space_X + space_Y + space_Z - 6) * 4;
|
offset_vertex += (space_X + space_Y + space_Z - 3) * 4;
|
||||||
offset_colors += 8 + (space_X + space_Y + space_Z - 6) * 4;
|
offset_colors += (space_X + space_Y + space_Z - 3) * 4;
|
||||||
|
if (style) offset_lines += 2 * (space_X + space_Y + space_Z - 3);
|
||||||
if (style) offset_lines += space_X + space_Y + space_Z;
|
else offset_lines += 4 * (space_X + space_Y + space_Z - 3);
|
||||||
|
|
||||||
for (int i = 0; i < arrows_nb; i++) {
|
for (int i = 0; i < arrows_nb; i++) {
|
||||||
weight = arrows[i].load;
|
weight = arrows[i].load;
|
||||||
|
@ -921,9 +921,9 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
y = arrows[i].y;
|
y = arrows[i].y;
|
||||||
z = arrows[i].z;
|
z = arrows[i].z;
|
||||||
|
|
||||||
void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
|
write_one_arrow(offset_vertex, offset_colors, offset_lines,
|
||||||
int space_X, int space_Y, int space_Z,
|
space_X, space_Y, space_Z,
|
||||||
int weight, int site, int x, int y, int z);
|
weight, site, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(arrows);
|
free(arrows);
|
||||||
|
|
|
@ -78,17 +78,17 @@ void write_grids_on_space_faces (long offset_vertex, long offset_colors, long of
|
||||||
|
|
||||||
for (i = 0; i < x - 1; i ++) {
|
for (i = 0; i < x - 1; i ++) {
|
||||||
|
|
||||||
if (style != 1)
|
if (style)
|
||||||
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
if (style != 1)
|
if (style)
|
||||||
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset_vertex += (x - 1) * 4;
|
offset_vertex += (x - 1) * 4;
|
||||||
offset_colors += (x - 1) * 4;
|
offset_colors += (x - 1) * 4;
|
||||||
if (style != 1) offset_lines += 2; else offset_lines += (x - 1) * 4;
|
if (style) offset_lines += (x - 1) * 2; else offset_lines += (x - 1) * 4;
|
||||||
|
|
||||||
for (i = 1; i < y; i++) { // (y - 2) * 4
|
for (i = 1; i < y; i++) { // (y - 2) * 4
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ void write_grids_on_space_faces (long offset_vertex, long offset_colors, long of
|
||||||
|
|
||||||
for (i = 0; i < y - 1; i ++) {
|
for (i = 0; i < y - 1; i ++) {
|
||||||
|
|
||||||
if (style != 1)
|
if (style)
|
||||||
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
if (style != 1)
|
if (style)
|
||||||
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
|
@ -115,7 +115,7 @@ void write_grids_on_space_faces (long offset_vertex, long offset_colors, long of
|
||||||
|
|
||||||
offset_vertex += (y - 1) * 4;
|
offset_vertex += (y - 1) * 4;
|
||||||
offset_colors += (y - 1) * 4;
|
offset_colors += (y - 1) * 4;
|
||||||
if (style != 1) offset_lines += (x - 1) * 2; else offset_lines += (x - 1) * 4;
|
if (style) offset_lines += (y - 1) * 2; else offset_lines += (y - 1) * 4;
|
||||||
|
|
||||||
for (i = 1; i < z; i++) { // (z - 2) * 4
|
for (i = 1; i < z; i++) { // (z - 2) * 4
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ void write_grids_on_space_faces (long offset_vertex, long offset_colors, long of
|
||||||
for (i = 0; i < z - 1; i ++) {
|
for (i = 0; i < z - 1; i ++) {
|
||||||
|
|
||||||
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
if (style != 1)
|
if (style)
|
||||||
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
if (style != 1)
|
if (style)
|
||||||
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue