WIP: Suffisament propre pour mériter un commit.
This commit is contained in:
parent
36ecfb7041
commit
f223dd4433
|
@ -872,7 +872,7 @@ 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 = 13;
|
||||
int arbitrary = 20;
|
||||
int space_X = 1 + rand() % arbitrary,
|
||||
space_Y = 1 + rand() % arbitrary,
|
||||
space_Z = 1 + rand() % arbitrary;
|
||||
|
|
|
@ -52,29 +52,57 @@ void write_space_ridges (long offset_vertex, long offset_lines, long x, long y,
|
|||
|
||||
void write_space_faces_grids (long offset_vertex, long offset_lines, long x, long y, long z)
|
||||
{
|
||||
float i, j, k, vx, vy, vz, max = fmax(x, y);
|
||||
max = fmax(max, z);
|
||||
float i, max = fmax(x, y); max = fmax(max, z);
|
||||
|
||||
for (i = 1; i < x; i++) {
|
||||
|
||||
vx = (2 * i / x - 1) * x / max; vy = - y / max; vz = - z / max;
|
||||
graphics_write_vertex (vx, vy, vz);
|
||||
|
||||
vx = (2 * i / x - 1) * x / max; vy = - y / max; vz = + z / max;
|
||||
graphics_write_vertex (vx, vy, vz);
|
||||
|
||||
vx = (2 * i / x - 1) * x / max; vy = + y / max; vz = + z / max;
|
||||
graphics_write_vertex (vx, vy, vz);
|
||||
|
||||
vx = (2 * i / x - 1) * x / max; vy = + y / max; vz = - z / max;
|
||||
graphics_write_vertex (vx, vy, vz);
|
||||
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);
|
||||
}
|
||||
|
||||
for (i = 0; i < x; i ++) {
|
||||
/* for (i = 0; i < x; i ++) { */
|
||||
|
||||
/* 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); */
|
||||
/* graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0); */
|
||||
/* } */
|
||||
|
||||
offset_vertex += (x - 1) * 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);
|
||||
}
|
||||
|
||||
for (i = 0; i < y - 1; i ++) {
|
||||
|
||||
/* 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);
|
||||
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||
}
|
||||
|
||||
offset_vertex += (y - 1) * 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);
|
||||
}
|
||||
|
||||
for (i = 0; i <= z; i ++) {
|
||||
|
||||
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);
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue