Grilles d'orientation différente sur les faces parallèles : plus lisible.

This commit is contained in:
Jean Sirmai 2023-10-12 21:58:09 +02:00
parent d1ff06f217
commit da89c4e963
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 21 additions and 17 deletions

View File

@ -29,7 +29,7 @@
void write_space_ridges (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z);
void write_space_faces_grids (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style);
void write_grids_on_space_faces (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style);
/*
* Writes grid lines intersections to vertex and color buffers

View File

@ -895,7 +895,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
write_space_ridges (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z);
offset_vertex = 8, offset_colors = 8, offset_lines = 12; // if space edges are drawn
write_space_faces_grids (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, style);
write_grids_on_space_faces (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, style);
/* ARROWS */

View File

@ -59,11 +59,11 @@ void write_space_ridges (long offset_vertex, long offset_colors, long offset_lin
graphics_write_line ( 2, 6); graphics_write_line ( 3, 6);
}
void write_space_faces_grids (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z, int style)
void write_grids_on_space_faces (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);
if (style != 1) for (i = 1; i < x; i++) { // (x - 2) * 4
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);
@ -76,17 +76,19 @@ void write_space_faces_grids (long offset_vertex, long offset_colors, long offse
graphics_write_color (0.5f, 0.5f, 0.5f);
}
if (style != 1) for (i = 0; i < x; i ++) {
for (i = 0; i < x - 1; i ++) {
graphics_write_line (offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
if (style != 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 + 2, offset_vertex + i * 4 + 3);
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
if (style != 1)
graphics_write_line (offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
}
if (style != 1) offset_vertex += (x - 1) * 4;
if (style != 1) offset_colors += (x - 1) * 4;
if (style != 1) offset_lines += 0; else offset_lines += (x - 1) * 4;
offset_vertex += (x - 1) * 4;
offset_colors += (x - 1) * 4;
if (style != 1) offset_lines += 2; else offset_lines += (x - 1) * 4;
for (i = 1; i < y; i++) { // (y - 2) * 4
@ -104,15 +106,16 @@ void write_space_faces_grids (long offset_vertex, long offset_colors, long offse
for (i = 0; i < y - 1; i ++) {
if (style != 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 + 0, offset_vertex + i * 4 + 1);
if (style != 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;
offset_colors += (y - 1) * 4;
if (style != 1) offset_lines += (x - 1) * 3; else offset_lines += (x - 1) * 4;
if (style != 1) offset_lines += (x - 1) * 2; else offset_lines += (x - 1) * 4;
for (i = 1; i < z; i++) { // (z - 2) * 4
@ -127,12 +130,13 @@ void write_space_faces_grids (long offset_vertex, long offset_colors, long offse
graphics_write_color (0.5f, 0.5f, 0.5f);
}
for (i = 0; i <= z; 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 + 1, offset_vertex + i * 4 + 2);
if (! style)
graphics_write_line (offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
if (style != 1)
graphics_write_line (offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
if (style != 1)
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);
}
}