WIP: premiers dimères facilement dessinés (is OK)
This commit is contained in:
parent
068e2a269e
commit
0274bd68fc
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
Binary file not shown.
After Width: | Height: | Size: 929 B |
|
@ -623,17 +623,17 @@ static bool grids_intersections (long x, long y, long z,
|
||||||
static bool arrows_anchors (long x, long y, long z,
|
static bool arrows_anchors (long x, long y, long z,
|
||||||
GLfloat *vertex_origin, GLfloat *colors_origin)
|
GLfloat *vertex_origin, GLfloat *colors_origin)
|
||||||
{
|
{
|
||||||
|
// beaucoup de ^c ^v ici (peu d'info) (mais un peu)
|
||||||
|
|
||||||
float i, j, k, vx, vy, vz,
|
float i, j, k, vx, vy, vz,
|
||||||
|
max = fmax(x, y),
|
||||||
ad = 1 / max,
|
ad = 1 / max,
|
||||||
eps = 0.3f * ad, // eps(ilon) donne la dimension de l'étoile centrale
|
a_third = 0.3f * ad, // a_third donne la dimension de l'étoile centrale
|
||||||
mic = 0.1 * ad, // mic servira à décaler légèrement les pointes des flèches
|
eps = 0.1 * ad; // eps(ilon) servira à décaler 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
|
||||||
// TODO ! (les centres des six faces)
|
|
||||||
max = fmax(x, y);
|
|
||||||
max = fmax(max, z);
|
max = fmax(max, z);
|
||||||
|
|
||||||
printf("arrows_anchors 1 / max = %5.2f max / 2 = %5.2f\n", ad, max / 2);
|
if (0) printf("arrows_anchors 1 / max = %5.2f max / 2 = %5.2f\n", ad, max / 2);
|
||||||
|
|
||||||
for (i = 0; i < x; i++)
|
for (i = 0; i < x; i++)
|
||||||
for (j = 0; j < y; j++)
|
for (j = 0; j < y; j++)
|
||||||
|
@ -645,13 +645,13 @@ static bool arrows_anchors (long x, long y, long z,
|
||||||
|
|
||||||
// X - X axis Central Star
|
// X - X axis Central Star
|
||||||
|
|
||||||
*(vertex_origin + vertex_index + 0) = vx + eps;
|
*(vertex_origin + vertex_index + 0) = vx + a_third;
|
||||||
*(vertex_origin + vertex_index + 1) = vy;
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
*(vertex_origin + vertex_index + 2) = vz;
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
vertex_index += 3;
|
vertex_index += 3;
|
||||||
|
|
||||||
*(vertex_origin + vertex_index + 0) = vx - eps;
|
*(vertex_origin + vertex_index + 0) = vx - a_third;
|
||||||
*(vertex_origin + vertex_index + 1) = vy;
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
*(vertex_origin + vertex_index + 2) = vz;
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
|
@ -673,13 +673,13 @@ static bool arrows_anchors (long x, long y, long z,
|
||||||
// Y - Y axis Central Star
|
// Y - Y axis Central Star
|
||||||
|
|
||||||
*(vertex_origin + vertex_index + 0) = vx;
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
*(vertex_origin + vertex_index + 1) = vy + eps;
|
*(vertex_origin + vertex_index + 1) = vy + a_third;
|
||||||
*(vertex_origin + vertex_index + 2) = vz;
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
vertex_index += 3;
|
vertex_index += 3;
|
||||||
|
|
||||||
*(vertex_origin + vertex_index + 0) = vx;
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
*(vertex_origin + vertex_index + 1) = vy - eps;
|
*(vertex_origin + vertex_index + 1) = vy - a_third;
|
||||||
*(vertex_origin + vertex_index + 2) = vz;
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
vertex_index += 3;
|
vertex_index += 3;
|
||||||
|
@ -701,13 +701,13 @@ static bool arrows_anchors (long x, long y, long z,
|
||||||
|
|
||||||
*(vertex_origin + vertex_index + 0) = vx;
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
*(vertex_origin + vertex_index + 1) = vy;
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
*(vertex_origin + vertex_index + 2) = vz + eps;
|
*(vertex_origin + vertex_index + 2) = vz + a_third;
|
||||||
|
|
||||||
vertex_index += 3;
|
vertex_index += 3;
|
||||||
|
|
||||||
*(vertex_origin + vertex_index + 0) = vx;
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
*(vertex_origin + vertex_index + 1) = vy;
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
*(vertex_origin + vertex_index + 2) = vz - eps;
|
*(vertex_origin + vertex_index + 2) = vz - a_third;
|
||||||
|
|
||||||
vertex_index += 3;
|
vertex_index += 3;
|
||||||
|
|
||||||
|
@ -723,6 +723,89 @@ static bool arrows_anchors (long x, long y, long z,
|
||||||
|
|
||||||
colors_index += 3;
|
colors_index += 3;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
// X - X axis arrows tips near the faces centers EAST - WEST
|
||||||
|
|
||||||
|
*(vertex_origin + vertex_index + 0) = vx + ad - eps;
|
||||||
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
|
vertex_index += 3;
|
||||||
|
|
||||||
|
*(vertex_origin + vertex_index + 0) = vx - ad + eps;
|
||||||
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
|
vertex_index += 3;
|
||||||
|
|
||||||
|
*(colors_origin + colors_index + 0) = 0;
|
||||||
|
*(colors_origin + colors_index + 1) = 0;
|
||||||
|
*(colors_origin + colors_index + 2) = 0;
|
||||||
|
|
||||||
|
colors_index += 3;
|
||||||
|
|
||||||
|
*(colors_origin + colors_index + 0) = 0;
|
||||||
|
*(colors_origin + colors_index + 1) = 0;
|
||||||
|
*(colors_origin + colors_index + 2) = 0;
|
||||||
|
|
||||||
|
colors_index += 3;
|
||||||
|
|
||||||
|
|
||||||
|
// Y - Y axis arrows tips near the faces centers ZENITH - NADIR
|
||||||
|
|
||||||
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
|
*(vertex_origin + vertex_index + 1) = vy + ad - eps;
|
||||||
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
|
vertex_index += 3;
|
||||||
|
|
||||||
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
|
*(vertex_origin + vertex_index + 1) = vy - ad + eps;
|
||||||
|
*(vertex_origin + vertex_index + 2) = vz;
|
||||||
|
|
||||||
|
vertex_index += 3;
|
||||||
|
|
||||||
|
*(colors_origin + colors_index + 0) = 0;
|
||||||
|
*(colors_origin + colors_index + 1) = 0;
|
||||||
|
*(colors_origin + colors_index + 2) = 0;
|
||||||
|
|
||||||
|
colors_index += 3;
|
||||||
|
|
||||||
|
*(colors_origin + colors_index + 0) = 0;
|
||||||
|
*(colors_origin + colors_index + 1) = 0;
|
||||||
|
*(colors_origin + colors_index + 2) = 0;
|
||||||
|
|
||||||
|
colors_index += 3;
|
||||||
|
|
||||||
|
|
||||||
|
// Z - Z axis arrows tips near the faces centers NORTH - SOUTH
|
||||||
|
|
||||||
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
|
*(vertex_origin + vertex_index + 2) = vz + ad - eps;
|
||||||
|
|
||||||
|
vertex_index += 3;
|
||||||
|
|
||||||
|
*(vertex_origin + vertex_index + 0) = vx;
|
||||||
|
*(vertex_origin + vertex_index + 1) = vy;
|
||||||
|
*(vertex_origin + vertex_index + 2) = vz - ad + eps;
|
||||||
|
|
||||||
|
vertex_index += 3;
|
||||||
|
|
||||||
|
*(colors_origin + colors_index + 0) = 0;
|
||||||
|
*(colors_origin + colors_index + 1) = 0;
|
||||||
|
*(colors_origin + colors_index + 2) = 0;
|
||||||
|
|
||||||
|
colors_index += 3;
|
||||||
|
|
||||||
|
*(colors_origin + colors_index + 0) = 0;
|
||||||
|
*(colors_origin + colors_index + 1) = 0;
|
||||||
|
*(colors_origin + colors_index + 2) = 0;
|
||||||
|
|
||||||
|
colors_index += 3;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -830,11 +913,33 @@ bool compute_space_and_arrows(long model_size_x, long model_size_y, long model_s
|
||||||
|
|
||||||
long s = step_z * model_size_z + step_y * model_size_y + step_x * model_size_x;
|
long s = step_z * model_size_z + step_y * model_size_y + step_x * model_size_x;
|
||||||
|
|
||||||
// draw_line (lines_origin, s + 5, s + 7);
|
|
||||||
// draw_line (lines_origin, s + 5, s + 1);
|
|
||||||
draw_line (lines_origin, s + 1, s + 2);
|
draw_line (lines_origin, s + 1, s + 2);
|
||||||
draw_line (lines_origin, s + 3, s + 4);
|
draw_line (lines_origin, s + 3, s + 4);
|
||||||
draw_line (lines_origin, s + 5, s + 6);
|
draw_line (lines_origin, s + 5, s + 6);
|
||||||
|
|
||||||
|
draw_line (lines_origin, s + 3, s + 7);
|
||||||
|
draw_line (lines_origin, s + 4, s + 7);
|
||||||
|
|
||||||
|
draw_line (lines_origin, s + 5, s + 7);
|
||||||
|
draw_line (lines_origin, s + 6, s + 7);
|
||||||
|
|
||||||
|
|
||||||
|
draw_line (lines_origin, s + 12 + 1, s + 12 + 2);
|
||||||
|
draw_line (lines_origin, s + 12 + 3, s + 12 + 4);
|
||||||
|
draw_line (lines_origin, s + 12 + 5, s + 12 + 6);
|
||||||
|
|
||||||
|
draw_line (lines_origin, s + 12 + 3, s + 12 + 8);
|
||||||
|
draw_line (lines_origin, s + 12 + 4, s + 12 + 8);
|
||||||
|
|
||||||
|
draw_line (lines_origin, s + 12 + 5, s + 12 + 8);
|
||||||
|
draw_line (lines_origin, s + 12 + 6, s + 12 + 8);
|
||||||
|
|
||||||
|
if (0) draw_line (lines_origin, s + 1, s + 9);
|
||||||
|
if (0) draw_line (lines_origin, s + 2, s + 9);
|
||||||
|
|
||||||
|
if (0) draw_line (lines_origin, s + 5, s + 9);
|
||||||
|
if (0) draw_line (lines_origin, s + 6, s + 9);
|
||||||
|
|
||||||
printf("lines_index = %ld lines_origin = %ld\n", lines_index, lines_origin);
|
printf("lines_index = %ld lines_origin = %ld\n", lines_index, lines_origin);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -51,6 +51,7 @@ int model_space_size_x = 0;
|
||||||
int model_space_size_y = 0;
|
int model_space_size_y = 0;
|
||||||
int model_space_size_z = 0;
|
int model_space_size_z = 0;
|
||||||
int model_arrows_nb = 0;
|
int model_arrows_nb = 0;
|
||||||
|
int nombre_de_cases_contenant_des_fleches = 0;
|
||||||
|
|
||||||
GLfloat *buffer_vertex_origin = NULL;
|
GLfloat *buffer_vertex_origin = NULL;
|
||||||
GLfloat *buffer_colors_origin = NULL;
|
GLfloat *buffer_colors_origin = NULL;
|
||||||
|
@ -570,9 +571,10 @@ static void get_model_data_and_user_preferences(){
|
||||||
model_space_size_z = 1; // 0 < model_space_size_z
|
model_space_size_z = 1; // 0 < model_space_size_z
|
||||||
|
|
||||||
// XXX ONLY space drawed, no arrows
|
// XXX ONLY space drawed, no arrows
|
||||||
model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint
|
model_arrows_nb = 2; // assert : l'emplacement des flèches est contraint
|
||||||
// par model_space_size_x, y, z et le nombre de sites
|
// par model_space_size_x, y, z et le nombre de sites
|
||||||
// OLD ARROWS (DEPRECATED)
|
// OLD ARROWS (DEPRECATED)
|
||||||
|
nombre_de_cases_contenant_des_fleches = 2;
|
||||||
|
|
||||||
// pref_1D_shown_as_3D_xor_2D_space = 0; // 0 = 3D 1 = 2D
|
// pref_1D_shown_as_3D_xor_2D_space = 0; // 0 = 3D 1 = 2D
|
||||||
// pref_1D_shown_as_3D_xor_2D_arrows = 0; // 0 = 3D 1 = 2D
|
// pref_1D_shown_as_3D_xor_2D_arrows = 0; // 0 = 3D 1 = 2D
|
||||||
|
@ -608,9 +610,8 @@ static void compute_buffers_sizes(int model_space_size_x,
|
||||||
long arrows_anchors = (model_space_size_x)
|
long arrows_anchors = (model_space_size_x)
|
||||||
* (model_space_size_y)
|
* (model_space_size_y)
|
||||||
* (model_space_size_z)
|
* (model_space_size_z)
|
||||||
* (8); // this is to draw the small central star
|
* (8 + 6); // 8 is to draw the small central star
|
||||||
|
// 6 is for the six faces centers
|
||||||
// Just now, I remove the six faces centers TODO : * (8 + 6)
|
|
||||||
|
|
||||||
long cubes_nb = model_space_size_x * model_space_size_y * model_space_size_z;
|
long cubes_nb = model_space_size_x * model_space_size_y * model_space_size_z;
|
||||||
|
|
||||||
|
@ -634,7 +635,9 @@ static void compute_buffers_sizes(int model_space_size_x,
|
||||||
|
|
||||||
if (pref_test_diagonal) buffer_lines_size += 2; // la diagonale test [0 - max]
|
if (pref_test_diagonal) buffer_lines_size += 2; // la diagonale test [0 - max]
|
||||||
|
|
||||||
buffer_lines_size += 6; // test flèche
|
buffer_lines_size += 6 * nombre_de_cases_contenant_des_fleches; // test central stars
|
||||||
|
|
||||||
|
buffer_lines_size += 8 * model_arrows_nb; // flèches
|
||||||
//
|
//
|
||||||
if (1) printf("allocated buffers sizes :%4d/3 = %3d vertices, %4d/3 = %3d colors,\
|
if (1) printf("allocated buffers sizes :%4d/3 = %3d vertices, %4d/3 = %3d colors,\
|
||||||
%4d/2 = %3d lines, %4d/3 = %3d plans.\n",
|
%4d/2 = %3d lines, %4d/3 = %3d plans.\n",
|
||||||
|
|
Loading…
Reference in New Issue