WIP: Après une étape importante. Encore qq. erreurs mais on a une base OK !
This commit is contained in:
parent
ab8728ec3c
commit
da3fdb10a2
|
@ -45,19 +45,19 @@
|
|||
|
||||
#define EDGE 0.999999
|
||||
|
||||
#define S2 1
|
||||
#define S2 0
|
||||
static bool compute_space_2D(int space_size_x,
|
||||
int space_size_y,
|
||||
int space_size_z,
|
||||
|
||||
int pref_mark_unit_space,
|
||||
int pref_style_lines_planes,
|
||||
int pref_style_mix_colors,
|
||||
|
||||
GLfloat *vertex_origin,
|
||||
GLfloat *color_origin,
|
||||
GLubyte *line_origin,
|
||||
GLubyte *plan_origin,
|
||||
|
||||
int pref_mark_unit_space,
|
||||
int pref_style_lines_planes,
|
||||
int pref_style_mix_colors)
|
||||
GLubyte *plan_origin)
|
||||
{
|
||||
|
||||
float x = 0;
|
||||
|
@ -214,7 +214,7 @@ static int compute_arrow_2D(int space_size_x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define S3 1
|
||||
#define S3 0
|
||||
static bool compute_space_3D (int space_size_x,
|
||||
int space_size_y,
|
||||
int space_size_z,
|
||||
|
@ -415,7 +415,7 @@ static bool compute_arrow_3D(int space_size_x,
|
|||
|
||||
int vgap = space_size_x * 12;
|
||||
|
||||
if (A3) printf("arrow_3D vertex buffer size = %d ", vgap);
|
||||
if (A3) printf("arrow_3D (vertices %d to %d) ", (buffer_vertex_size + vgap - 15), (buffer_vertex_size + vgap));
|
||||
|
||||
*(vertex_origin + vgap + 0) = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
||||
*(vertex_origin + vgap + 1) = zero;
|
||||
|
@ -437,8 +437,8 @@ static bool compute_arrow_3D(int space_size_x,
|
|||
*(vertex_origin + vgap + 13) = - 0.4f / space_size_x;
|
||||
*(vertex_origin + vgap + 14) = 0.4f / space_size_x;
|
||||
|
||||
if (A3) printf("x = %d site = %d center = %f tip = %f base = %f\n",\
|
||||
x, site, center, tip, base); // vgap=%d igap=%d
|
||||
if (A3) printf("center = %f tip = %f base = %f\n",\
|
||||
center, tip, base); // vgap=%d igap=%d
|
||||
|
||||
if (pref_lines_planes_or_mix == 0) {
|
||||
|
||||
|
@ -493,6 +493,42 @@ static bool compute_arrow_3D(int space_size_x,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void show_user_choices(int model_space_size_x,
|
||||
int model_space_size_y,
|
||||
int model_space_size_z,
|
||||
|
||||
GLubyte *arrows,
|
||||
int model_arrows_nb,
|
||||
|
||||
int pref_3D_xor_2D_space,
|
||||
int pref_3D_xor_2D_arrows,
|
||||
int pref_mark_unit_space,
|
||||
int pref_style_lines_planes,
|
||||
int pref_style_mix_colors,
|
||||
|
||||
int buffer_vertex_size,
|
||||
int buffer_colors_size,
|
||||
int buffer_lines_size,
|
||||
int buffer_plans_size)
|
||||
{
|
||||
printf("buffers.compute x,y,z = (%d, %d, %d) ", model_space_size_x, model_space_size_y, model_space_size_z);
|
||||
if (pref_3D_xor_2D_space == 0) printf("3D space ");
|
||||
if (pref_3D_xor_2D_space == 1) printf("2D space ");
|
||||
if (pref_3D_xor_2D_arrows == 0) printf("3D arrows ");
|
||||
if (pref_3D_xor_2D_arrows == 1) printf("2D arrows ");
|
||||
if (pref_mark_unit_space == 0) printf("no unit_space marks ");
|
||||
if (pref_mark_unit_space == 1) printf("first unit space marked ");
|
||||
if (pref_mark_unit_space == 2) printf("last unit_space marked ");
|
||||
if (pref_mark_unit_space == 3) printf("first and last units space marked ");
|
||||
if (! pref_style_lines_planes) printf("style_lines_planes = 0 ");
|
||||
if (pref_style_lines_planes > 0)printf("style_lines_planes = %d ", pref_style_lines_planes);
|
||||
if (! pref_style_mix_colors) printf("style_mix_colors = 0 ");
|
||||
if (pref_style_mix_colors > 0)printf("style_mix_colors = %d ", pref_style_mix_colors);
|
||||
printf("\n--------------- %d vertices %d colors %d lines %d plans\n[n] load site x (arrows array)\n",
|
||||
buffer_vertex_size, buffer_colors_size, buffer_lines_size, buffer_plans_size);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#define SA 1
|
||||
bool compute_space_and_arrows(int model_space_size_x,
|
||||
|
@ -519,14 +555,6 @@ bool compute_space_and_arrows(int model_space_size_x,
|
|||
int buffer_plans_size)
|
||||
|
||||
{
|
||||
if (SA) printf("buffers.compute all ! prefer : mark_unit_space = %d \
|
||||
3D_xor_2D_space = %d (0 is 3D) (1 is 2D) pref_lines_planes_or_mix = %d\n",
|
||||
pref_mark_unit_space, pref_3D_xor_2D_space, pref_style_lines_planes);
|
||||
|
||||
if (SA) printf("buffers.compute all ! buffer_vertex_size = %d buffer_colors_size = %d\
|
||||
buffer_lines_size = %d buffer_plans_size = %d \n",
|
||||
buffer_vertex_size, buffer_colors_size, buffer_lines_size, buffer_plans_size);
|
||||
|
||||
if (pref_3D_xor_2D_space) compute_space_2D (model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
@ -554,13 +582,29 @@ bool compute_space_and_arrows(int model_space_size_x,
|
|||
plan_origin);
|
||||
|
||||
|
||||
if (SA) show_user_choices(model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
||||
arrows,
|
||||
model_arrows_nb,
|
||||
|
||||
pref_3D_xor_2D_space,
|
||||
pref_3D_xor_2D_arrows,
|
||||
pref_mark_unit_space,
|
||||
pref_style_lines_planes,
|
||||
pref_style_mix_colors,
|
||||
|
||||
buffer_vertex_size,
|
||||
buffer_colors_size,
|
||||
buffer_lines_size,
|
||||
buffer_plans_size);
|
||||
|
||||
// arrows = { 1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21 }
|
||||
if (SA) for (int i = 0; i < model_arrows_nb; i++) {
|
||||
printf("[%d] = %2d, %2d, %2d\n",\
|
||||
printf("[%d] = %2d, %2d, %2d ",\
|
||||
i, *(arrows + i * 3), *(arrows + i * 3 + 1), *(arrows + i * 3 + 2));
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (pref_3D_xor_2D_arrows) compute_arrow_2D(model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
|
|
@ -503,6 +503,24 @@ bool graphics_init_shaders(const void *gl_area)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// TODO Tester (presque) toutes les combinaisons possibles de ces variables !!!
|
||||
|
@ -511,7 +529,7 @@ bool graphics_init_shaders(const void *gl_area)
|
|||
static void get_model_data_and_user_preferences(){
|
||||
|
||||
model_space_size_x = 10; // 2 < model_space_size_x < 32
|
||||
model_arrows_nb = 0; // assert : leur emplacement est contraint par
|
||||
model_arrows_nb = 1; // assert : leur emplacement est contraint par
|
||||
// model_space_size_x, y, z et le nombre de sites
|
||||
|
||||
pref_3D_xor_2D_space = 0; // 0 = 3D 1 = 2D
|
||||
|
@ -521,6 +539,28 @@ static void get_model_data_and_user_preferences(){
|
|||
pref_style_mix_colors = 0; // TODO
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void compute_buffers_sizes(int model_space_size_x,
|
||||
int model_space_size_y,
|
||||
int model_space_size_z,
|
||||
|
@ -557,7 +597,7 @@ static void compute_buffers_sizes(int model_space_size_x,
|
|||
|
||||
/* buffer_plans_size est fonction de : model_space_size_x, model_arrows_nb et de pref_style_lines_planes */
|
||||
|
||||
printf("graphics.buffers_sizes : %u vertices, %u colors, %u lines, %u plans. (model_space_size_x = %d)\n",
|
||||
if (0) printf("graphics.buffers_sizes : %u vertices, %u colors, %u lines, %u plans. (space_size_x = %d)\n",
|
||||
buffer_vertex_size, buffer_colors_size, buffer_lines_size, buffer_plans_size, model_space_size_x);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue