WIP: avant de reprendre entièrement cette fonction: vx = (2 * i / x - 1) * x / max + (1 / max);

This commit is contained in:
Jean Sirmai 2023-10-15 23:19:52 +02:00
parent 1a074fb0c9
commit 35bd253b3d
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 30 additions and 18 deletions

View File

@ -173,14 +173,14 @@ static void show_one_arrow_data_1(int offset_vertex, int offset_colors,
offset_vertex, offset_colors, weight, site, x, y, z); offset_vertex, offset_colors, weight, site, x, y, z);
} }
static void show_one_arrow_data_2(int offset_vertex, float max, int uxi, int uyi, int uzi, static void show_one_arrow_data_2(int offset_vertex, int max, int uxi, int uyi, int uzi,
float ux, float uy, float uz, float vx, float vy, float vz) int ux, int uy, int uz, float vx, float vy, float vz)
{ {
printf("offset_vertex = %d max = %8.5f\n\ printf("offset_vertex = %d (x3 = %d) max = %d\n\
xi = %6d yi = %6d zi = %6d\n\ xi = %d yi = %d zi = %d\n\
ux = %8.5f uy = %8.5f uz = %8.5f\n\ ux = %d uy = %d uz = %d\n\
vx = %8.5f vy = %8.5f vz = %8.5f\n",\ vx = %6.3f vy = %6.3f vz = %6.3f\n",\
offset_vertex, max, ux, uy, uz, vx, vy, vz); offset_vertex, offset_vertex * 3, max, ux, uy, uz, vx, vy, vz);
} }
@ -200,17 +200,17 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
uyi = (2 * y) / space_Y_int, uyi = (2 * y) / space_Y_int,
uzi = (2 * z) / space_Z_int; uzi = (2 * z) / space_Z_int;
float ux = uxi, uy = uyi, uz = uzi; int ux = uxi, uy = uyi, uz = uzi;
float vx = (ux - 1.0f) * (space_X / max) + (1.0f / max), float vx = (ux - 1) * (space_X / max) + (1.0f / max),
vy = (uy - 1.0f) * (space_Y / max) + (1.0f / max), vy = (uy - 1) * (space_Y / max) + (1.0f / max),
vz = (uz - 1.0f) * (space_Z / max) + (1.0f / max); vz = (uz - 1) * (space_Z / max) + (1.0f / max);
show_one_arrow_data_2 (offset_vertex, max, show_one_arrow_data_2 (offset_vertex, max,
uxi, uyi, uzi, ux, uy, uz, vx, vy, vz); uxi, uyi, uzi, ux, uy, uz, vx, vy, vz);
// arrow_basis_width donne la dimension de l'étoile centrale // arrow_basis_width donne la dimension de l'étoile centrale
float arrow_basis_width = 0.3f * (1 / max), GLfloat arrow_basis_width = 0.3f * (1 / max),
// décale légèrement les pointes des flèches // décale légèrement les pointes des flèches
// pour qu'elles n'aillent pas jusqu'aux faces des cubes // pour qu'elles n'aillent pas jusqu'aux faces des cubes
@ -245,7 +245,7 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines,
float nuance = 0.24f; GLfloat nuance = 0.24f;
// X - X (EAST - WEST) axis - arrows tips (red - green) // X - X (EAST - WEST) axis - arrows tips (red - green)
graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz); graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz);

View File

@ -153,7 +153,7 @@ void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z)
buffer_vertex_size += 3; buffer_vertex_size += 3;
//printf("Created vertex (%f,%f,%f), size is %d\n", x,y,z, buffer_vertex_size); printf("new vertex : (%9.6f, %9.6f, %9.6f) <> buffer size : %3d\n", x,y,z, buffer_vertex_size);
} }
/* /*
@ -891,11 +891,12 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style); show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style);
long offset_vertex = 0, offset_colors = 0, offset_lines = 0; // if this function is called first int offset_vertex = 0, offset_colors = 0, offset_lines = 0; // if this function is called first
write_space_ridges (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z); 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 offset_vertex = 8, offset_colors = 8, offset_lines = 12; // if space edges are drawn
write_grids_on_space_faces (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 */ /* ARROWS */
@ -926,6 +927,8 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
weight, site, x, y, z); weight, site, x, y, z);
} }
show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 0, 0, style);
free(arrows); free(arrows);
arrows = NULL; arrows = NULL;
arrows_nb = 0; arrows_nb = 0;

View File

@ -19,16 +19,25 @@
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* aint with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../../include/base.h" #include "../../include/base.h"
#include "../../include/graphics.h" #include "../../include/graphics.h"
/* void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z) { */
/* buffer_vertex_origin = g_realloc (buffer_vertex_origin, (buffer_vertex_size + 3) * sizeof(GLfloat)); */
/* buffer_vertex_origin[buffer_vertex_size + 0] = x; */
/* buffer_vertex_origin[buffer_vertex_size + 1] = y; */
/* buffer_vertex_origin[buffer_vertex_size + 2] = z; */
/* buffer_vertex_size += 3; */
/* //printf("Created vertex (%f,%f,%f), size is %d\n", x,y,z, buffer_vertex_size); */
/* } */
void write_space_ridges (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z) void write_space_ridges (long offset_vertex, long offset_colors, long offset_lines, long x, long y, long z)
{ {
float max = fmax(x, y); max = fmax(max, z); float max = fmax(x, y); max = fmax(max, z);
graphics_write_vertex (offset_vertex - x / max, offset_vertex - y / max, - z / max); graphics_write_vertex (offset_vertex - x / max, offset_vertex - y / max, - z / max);
graphics_write_vertex (offset_vertex + x / max, offset_vertex - y / max, - z / max); graphics_write_vertex (offset_vertex + x / max, offset_vertex - y / max, - z / max);