OK VERTEX D'ABORD, LIGNES ENSUITE
This commit is contained in:
parent
853856955d
commit
ab5942d0bf
|
@ -151,7 +151,7 @@ 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;
|
||||||
|
|
||||||
printf("buffer_vertex_size = %d (%6.3f,%6.3f,%6.3f)\n", buffer_vertex_size, x, y, 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,17 +677,17 @@ 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 = 30;
|
int arbitrary = 300;
|
||||||
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 = 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 load = 0, site = 0, x = 0, y = 0, z = 0;
|
||||||
int specif_arrows_nb = 0;//rand() % density_max / 3;
|
int specif_arrows_nb = rand() % density_max / 3;
|
||||||
int arrows_nb = 0;
|
int arrows_nb = 0;
|
||||||
|
|
||||||
while (arrows_nb < specif_arrows_nb){
|
while (arrows_nb < specif_arrows_nb){
|
||||||
|
@ -716,13 +716,13 @@ 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;
|
||||||
|
|
||||||
printf("offset_vertex after writing_space_ridges_vertex : %d (x 3 = %d)\n\n", offset_vertex, offset_vertex * 3);
|
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;
|
||||||
|
|
||||||
printf("offset_vertex after writing_space_faces_vertex = %2d - 8 = %d (x 3 = %d)\n", offset_vertex, offset_vertex - 8, (offset_vertex - 8) * 3);
|
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);
|
||||||
printf("(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4 = %2d (x 3 = %d)\n\n",\
|
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);
|
(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);
|
||||||
|
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("offset_vertex after writing_arrows_vertex : %d (x 3 = %d) (arrows_nb = %d)\n", offset_vertex, offset_vertex * 3, arrows_nb);
|
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.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);
|
graphics_write_color (0.9f, 0.7f, 0.4f);
|
||||||
|
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ long write_grids_on_space_faces_vertex (long offset_vertex, long offset_colors,
|
||||||
{
|
{
|
||||||
float i, max = fmax(x, y); max = fmax(max, z);
|
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);
|
||||||
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++) { // (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);
|
||||||
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++) { // (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);
|
||||||
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,7 +114,7 @@ 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) * 4;
|
return (x + y + z - 3) * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, l
|
||||||
{
|
{
|
||||||
float i, max = fmax(x, y); max = fmax(max, z);
|
float i, max = fmax(x, y); max = fmax(max, z);
|
||||||
|
|
||||||
design = 1;
|
design = 0;
|
||||||
|
|
||||||
for (i = 0; i < x - 1; i ++) {
|
for (i = 0; i < x - 1; i ++) {
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, l
|
||||||
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_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 ++) {
|
for (i = 0; i < y - 1; i ++) {
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, l
|
||||||
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_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 ++) {
|
for (i = 0; i < z - 1; i ++) {
|
||||||
|
|
||||||
|
@ -161,7 +161,5 @@ long write_grids_on_space_faces_lines (long offset_vertex, long offset_colors, l
|
||||||
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 (design) 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