WIP: (micro) > deux vertex par flèche (1ère ébauche)
This commit is contained in:
parent
52c3fee834
commit
bf0e192615
|
@ -134,45 +134,23 @@ int write_one_arrow_vertex (int offset_vertex,
|
||||||
// pour qu'elles n'aillent pas jusqu'aux faces des cubes
|
// pour qu'elles n'aillent pas jusqu'aux faces des cubes
|
||||||
GLfloat arrow_tip_padding = (1 / max) / 10;
|
GLfloat arrow_tip_padding = (1 / max) / 10;
|
||||||
|
|
||||||
/* // X - X axis - central star (basis) */
|
switch(site){
|
||||||
/* graphics_write_vertex(vx + arrow_basis_width, vy, vz); */
|
case EAST: case WEST:
|
||||||
/* graphics_write_vertex(vx - arrow_basis_width, vy, vz); */
|
graphics_write_vertex (vx + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, vy, vz);
|
||||||
/* graphics_write_color(0.3f, 0.3f, 0.3f); */
|
graphics_write_color (1.0f, 0.0f, 0.0f);
|
||||||
/* graphics_write_color(0.3f, 0.3f, 0.3f); */
|
break;
|
||||||
|
case ZENITH: case NADIR:
|
||||||
|
graphics_write_vertex (vx, vy + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding, vz);
|
||||||
|
graphics_write_color(0.0f, 1.0f, 0.0f);
|
||||||
|
break;
|
||||||
|
case SOUTH: case NORTH:
|
||||||
|
graphics_write_vertex (vx, vy, vz + (site % 2) * (1 / max) - (site % 2) * arrow_tip_padding);
|
||||||
|
graphics_write_color(0.0f, 0.0f, 1.0f);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
/* // Y - Y axis - central star (basis) */
|
return 2;
|
||||||
/* graphics_write_vertex(vx, vy + arrow_basis_width, vz); */
|
|
||||||
/* graphics_write_vertex(vx, vy - arrow_basis_width, vz); */
|
|
||||||
/* graphics_write_color(0.3f, 0.3f, 0.3f); */
|
|
||||||
/* graphics_write_color(0.3f, 0.3f, 0.3f); */
|
|
||||||
|
|
||||||
/* // Z - Z axis - central star (basis) */
|
|
||||||
/* graphics_write_vertex(vx, vy, vz + arrow_basis_width); */
|
|
||||||
/* graphics_write_vertex(vx, vy, vz - arrow_basis_width); */
|
|
||||||
/* graphics_write_color(0.3f, 0.3f, 0.3f); */
|
|
||||||
/* graphics_write_color(0.3f, 0.3f, 0.3f); */
|
|
||||||
|
|
||||||
GLfloat nuance = 0.24f;
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
graphics_write_color(1.0f - nuance / 3, 0.0f + nuance, 0.0f + nuance);
|
|
||||||
graphics_write_color(0.0f + nuance, 1.0f - nuance, 1.0f - nuance);
|
|
||||||
|
|
||||||
// Y - Y (ZENITH - NADIR) axis - arrows tips (cyan - magenta)
|
|
||||||
graphics_write_vertex (vx, vy + (1 / max) - arrow_tip_padding, vz);
|
|
||||||
graphics_write_vertex (vx, vy - (1 / max) + arrow_tip_padding, vz);
|
|
||||||
graphics_write_color(0.0f + nuance, 1.0f - nuance / 3, 0.0f + nuance);
|
|
||||||
graphics_write_color(1.0f - nuance, 0.0f + nuance, 1.0f - nuance);
|
|
||||||
|
|
||||||
// Z - Z (NORTH - SOUTH) axis - arrows tips (blue - yellow)
|
|
||||||
graphics_write_vertex (vx, vy, vz + (1 / max) - arrow_tip_padding);
|
|
||||||
graphics_write_vertex (vx, vy, vz - (1 / max) + arrow_tip_padding);
|
|
||||||
graphics_write_color(0.0f + nuance * 2, 0.0f + nuance * 2, 1.0f - nuance);
|
|
||||||
graphics_write_color(1.0f - nuance / 3, 1.0f - nuance / 3, 0.0f + nuance);
|
|
||||||
|
|
||||||
return 7;//12;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,18 +158,14 @@ int write_one_arrow_lines(int offset_vertex,
|
||||||
int space_X_int, int space_Y_int, int space_Z_int,
|
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)
|
int weight, int site, int arrow_x, int arrow_y, int arrow_z)
|
||||||
{
|
{
|
||||||
/* graphics_write_line (offset_vertex + 0, offset_vertex + 1); */
|
|
||||||
/* graphics_write_line (offset_vertex + 2, offset_vertex + 3); */
|
|
||||||
/* graphics_write_line (offset_vertex + 4, offset_vertex + 5); */
|
|
||||||
|
|
||||||
switch(site){
|
switch(site){
|
||||||
case EAST: case WEST: graphics_write_line (offset_vertex + 0, offset_vertex + 1 + site % 2); break;
|
case EAST: case WEST: graphics_write_line (offset_vertex + 0, offset_vertex + 1); break;
|
||||||
case ZENITH: case NADIR: graphics_write_line (offset_vertex + 0, offset_vertex + 3 + site % 2); break;
|
case ZENITH: case NADIR: graphics_write_line (offset_vertex + 0, offset_vertex + 1); break;
|
||||||
case SOUTH: case NORTH: graphics_write_line (offset_vertex + 0, offset_vertex + 5 + site % 2); break;
|
case SOUTH: case NORTH: graphics_write_line (offset_vertex + 0, offset_vertex + 1); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 7;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,26 +113,6 @@ static void graphics_debug_callback(GLenum source, GLenum type, GLuint id,
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
|
||||||
* Writes values to describe a line from a to b into the line buffer
|
|
||||||
*
|
|
||||||
* @param coords GLuint (a,b)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void graphics_write_line (GLuint a, GLuint b)
|
|
||||||
{
|
|
||||||
buffer_lines_origin = g_realloc (buffer_lines_origin,
|
|
||||||
(buffer_lines_size + 2) * sizeof(GLuint));
|
|
||||||
|
|
||||||
assert (buffer_lines_origin);
|
|
||||||
|
|
||||||
buffer_lines_origin[buffer_lines_size + 0] = a;
|
|
||||||
buffer_lines_origin[buffer_lines_size + 1] = b;
|
|
||||||
|
|
||||||
buffer_lines_size += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe a vertex at (x,y,z) into the vertex buffer
|
* Writes values to describe a vertex at (x,y,z) into the vertex buffer
|
||||||
*
|
*
|
||||||
|
@ -177,6 +157,26 @@ void graphics_write_color (GLfloat r, GLfloat g, GLfloat b)
|
||||||
buffer_colors_size += 3;
|
buffer_colors_size += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes values to describe a line from a to b into the line buffer
|
||||||
|
*
|
||||||
|
* @param coords GLuint (a,b)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void graphics_write_line (GLuint a, GLuint b)
|
||||||
|
{
|
||||||
|
buffer_lines_origin = g_realloc (buffer_lines_origin,
|
||||||
|
(buffer_lines_size + 2) * sizeof(GLuint));
|
||||||
|
|
||||||
|
assert (buffer_lines_origin);
|
||||||
|
|
||||||
|
buffer_lines_origin[buffer_lines_size + 0] = a;
|
||||||
|
buffer_lines_origin[buffer_lines_size + 1] = b;
|
||||||
|
|
||||||
|
buffer_lines_size += 2;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
||||||
*
|
*
|
||||||
|
@ -676,14 +676,14 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
int rand(void);
|
int rand(void);
|
||||||
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min);
|
||||||
|
|
||||||
int arbitrary = 160;
|
int arbitrary = 8;
|
||||||
int space_X = 1 + rand() % arbitrary,
|
int space_X = 1 + rand() % arbitrary,
|
||||||
space_Y = 1 + rand() % arbitrary,
|
space_Y = 1 + rand() % arbitrary,
|
||||||
space_Z = 1 + rand() % arbitrary;
|
space_Z = 1 + rand() % arbitrary;
|
||||||
int density_max = space_X * space_Y * space_Z;
|
int density_max = space_X * space_Y * space_Z;
|
||||||
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
||||||
|
|
||||||
int show_space_design = 1, print_arrows_data = 0;
|
int show_space_design = 1, print_arrows_data = 1;
|
||||||
|
|
||||||
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
||||||
int specif_arrows_nb = rand() % density_max / 3;
|
int specif_arrows_nb = rand() % density_max / 3;
|
||||||
|
@ -715,13 +715,13 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
offset_vertex += write_space_ridges_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z);
|
offset_vertex += write_space_ridges_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z);
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
|
|
||||||
if (0) printf("offset_vertex after writing_space_ridges_vertex : %d (x 3 = %d)\n\n", offset_vertex, offset_vertex * 3);
|
if (1) printf("offset_vertex after writing_space_ridges_vertex : %d (x 3 = %d)\n\n", offset_vertex, offset_vertex * 3);
|
||||||
|
|
||||||
offset_vertex += write_grids_on_space_faces_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, show_space_design);
|
offset_vertex += write_grids_on_space_faces_vertex (offset_vertex, offset_colors, offset_lines, space_X, space_Y, space_Z, show_space_design);
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
|
|
||||||
if (0) printf("offset_vertex after writing_space_faces_vertex = %4d - 8 = %3d (x 3 = %4d)\n", offset_vertex, offset_vertex - 8, (offset_vertex - 8) * 3);
|
if (1) printf("offset_vertex after writing_space_faces_vertex = %4d - 8 = %3d (x 3 = %4d)\n", offset_vertex, offset_vertex - 8, (offset_vertex - 8) * 3);
|
||||||
if (0) printf("(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4 = %3d (x 3 = %4d)\n\n",\
|
if (1) printf("(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4 = %3d (x 3 = %4d)\n\n",\
|
||||||
(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4, ((space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4) * 3);
|
(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4, ((space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4) * 3);
|
||||||
|
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
||||||
offset_colors = offset_vertex;
|
offset_colors = offset_vertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) printf("offset_vertex after writing_arrows_vertex : %d (x 3 = %d) (arrows_nb = %d)\n", offset_vertex, offset_vertex * 3, arrows_nb);
|
if (1) printf("offset_vertex after writing_arrows_vertex : %d (x 3 = %d) (arrows_nb = %d)\n", offset_vertex, offset_vertex * 3, arrows_nb);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------*/
|
/*---------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue