Compare commits
No commits in common. "ab5942d0bfa643a90e352f292e7b555290aee400" and "fc271cf2efe9bb488a925eebe78c725c036b3ef0" have entirely different histories.
ab5942d0bf
...
fc271cf2ef
|
@ -151,8 +151,6 @@ void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z)
|
||||||
buffer_vertex_origin[buffer_vertex_size + 1] = y;
|
buffer_vertex_origin[buffer_vertex_size + 1] = y;
|
||||||
buffer_vertex_origin[buffer_vertex_size + 2] = z;
|
buffer_vertex_origin[buffer_vertex_size + 2] = z;
|
||||||
|
|
||||||
if (0) printf("buffer_vertex_size = %d (%6.3f,%6.3f,%6.3f)\n", buffer_vertex_size, x, y, z);
|
|
||||||
|
|
||||||
buffer_vertex_size += 3;
|
buffer_vertex_size += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,14 +675,14 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
int rand(void);
|
int rand(void);
|
||||||
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
||||||
|
|
||||||
int arbitrary = 300;
|
int arbitrary = 1000;
|
||||||
int space_X = 1 + rand() % arbitrary,
|
int space_X = 1 + rand() % arbitrary,
|
||||||
space_Y = 1 + rand() % arbitrary,
|
space_Y = 1 + rand() % arbitrary,
|
||||||
space_Z = 1 + rand() % arbitrary;
|
space_Z = 1 + rand() % arbitrary;
|
||||||
int density_max = space_X * space_Y * space_Z;
|
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 show_space_design = 1, print_arrows_data = 1;
|
int show_space_design = 0, print_arrows_data = 0;
|
||||||
|
|
||||||
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
||||||
int specif_arrows_nb = rand() % density_max / 3;
|
int specif_arrows_nb = rand() % density_max / 3;
|
||||||
|
@ -716,16 +714,9 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
offset_vertex += write_space_ridges_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z);
|
offset_vertex += write_space_ridges_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z);
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
|
|
||||||
if (0) printf("offset_vertex after writing_space_ridges_vertex : %d (x 3 = %d)\n\n", offset_vertex, offset_vertex * 3);
|
|
||||||
|
|
||||||
offset_vertex += write_grids_on_space_faces_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, show_space_design);
|
offset_vertex += write_grids_on_space_faces_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, show_space_design);
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
|
|
||||||
if (0) printf("offset_vertex after writing_space_faces_vertex = %4d - 8 = %3d (x 3 = %4d)\n", offset_vertex, offset_vertex - 8, (offset_vertex - 8) * 3);
|
|
||||||
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 */
|
/* A R R O W S */
|
||||||
|
|
||||||
for (int i = 0; i < arrows_nb; i++) {
|
for (int i = 0; i < arrows_nb; i++) {
|
||||||
|
@ -741,8 +732,6 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) printf("offset_vertex after writing_arrows_vertex : %d (x 3 = %d) (arrows_nb = %d)\n", offset_vertex, offset_vertex * 3, arrows_nb);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------*/
|
/*---------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,14 @@ int write_space_ridges_vertex (long offset_vertex, long offset_colors, long offs
|
||||||
|
|
||||||
graphics_write_vertex (offset_vertex + x / max, + y / max, + z / max);
|
graphics_write_vertex (offset_vertex + x / max, + y / max, + z / max);
|
||||||
|
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||||
|
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
@ -62,14 +62,14 @@ int write_space_ridges_lines (long offset_vertex, long offset_colors, long offse
|
||||||
graphics_write_line ( 1, 5); graphics_write_line ( 3, 5);
|
graphics_write_line ( 1, 5); graphics_write_line ( 3, 5);
|
||||||
graphics_write_line ( 2, 6); graphics_write_line ( 3, 6);
|
graphics_write_line ( 2, 6); graphics_write_line ( 3, 6);
|
||||||
|
|
||||||
return 12;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int design)
|
long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style)
|
||||||
{
|
{
|
||||||
float i, max = fmax(x, y); max = fmax(max, z);
|
float i, max = fmax(x, y); max = fmax(max, z);
|
||||||
|
|
||||||
for (i = 0; i < x; i++) {
|
for (i = 1; i < x; i++) { // (x - 2) * 4
|
||||||
|
|
||||||
graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, - z / max);
|
graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, - z / max);
|
||||||
graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, z / max);
|
graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, z / max);
|
||||||
|
@ -85,7 +85,7 @@ long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors,
|
||||||
offset_vertex += (x - 1) * 4;
|
offset_vertex += (x - 1) * 4;
|
||||||
offset_colors += (x - 1) * 4;
|
offset_colors += (x - 1) * 4;
|
||||||
|
|
||||||
for (i = 1; i < y; i++) {
|
for (i = 1; i < y; i++) { // (y - 2) * 4
|
||||||
|
|
||||||
graphics_write_vertex (- x / max, (2 * i / y - 1) * y / max, - z / max);
|
graphics_write_vertex (- x / max, (2 * i / y - 1) * y / max, - z / max);
|
||||||
graphics_write_vertex (- x / max, (2 * i / y - 1) * y / max, z / max);
|
graphics_write_vertex (- x / max, (2 * i / y - 1) * y / max, z / max);
|
||||||
|
@ -101,7 +101,7 @@ long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors,
|
||||||
offset_vertex += (y - 1) * 4;
|
offset_vertex += (y - 1) * 4;
|
||||||
offset_colors += (y - 1) * 4;
|
offset_colors += (y - 1) * 4;
|
||||||
|
|
||||||
for (i = 1; i < z; i++) {
|
for (i = 1; i < z; i++) { // (z - 2) * 4
|
||||||
|
|
||||||
graphics_write_vertex (- x / max, - y / max, (2 * i / z - 1) * z / max);
|
graphics_write_vertex (- x / max, - y / max, (2 * i / z - 1) * z / max);
|
||||||
graphics_write_vertex (- x / max, y / max, (2 * i / z - 1) * z / max);
|
graphics_write_vertex (- x / max, y / max, (2 * i / z - 1) * z / max);
|
||||||
|
@ -114,52 +114,54 @@ long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors,
|
||||||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (x + y + z - 3) * 3;
|
return (x + y + z - 3) * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int design)
|
long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style)
|
||||||
{
|
{
|
||||||
float i, max = fmax(x, y); max = fmax(max, z);
|
float i, max = fmax(x, y); max = fmax(max, z);
|
||||||
|
|
||||||
design = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < x - 1; i ++) {
|
for (i = 0; i < x - 1; i ++) {
|
||||||
|
|
||||||
if (design)
|
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 (design)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (design) offset_vertex += (x - 1) * 2; else offset_vertex += (x - 1) * 4;
|
/* if (style) offset_lines += (x - 1) * 2; else offset_lines += (x - 1) * 4; */
|
||||||
|
|
||||||
for (i = 0; i < y - 1; i ++) {
|
for (i = 0; i < y - 1; i ++) {
|
||||||
|
|
||||||
if (design)
|
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 (design)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (design) offset_vertex += (y - 1) * 2; else offset_vertex += (y - 1) * 4;
|
/* if (style) offset_lines += (y - 1) * 2; else offset_lines += (y - 1) * 4; */
|
||||||
|
|
||||||
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 (design)
|
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 (design)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("write_grids_on_space_faces_lines\n");
|
||||||
|
|
||||||
return (x + y + z - 3) * 4;
|
return (x + y + z - 3) * 4;
|
||||||
/* if (design) offset_lines += 2 * (space_X + space_Y + space_Z - 3); */
|
/* if (style) offset_lines += 2 * (space_X + space_Y + space_Z - 3); */
|
||||||
/* else offset_lines += 4 * (space_X + space_Y + space_Z - 3); */
|
/* else offset_lines += 4 * (space_X + space_Y + space_Z - 3); */
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue