OK - représentation 3D (espace et flèches) d'un modèle 3D (dimères)
This commit is contained in:
parent
ef34deff8a
commit
404f8e6ca2
|
@ -33,8 +33,6 @@ bool compute_space_and_arrows(int model_space_size_x,
|
|||
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,
|
||||
|
|
|
@ -530,18 +530,12 @@ static void show_user_choices(int model_space_size_x,
|
|||
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)
|
||||
{
|
||||
printf("model + user constraints : 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 (model_arrows_nb > 0) printf("[%d] ", model_arrows_nb);
|
||||
if (pref_3D_xor_2D_arrows == 0) printf("3D arrow(s) ");
|
||||
if (pref_3D_xor_2D_arrows == 1) printf("2D arrow(s) ");
|
||||
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 ");
|
||||
|
@ -565,8 +559,6 @@ bool compute_space_and_arrows(int model_space_size_x,
|
|||
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,
|
||||
|
@ -584,28 +576,11 @@ bool compute_space_and_arrows(int model_space_size_x,
|
|||
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);
|
||||
|
||||
if (pref_3D_xor_2D_space) compute_space_2D (
|
||||
model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
||||
pref_mark_unit_space,
|
||||
pref_style_lines_planes,
|
||||
pref_style_mix_colors,
|
||||
|
||||
vertex_origin,
|
||||
color_origin,
|
||||
line_origin,
|
||||
plan_origin);
|
||||
|
||||
else compute_space_3D (
|
||||
model_space_size_x,
|
||||
compute_space_3D ( model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
||||
|
@ -619,33 +594,13 @@ bool compute_space_and_arrows(int model_space_size_x,
|
|||
plan_origin);
|
||||
|
||||
for (int i = 0; i < model_arrows_nb; i++)
|
||||
if (pref_3D_xor_2D_arrows) compute_arrow_2D(
|
||||
model_space_size_x,
|
||||
compute_arrow_3D( model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
||||
*(arrows + i * 3 + 0), // weight (load)
|
||||
*(arrows + i * 3 + 1), // site
|
||||
*(arrows + i * 3 + 2), // x
|
||||
0, // y
|
||||
0, // z
|
||||
|
||||
pref_style_lines_planes,
|
||||
pref_style_mix_colors,
|
||||
|
||||
vertex_origin,
|
||||
color_origin,
|
||||
line_origin,
|
||||
plan_origin);
|
||||
|
||||
else compute_arrow_3D(
|
||||
model_space_size_x,
|
||||
model_space_size_y,
|
||||
model_space_size_z,
|
||||
|
||||
*(arrows + i * 3 + 0), // weight (load)
|
||||
*(arrows + i * 3 + 1), // site
|
||||
*(arrows + i * 3 + 2), // x
|
||||
*(arrows + i * 5 + 0), // weight (load)
|
||||
*(arrows + i * 5 + 1), // site
|
||||
*(arrows + i * 5 + 2), // x
|
||||
0, // y
|
||||
0, // z
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ GLfloat *buffer_colors_origin = NULL;
|
|||
GLubyte *buffer_lines_origin = NULL;
|
||||
GLubyte *buffer_plans_origin = NULL;
|
||||
|
||||
int pref_3D_xor_2D_space = 0; // default view == 0 == 3D
|
||||
int pref_3D_xor_2D_arrows = 0; // default view == 0 == 3D
|
||||
//int pref_3D_xor_2D_space = 0; // default view == 0 == 3D
|
||||
//int pref_3D_xor_2D_arrows = 0; // default view == 0 == 3D
|
||||
int pref_mark_unit_space = 0; // default == 0 == no marks
|
||||
int pref_style_lines_planes = 0; // arrows as lines = 0, as planes = 1
|
||||
int pref_style_mix_colors = 0; // ... don't know yet ...
|
||||
|
@ -521,16 +521,25 @@ bool graphics_init_shaders(const void *gl_area)
|
|||
|
||||
|
||||
|
||||
GLubyte arrows[] = { 1, 1, 0, 1, 0, 1, 1, 1, 4, 1, 0, 5, 1, 1, 8, 1, 0, 9 };
|
||||
// arrows[] = { 1, 1, 0, 1, 2, 1, 1, 1, 10, 1, 2, 11, 1, 1, 20, 1, 2, 21 };
|
||||
GLubyte arrows[] = {
|
||||
1, 1, 0, 0, 0,
|
||||
1, 0, 1, 0, 0,
|
||||
1, 1, 4, 0, 0,
|
||||
1, 0, 5, 0, 0,
|
||||
1, 1, 8, 0, 0,
|
||||
1, 0, 9, 0, 0,
|
||||
}; // XMLarrows[] = {1,1,0, 1,2,1, 1,1,10, 1,2,11, 1,1,20, 1,2,21};
|
||||
|
||||
static void get_model_data_and_user_preferences(){
|
||||
|
||||
model_space_size_x = 11; // 2 < model_space_size_x < 32
|
||||
model_space_size_y = 0; // 2 < model_space_size_x < 32
|
||||
model_space_size_z = 0; // 2 < model_space_size_x < 32
|
||||
model_arrows_nb = 6; // assert : l'emplacement des flèches est contraint
|
||||
// par model_space_size_x, y, z et le nombre de sites
|
||||
pref_3D_xor_2D_space = 0; // 0 = 3D 1 = 2D
|
||||
pref_3D_xor_2D_arrows = 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_mark_unit_space = 3; // 0 = no marks, 1 = 1st, 2 = last, 3 = both
|
||||
pref_style_lines_planes = 0; // 0 = arrows as lines, 1 = as planes, 2 = mix
|
||||
pref_style_mix_colors = 0; // TODO
|
||||
|
@ -564,45 +573,26 @@ static void compute_buffers_sizes(int model_space_size_x,
|
|||
|
||||
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 two_ladder_amounts = 4; // 2 parallels to connect 4 vertices
|
||||
int four_ladder_amounts = 8; // 4 parallels to connect the orthogonal squares
|
||||
|
||||
if (pref_3D_xor_2D_space) { // 2D the ladder has 2 amounts
|
||||
buffer_vertex_size = model_space_size_x * 6;
|
||||
buffer_colors_size = model_space_size_x * 6;
|
||||
buffer_plans_size = 0;
|
||||
buffer_lines_size = model_space_size_x * 2 + two_ladder_amounts;
|
||||
|
||||
} else { // 3D the ladder has 4 amounts, now
|
||||
buffer_vertex_size = (model_space_size_x + 1) * 12;
|
||||
buffer_colors_size = (model_space_size_x + 1) * 12;
|
||||
buffer_plans_size = 0;
|
||||
buffer_lines_size = (model_space_size_x + 1) * 12 + 2 * two_ladder_amounts;
|
||||
}
|
||||
buffer_lines_size = (model_space_size_x + 1) * 12 + four_ladder_amounts;
|
||||
|
||||
|
||||
/* There, increment in buffer_lines_size is the same for 2D & 3D */
|
||||
if (pref_mark_unit_space == 1 || pref_mark_unit_space == 3) buffer_lines_size += 4; // 2 diagonal lines
|
||||
if (pref_mark_unit_space == 2 || pref_mark_unit_space == 3) buffer_lines_size += 4; // 2 diagonal lines
|
||||
|
||||
if (pref_3D_xor_2D_arrows) { // 2D
|
||||
buffer_vertex_size += model_arrows_nb * 9;
|
||||
buffer_colors_size += model_arrows_nb * 9;
|
||||
buffer_plans_size += 0;
|
||||
buffer_lines_size += model_arrows_nb * 6;
|
||||
|
||||
} else { // 3D
|
||||
buffer_vertex_size += model_arrows_nb * 15;
|
||||
buffer_colors_size += model_arrows_nb * 15;
|
||||
buffer_plans_size += 0;
|
||||
buffer_lines_size += model_arrows_nb * 16;
|
||||
}
|
||||
|
||||
/* buffer_plans_size est fonction de : model_space_size_x, model_arrows_nb et de pref_style_lines_planes */
|
||||
|
||||
if (S) printf("allocated buffers sizes :%4d/3 = %3d vertices, %4d/3 = %3d colors,\
|
||||
%4d/2 = %3d lines, %4d/3 = %3d plans. (space_size_x = %d)\n",
|
||||
|
@ -633,8 +623,6 @@ void graphics_init_buffers(const void *gl_area)
|
|||
|
||||
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);
|
||||
|
@ -651,8 +639,6 @@ void graphics_init_buffers(const void *gl_area)
|
|||
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,
|
||||
|
|
Loading…
Reference in New Issue