Compare commits
4 Commits
fc271cf2ef
...
ab5942d0bf
Author | SHA1 | Date |
---|---|---|
Jean Sirmai | ab5942d0bf | |
Jean Sirmai | 853856955d | |
Jean Sirmai | 6af1ece434 | |
Jean Sirmai | 8b7e7c0f28 |
|
@ -151,6 +151,8 @@ void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z)
|
|||
buffer_vertex_origin[buffer_vertex_size + 1] = y;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -675,14 +677,14 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
int rand(void);
|
||||
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
||||
|
||||
int arbitrary = 1000;
|
||||
int arbitrary = 300;
|
||||
int space_X = 1 + rand() % arbitrary,
|
||||
space_Y = 1 + rand() % arbitrary,
|
||||
space_Z = 1 + rand() % arbitrary;
|
||||
int density_max = space_X * space_Y * space_Z;
|
||||
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
||||
|
||||
int show_space_design = 0, print_arrows_data = 0;
|
||||
int show_space_design = 1, print_arrows_data = 1;
|
||||
|
||||
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
||||
int specif_arrows_nb = rand() % density_max / 3;
|
||||
|
@ -714,9 +716,16 @@ 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_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_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 */
|
||||
|
||||
for (int i = 0; i < arrows_nb; i++) {
|
||||
|
@ -732,6 +741,8 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
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_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.2f, 0.1f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||
|
||||
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 ( 2, 6); graphics_write_line ( 3, 6);
|
||||
|
||||
return 8;
|
||||
return 12;
|
||||
}
|
||||
|
||||
long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style)
|
||||
long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int design)
|
||||
{
|
||||
float i, max = fmax(x, y); max = fmax(max, z);
|
||||
|
||||
for (i = 1; i < x; i++) { // (x - 2) * 4
|
||||
for (i = 0; i < x; i++) {
|
||||
|
||||
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_colors += (x - 1) * 4;
|
||||
|
||||
for (i = 1; i < y; i++) { // (y - 2) * 4
|
||||
for (i = 1; i < y; i++) {
|
||||
|
||||
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_colors += (y - 1) * 4;
|
||||
|
||||
for (i = 1; i < z; i++) { // (z - 2) * 4
|
||||
for (i = 1; i < z; i++) {
|
||||
|
||||
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,54 +114,52 @@ long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors,
|
|||
graphics_write_color (0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
return (x + y + z - 3) * 4;
|
||||
return (x + y + z - 3) * 3;
|
||||
}
|
||||
|
||||
|
||||
long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style)
|
||||
long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int design)
|
||||
{
|
||||
float i, max = fmax(x, y); max = fmax(max, z);
|
||||
|
||||
design = 0;
|
||||
|
||||
for (i = 0; i < x - 1; i ++) {
|
||||
|
||||
if (style)
|
||||
if (design)
|
||||
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 + 2, offset_vertex + i * 4 + 3);
|
||||
if (style)
|
||||
if (design)
|
||||
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||
}
|
||||
|
||||
/* if (style) offset_lines += (x - 1) * 2; else offset_lines += (x - 1) * 4; */
|
||||
if (design) offset_vertex += (x - 1) * 2; else offset_vertex += (x - 1) * 4;
|
||||
|
||||
for (i = 0; i < y - 1; i ++) {
|
||||
|
||||
if (style)
|
||||
if (design)
|
||||
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||
if (style)
|
||||
if (design)
|
||||
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 + 3, offset_vertex + i * 4 + 0);
|
||||
}
|
||||
|
||||
/* if (style) offset_lines += (y - 1) * 2; else offset_lines += (y - 1) * 4; */
|
||||
if (design) offset_vertex += (y - 1) * 2; else offset_vertex += (y - 1) * 4;
|
||||
|
||||
for (i = 0; i < z - 1; i ++) {
|
||||
|
||||
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||
if (style)
|
||||
if (design)
|
||||
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||
if (style)
|
||||
if (design)
|
||||
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);
|
||||
}
|
||||
|
||||
printf("write_grids_on_space_faces_lines\n");
|
||||
|
||||
return (x + y + z - 3) * 4;
|
||||
/* if (style) offset_lines += 2 * (space_X + space_Y + space_Z - 3); */
|
||||
/* if (design) offset_lines += 2 * (space_X + space_Y + space_Z - 3); */
|
||||
/* else offset_lines += 4 * (space_X + space_Y + space_Z - 3); */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue