WIP: arrows are drawn OK in particular cases (line 594). Now, let's write the general function()

This commit is contained in:
Jean Sirmai 2023-10-24 00:02:10 +02:00
parent 96f5ba7df3
commit faa7ecdc86
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 21 additions and 23 deletions

View File

@ -38,8 +38,7 @@ typedef struct arrow_t {
GLuint z;
};
int write_one_arrow_vertex (int offset_vertex,
int space_X, int space_Y, int space_Z,
int write_one_arrow_vertex (int space_X, int space_Y, int space_Z,
int weight, int site, int x, int y, int z);
int write_one_arrow_line(int offset_vertex);

View File

@ -33,8 +33,7 @@
* Z - Z = NORTH - SOUTH = bleu - jaune
*/
int write_one_arrow_vertex (int offset_vertex,
int space_X_int, int space_Y_int, int space_Z_int,
int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int,
int weight, int site, int arrow_x, int arrow_y, int arrow_z)
{
@ -47,14 +46,11 @@ int write_one_arrow_vertex (int offset_vertex,
vy = (2 * j / space_Y_int - 1) * space_Y_int / max + (1 / max),
vz = (2 * k / space_Z_int - 1) * space_Z_int / max + (1 / max);
// ici, arrow_basis_width = 0 <> Plus d'étoile centrale
GLfloat arrow_basis_width = 0; // (1 / max) / 5;
graphics_write_vertex(vx, vy, vz);
graphics_write_color(0.3f, 0.3f, 0.3f);
// décale légèrement les pointes des flèches
// pour qu'elles n'aillent pas jusqu'aux faces des cubes
// réduit légèrement les longueurs des flèches
// pour qu'elles s'arrêtent avant les faces des cubes
GLfloat arrow_tip_padding = (1 / max) / 10;
switch(site){

View File

@ -133,8 +133,8 @@ void graphics_write_vertex (GLfloat x, GLfloat y, GLfloat z)
buffer_vertex_origin[buffer_vertex_size + 1] = y;
buffer_vertex_origin[buffer_vertex_size + 2] = z;
if (0) printf("In graphics_write_vertex() buffer_vertex_size = %2d > %2d (%6.3f,%6.3f,%6.3f)\n",\
buffer_vertex_size, buffer_vertex_size + 3, x, y, z);
if (1) printf("In graphics_write_vertex() buffer_vertex_size => [%2d > %2d] (%6.3f,%6.3f,%6.3f)\n",\
buffer_vertex_size + 0, buffer_vertex_size + 2, x, y, z);
buffer_vertex_size += 3;
}
@ -177,8 +177,8 @@ void graphics_write_line (GLuint a, GLuint b)
buffer_lines_origin[buffer_lines_size + 0] = a;
buffer_lines_origin[buffer_lines_size + 1] = b;
if (0) printf("In graphics_write_line() buffer_lines_size = %2d > %2d\n",\
buffer_lines_size, buffer_lines_size + 2);
if (1) printf("In graphics_write_line() buffer_lines_size => [%2d > %2d]\n",\
buffer_lines_size + 0, buffer_lines_size + 1);
buffer_lines_size += 2;
}
@ -582,12 +582,16 @@ static inline int create_arrow (int arrows_nb,
arrows_ptr[arrows_nb].y = y;
arrows_ptr[arrows_nb].z = z;
write_one_arrow_vertex(buffer_vertex_size,
space_X, space_Y, space_Z,
/* if (1) printf("In create_arrow() buffer_vertex_size => [%2d > %2d] (%6.3f,%6.3f,%6.3f)\n",\ */
/* buffer_vertex_size + 0, buffer_vertex_size + 2, x, y, z); */
write_one_arrow_vertex(space_X, space_Y, space_Z,
load, site, x, y, z);
buffer_colors_size = buffer_vertex_size;
write_one_arrow_line (buffer_vertex_size);
/* write_one_arrow_line (buffer_vertex_size); */
/* cas (1,1,1) graphics_write_line (9, 10); graphics_write_line (10, 11); */
graphics_write_line (13, 14); graphics_write_line (14, 15);
arrows_nb ++;
@ -696,9 +700,9 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
int arbitrary = 7;
int space_X = 1 + rand() % arbitrary,
space_Y = 1 + rand() % arbitrary,
space_Z = 1 + rand() % arbitrary;
int space_X = 2,//1 + rand() % arbitrary,
space_Y = 1,//1 + rand() % arbitrary,
space_Z = 1;//1 + rand() % arbitrary;
int density_max = space_X * space_Y * space_Z;
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
@ -752,7 +756,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* y = arrows_ptr[i].y; */
/* z = arrows_ptr[i].z; */
/* write_one_arrow_vertex(buffer_vertex_size, space_X, space_Y, space_Z, */
/* write_one_arrow_vertex(space_X, space_Y, space_Z, */
/* load, site, x, y, z); */
/* buffer_colors_size = buffer_vertex_size; */
/* } */
@ -893,8 +897,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
/* y = arrows_ptr[i].y; */
/* z = arrows_ptr[i].z; */
/* buffer_vertex_size += write_one_arrow_vertex(buffer_vertex_size, */
/* space_X, space_Y, space_Z, */
/* buffer_vertex_size += write_one_arrow_vertex(space_X, space_Y, space_Z, */
/* load, site, x, y, z); */
/* buffer_colors_size = buffer_vertex_size; */
/* } */