atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
d_measures.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'd_measures.c'
24*
25* Contains:
26*
27
28 - The functions to prepare the OpenGL rendering of the measure(s)
29
30*
31* List of functions:
32
33 int prepare_measure_shaders (int type, int shaders);
34
35 void draw_angle_label (atom * at, atom * bt, atom * ct, int pi);
36 void set_measure_color (int selected, int id, int num);
37 void setup_this_measured_angle (int s, int sa, int sb, int sc, int pi);
38 void angles_loop (glwin * view, int id, int pi, GtkTreeStore * store);
39 void dihedrals_loop (glwin * view, int id, int pi, GtkTreeStore * store);
40 void draw_bond_label (atom * at, atom * bt, int pi);
41 void setup_this_measured_bond (int s, int sa, int sb, int pi);
42 void bonds_loop (glwin * view, int id, int pi, GtkTreeStore * store);
43 void create_measures_lists ();
44
45*/
46
47#include "global.h"
48#include "glview.h"
49
50extern void setup_line_vertice (float * vertices, vec3_t pos, ColRGBA col, float alpha);
51extern void unrotate_camera ();
52extern double arc_cos (double val);
53extern ColRGBA init_color (int id, int numid);
54extern void fill_bond_model_row (int p, int a, int b, GtkTreeStore * store);
55extern void fill_angle_model_row (int p, int a, int b, int c, GtkTreeStore * store);
56extern void fill_dihedral_model_row (int p, int a, int b, int c, int d, GtkTreeStore * store);
57extern int num_bonds (int i);
58extern int num_angles (int i);
59extern int num_dihedrals (int i);
60extern void clean_labels (int id);
61
62extern int objects[3];
63extern int * object_was_selected[3];
64extern int ** tmp_object_id[3];
65
68
70atom * ta, * tb, * tc, * td, * te, * tf;
72int * shift;
73double dist;
74
76
79
90void draw_angle_label (atom * at, atom * bt, atom * ct, int pi)
91{
92 angle real_theta = angle_3d (cell_gl, (cell_gl -> npt) ? step : 0, at, bt, ct);
93 gchar * str;
94 if (real_theta.pbc)
95 {
96 str = g_strdup_printf("%.1lf° (PBC)", real_theta.angle);
97 }
98 else
99 {
100 str = g_strdup_printf("%.1lf°", real_theta.angle);
101 }
102 float ls[3] = {15.0, 15.0, 0.0};
103 vec3_t pos = vec3(bt -> x, bt -> y, bt -> z);
104 prepare_string (str, 3+pi, plot -> labels_color[3+pi][0], pos, ls, at, bt, ct);
105 g_free (str);
106}
107
117void set_measure_color (int selected, int id, int num)
118{
119 if (selected)
120 {
121 col = init_color (id, num);
122 }
123 else
124 {
125 col.red = 1.0 - plot -> backcolor.red;
126 col.green = 1.0 - plot -> backcolor.green;
127 col.blue = 1.0 - plot -> backcolor.blue;
128 col.alpha = 1.0;
129 }
130}
131
143void setup_this_measured_angle (int s, int sa, int sb, int sc, int pi)
144{
145 float alpha = 1.0;
146 float shift[3];
147 int p, q, r;
148 vec3_t pos_a, pos_b, pos_c;
149 atom * at, * bt, * ct;
150 at = & proj_gl -> atoms[step][sa];
151 bt = & proj_gl -> atoms[step][sb];
152 ct = & proj_gl -> atoms[step][sc];
153
154 for (p=0; p<plot -> extra_cell[0]+1;p++)
155 {
156 for (q=0; q<plot -> extra_cell[1]+1; q++)
157 {
158 for (r=0; r<plot -> extra_cell[2]+1; r++)
159 {
160 shift[0]=p*box_gl -> vect[0][0]+q*box_gl -> vect[1][0]+r*box_gl -> vect[2][0];
161 shift[1]=p*box_gl -> vect[0][1]+q*box_gl -> vect[1][1]+r*box_gl -> vect[2][1];
162 shift[2]=p*box_gl -> vect[0][2]+q*box_gl -> vect[1][2]+r*box_gl -> vect[2][2];
163 at_shift (at, shift);
164 at_shift (bt, shift);
165 at_shift (ct, shift);
166 pos_a = vec3(at -> x, at -> y, at -> z);
167 pos_b = vec3(bt -> x, bt -> y, bt -> z);
168 pos_c = vec3(ct -> x, ct -> y, ct -> z);
169 if (s == 0)
170 {
171 setup_line_vertice (measure -> vertices, pos_a, col, alpha);
172 setup_line_vertice (measure -> vertices, pos_b, col, alpha);
173 setup_line_vertice (measure -> vertices, pos_c, col, alpha);
174 }
175 else
176 {
177 // Text location for the instances !
178 draw_angle_label (at, bt, ct, pi);
179 }
180 at_unshift (at, shift);
181 at_unshift (bt, shift);
182 at_unshift (ct, shift);
183 alpha = 0.5;
184 }
185 }
186 }
187}
188
204void angles_loop (glwin * view, int id, int pi, GtkTreeStore * store)
205{
206 int i, j, k, l, m;
207 int ** did_it;
208 int aid;
209 gboolean do_it;
210 //gboolean colored;
211 image * img = view -> anim -> last -> img;
212 // Total number of angles:
213 int n_angl = num_angles (img -> selected[pi] -> selected);
214
215 did_it = allocdint (n_angl, 3);
216 aid = 0;
217 tmp_a = img -> selected[pi] -> first;
218 for (i=0; i < img -> selected[pi] -> selected; i++)
219 {
220 tmp_b = img -> selected[pi] -> first;
221 for (j=0; j < img -> selected[pi] -> selected; j++)
222 {
223 if (tmp_b -> id != tmp_a -> id)
224 {
225 tmp_c = img -> selected[pi] -> first;
226 for (k=0; k < img -> selected[pi] -> selected; k++)
227 {
228 if (tmp_c -> id != tmp_a -> id && tmp_c -> id != tmp_b -> id)
229 {
230 do_it = TRUE;
231 for (l=0; l<aid; l++)
232 {
233 if (did_it[l][1] == tmp_b -> id &&
234 ((did_it[l][0] == tmp_a -> id && did_it[l][2] == tmp_c -> id)
235 || (did_it[l][2] == tmp_a -> id && did_it[l][0] == tmp_c -> id)))
236 {
237 do_it = FALSE;
238 break;
239 }
240 }
241 if (do_it)
242 {
243 did_it[aid][0] = tmp_a -> id;
244 did_it[aid][1] = tmp_b -> id;
245 did_it[aid][2] = tmp_c -> id;
246 switch (id)
247 {
248 case -2:
249 for (m=0; m<3; m++) tmp_object_id[1][aid][m] = did_it[aid][m];
250 break;
251 case -1:
252 img -> selected[pi] -> selected_angles[aid] = 0;
253 break;
254 default:
255 if (img -> selected[pi] -> selected_angles[aid] || img -> m_is_pressed == 2 || id == 2)
256 {
257 //colored = FALSE;
258 if (id < 2)
259 {
260 set_measure_color (img -> selected[pi] -> selected_angles[aid], aid, n_angl);
261 //colored = TRUE;
262 }
263 switch (id)
264 {
265 case 2:
266 fill_angle_model_row (view -> proj, tmp_a -> id, tmp_b -> id, tmp_c -> id, store);
267 break;
268 default:
269 setup_this_measured_angle (id, tmp_a -> id, tmp_b -> id, tmp_c -> id, pi);
270 break;
271 }
272 }
273 break;
274 }
275 aid ++;
276 }
277 }
278 if (tmp_c -> next != NULL) tmp_c = tmp_c -> next;
279 }
280 }
281 if (tmp_b -> next != NULL) tmp_b = tmp_b -> next;
282 }
283 if (tmp_a -> next != NULL) tmp_a = tmp_a -> next;
284 }
285
286 if (id == -1)
287 {
288 for (i=0; i<n_angl; i++)
289 {
290 for (j=0; j<objects[1]; j++)
291 {
292 if (did_it[i][1] == tmp_object_id[1][j][1] &&
293 ((did_it[i][0] == tmp_object_id[1][j][0] && did_it[i][2] == tmp_object_id[1][j][2])
294 || (did_it[i][0] == tmp_object_id[1][j][2] && did_it[i][2] == tmp_object_id[1][j][0])))
295 {
296 img -> selected[pi] -> selected_angles[i] = object_was_selected[1][j];
297 }
298 }
299 }
300 }
301 g_free (did_it);
302}
303
319void dihedrals_loop (glwin * view, int id, int pi, GtkTreeStore * store)
320{
321 int i, j, k, l, m;
322 int ** did_it;
323 int did;
324 gboolean do_it;
325 image * img = view -> anim -> last -> img;
326 // gboolean colored;
327 // Total number of dihedral angles:
328 int n_dihedral = num_dihedrals (img -> selected[pi] -> selected);
329
330 did_it = allocdint (n_dihedral, 4);
331 did = 0;
332 tmp_a = img -> selected[pi] -> first;
333 for (i=0; i < img -> selected[pi] -> selected; i++)
334 {
335 tmp_b = img -> selected[pi] -> first;
336 for (j=0; j < img -> selected[pi] -> selected; j++)
337 {
338 if (tmp_b -> id != tmp_a -> id)
339 {
340 tmp_c = img -> selected[pi] -> first;
341 for (k=0; k < img -> selected[pi] -> selected; k++)
342 {
343 if (tmp_c -> id != tmp_a -> id && tmp_c -> id != tmp_b -> id)
344 {
345 tmp_d = img -> selected[pi] -> first;
346 for (l=0; l < img -> selected[pi] -> selected; l++)
347 {
348 if (tmp_d -> id != tmp_a -> id && tmp_d -> id != tmp_b -> id && tmp_d -> id != tmp_c -> id)
349 {
350 do_it = TRUE;
351 for (m=0; m<did; m++)
352 {
353 if ((did_it[m][0] == tmp_a -> id && did_it[m][1] == tmp_b -> id && did_it[m][2] == tmp_c -> id && did_it[m][3] == tmp_d -> id)
354 ||(did_it[m][0] == tmp_d -> id && did_it[m][1] == tmp_c -> id && did_it[m][2] == tmp_b -> id && did_it[m][3] == tmp_a -> id))
355 {
356 do_it = FALSE;
357 break;
358 }
359 }
360 if (do_it)
361 {
362 did_it[did][0] = tmp_a -> id;
363 did_it[did][1] = tmp_b -> id;
364 did_it[did][2] = tmp_c -> id;
365 did_it[did][3] = tmp_d -> id;
366 switch (id)
367 {
368 case -2:
369 for (m=0; m<4; m++) tmp_object_id[2][did][m] = did_it[did][m];
370 break;
371 case -1:
372 img -> selected[pi] -> selected_dihedrals[did] = 0;
373 break;
374 default:
375 if (img -> selected[pi] -> selected_dihedrals[did] || img -> m_is_pressed == 3 || id == 2)
376 {
377 //colored = FALSE;
378 if (id < 2)
379 {
380 set_measure_color (img -> selected[pi] -> selected_dihedrals[did], did, n_dihedral);
381 //colored = TRUE;
382 }
383 switch (id)
384 {
385 case 0:
386 //draw_angle_arc (colored);
387 break;
388 case 1:
389 //draw_angle_label ();
390 break;
391 case 2:
392 fill_dihedral_model_row (view -> proj, tmp_a -> id, tmp_b -> id, tmp_c -> id, tmp_d -> id, store);
393 break;
394 }
395 }
396 break;
397 }
398 did ++;
399 }
400 }
401 if (tmp_d -> next != NULL) tmp_d = tmp_d -> next;
402 }
403 }
404 if (tmp_c -> next != NULL) tmp_c = tmp_c -> next;
405 }
406 }
407 if (tmp_b -> next != NULL) tmp_b = tmp_b -> next;
408 }
409 if (tmp_a -> next != NULL) tmp_a = tmp_a -> next;
410 }
411
412 if (id == -1)
413 {
414 for (i=0; i<n_dihedral; i++)
415 {
416 for (j=0; j<objects[2]; j++)
417 {
418 if ((did_it[i][0] == tmp_object_id[2][j][0] && did_it[i][1] == tmp_object_id[2][j][1] && did_it[i][2] == tmp_object_id[2][j][2] && did_it[i][3] == tmp_object_id[2][j][3])
419 ||(did_it[i][0] == tmp_object_id[2][j][3] && did_it[i][1] == tmp_object_id[2][j][2] && did_it[i][2] == tmp_object_id[2][j][1] && did_it[i][3] == tmp_object_id[2][j][0]))
420 {
421 img -> selected[pi] -> selected_dihedrals[i] = object_was_selected[2][j];
422 }
423 }
424 }
425 }
426 g_free (did_it);
427}
428
438void draw_bond_label (atom * at, atom * bt, int pi)
439{
440 distance dist = distance_3d (cell_gl, (cell_gl -> npt) ? step : 0, at, bt);
441 vec3_t pos;
442 if (dist.pbc)
443 {
444 pos = vec3 (at -> x - (at -> x - bt -> x)/2.0, at -> y - (at -> y - bt -> y)/2.0, at -> z - (at -> z - bt -> z)/2.0);
445 }
446 else
447 {
448 pos = vec3 (at -> x-dist.x/2.0, at -> y-dist.y/2.0, at -> z-dist.z/2.0);
449 }
450 gchar * str;
451 if (dist.pbc)
452 {
453 str = g_strdup_printf("%.3lf Å (PBC)", dist.length);
454 }
455 else
456 {
457 str = g_strdup_printf("%.3lf Å", dist.length);
458 }
459 float ls[3] = {-15.0, 15.0, 0.0};
460 prepare_string (str, 3+pi, plot -> labels_color[3+pi][0], pos, ls, at, bt, NULL);
461 g_free (str);
462}
463
474void setup_this_measured_bond (int s, int sa, int sb, int pi)
475{
476 float alpha = 1.0;
477 float shift[3];
478 int p, q, r;
479 vec3_t pos_a, pos_b;
480 atom * at, * bt;
481 at = & proj_gl -> atoms[step][sa];
482 bt = & proj_gl -> atoms[step][sb];
483
484 for (p=0; p<plot -> extra_cell[0]+1;p++)
485 {
486 for (q=0; q<plot -> extra_cell[1]+1; q++)
487 {
488 for (r=0; r<plot -> extra_cell[2]+1; r++)
489 {
490 shift[0]=p*box_gl -> vect[0][0]+q*box_gl -> vect[1][0]+r*box_gl -> vect[2][0];
491 shift[1]=p*box_gl -> vect[0][1]+q*box_gl -> vect[1][1]+r*box_gl -> vect[2][1];
492 shift[2]=p*box_gl -> vect[0][2]+q*box_gl -> vect[1][2]+r*box_gl -> vect[2][2];
493 at_shift (at, shift);
494 at_shift (bt, shift);
495 pos_a = vec3(at -> x, at -> y, at -> z);
496 pos_b = vec3(bt -> x, bt -> y, bt -> z);
497 if (s == 0)
498 {
499 setup_line_vertice (measure -> vertices, pos_a, col, alpha);
500 setup_line_vertice (measure -> vertices, pos_b, col, alpha);
501 }
502 else
503 {
504 // Text location for the instances !
505 draw_bond_label (at, bt, pi);
506 }
507 at_unshift (at, shift);
508 at_unshift (bt, shift);
509 alpha = 0.5;
510 }
511 }
512 }
513}
514
530void bonds_loop (glwin * view, int id, int pi, GtkTreeStore * store)
531{
532 int i, j;
533 int ** did_it;
534 int bid;
535 image * img = view -> anim -> last -> img;
536 int n_dist = num_bonds (img -> selected[pi] -> selected);
537
538 if (id == 1) shift = allocint(2);
539 did_it = allocdint (n_dist, 2);
540 bid = -1;
541 tmp_a = img -> selected[pi] -> first;
542 for (i=0; i < img -> selected[pi] -> selected-1; i++)
543 {
544 tmp_b = tmp_a -> next;
545 for (j=i+1; j < img -> selected[pi] -> selected; j++)
546 {
547 bid ++;
548 did_it[bid][0] = tmp_a -> id;
549 did_it[bid][1] = tmp_b -> id;
550 switch (id)
551 {
552 case -2:
553 tmp_object_id[0][bid][0] = tmp_a -> id;
554 tmp_object_id[0][bid][1] = tmp_b -> id;
555 break;
556 case -1:
557 img -> selected[pi] -> selected_bonds[bid] = 0;
558 break;
559 default:
560 if (img -> selected[pi] -> selected_bonds[bid] || img -> m_is_pressed == 1 || id == 2)
561 {
562 if (id < 2)
563 {
564 set_measure_color (img -> selected[pi] -> selected_bonds[bid], bid, n_dist);
565 }
566 switch (id)
567 {
568 case 2:
569 fill_bond_model_row (view -> proj, tmp_a -> id, tmp_b -> id, store);
570 break;
571 default:
572 setup_this_measured_bond (id, tmp_a -> id, tmp_b -> id, pi);
573 break;
574 }
575 }
576 break;
577 }
578 if (tmp_b -> next != NULL) tmp_b = tmp_b -> next;
579 }
580 if (tmp_a -> next != NULL) tmp_a = tmp_a -> next;
581 }
582 if (id == 1) g_free (shift);
583 if (id == -1)
584 {
585 for (i=0; i<n_dist; i++)
586 {
587 for (j=0; j<objects[0]; j++)
588 {
589 if ((did_it[i][0] == tmp_object_id[0][j][0] && did_it[i][1] == tmp_object_id[0][j][1]) ||
590 (did_it[i][0] == tmp_object_id[0][j][1] && did_it[i][1] == tmp_object_id[0][j][0]))
591 {
592 img -> selected[pi] -> selected_bonds[i] = object_was_selected[0][j];
593 }
594 }
595 }
596 }
597 g_free (did_it);
598}
599
609{
610 int nshaders = 0;
611 if (plot -> selected[type] -> selected > 1 && plot -> selected[type] -> selected < MAX_IN_SELECTION)
612 {
613 if (plot -> mpattern > -1)
614 {
615 // First the bond distances
616 measure = g_malloc0 (sizeof*measure);
617 measure -> vert_buffer_size = LINE_BUFF_SIZE;
618 measure -> num_vertices = 2 * num_bonds (plot -> selected[type] -> selected) * (plot -> extra_cell[0]+1)*(plot -> extra_cell[1]+1)*(plot -> extra_cell[2]+1);
619 measure -> vertices = allocfloat (measure -> vert_buffer_size*measure -> num_vertices);
620 nbs = 0;
621 bonds_loop (wingl, 0, type, NULL);
622
623 if (plot -> mpattern != 2)
624 {
626 }
627 else
628 {
629 wingl -> ogl_glsl[MEASU][0][shaders] = init_shader_program (MEASU, GLSL_LINES, line_vertex, NULL, line_color, GL_LINES, 2, 7, FALSE, measure);
630 }
631 wingl -> ogl_glsl[MEASU][0][shaders] -> line_width = plot -> mwidth;
632 nshaders ++;
633 g_free (measure);
634
635 // The angles
636 if (plot -> selected[type] -> selected > 2)
637 {
638 measure = g_malloc0 (sizeof*measure);
639 measure -> vert_buffer_size = LINE_BUFF_SIZE;
640 measure -> num_vertices = 3 * num_angles (plot -> selected[type] -> selected) * (plot -> extra_cell[0]+1)*(plot -> extra_cell[1]+1)*(plot -> extra_cell[2]+1);
641 measure -> vertices = allocfloat (measure -> vert_buffer_size*measure -> num_vertices);
642 nbs = 0;
643 angles_loop (wingl, 0, type, NULL);
644 if (plot -> mpattern != 2)
645 {
646 wingl -> ogl_glsl[MEASU][0][shaders+1] = init_shader_program (MEASU, GLSL_LINES, angle_vertex, angle_stipple, line_stipple_color, GL_TRIANGLES, 2, 7, FALSE, measure);
647 }
648 else
649 {
650 wingl -> ogl_glsl[MEASU][0][shaders+1] = init_shader_program (MEASU, GLSL_LINES, angle_vertex, angle_stipple, angle_color, GL_TRIANGLES, 2, 7, FALSE, measure);
651 }
652 wingl -> ogl_glsl[MEASU][0][shaders+1] -> line_width = plot -> mwidth;
653 nshaders ++;
654 g_free (measure);
655 }
656 }
657 // When all labels are found we render the text if any
658 if (plot -> labels_list[3+type] != NULL)
659 {
660 measures_drawing = nshaders + shaders;
661 render_all_strings (MEASU, 3+type);
662 nshaders += (plot -> labels_render[3+type]+1) * (plot -> labels_list[3+type] -> last -> id + 1);
663 }
664 }
665 return nshaders;
666}
667
674{
675 // First we draw all lines/angles displayed on screen
676#ifdef DEBUG
677 g_debug ("Measure LIST");
678#endif
680 clean_labels (3);
681 clean_labels (4);
682 wingl -> create_shaders[MEASU] = FALSE;
683 wingl -> n_shaders[MEASU][0] = 0;
684
685 int i, j, k;
686 i = (is_atom_win_active(wingl) || (wingl -> mode == EDITION && wingl -> selection_mode == NSELECTION-1)) ? 1 : 0;
687 for (j=i; j<2; j++)
688 {
689 if (plot -> selected[j] -> selected > 1 && plot -> selected[j] -> selected < MAX_IN_SELECTION)
690 {
691 if (plot -> mpattern > -1)
692 {
693 wingl -> n_shaders[MEASU][0] ++;
694 if (plot -> selected[j] -> selected > 2) wingl -> n_shaders[MEASU][0] ++;
695 }
696 // First we need to prepare the labels
697 type_of_measure = 6;
698 bonds_loop (wingl, 1, j, NULL);
699
700 if (plot -> selected[j] -> selected >= 3)
701 {
702 type_of_measure = 9;
703 angles_loop (wingl, 1, j, NULL);
704 }
705
706 if (plot -> labels_list[3+j] != NULL)
707 {
708 // shaders for the labels if any
709 wingl -> n_shaders[MEASU][0] += (plot -> labels_render[3+j]+1) * (plot -> labels_list[3+j] -> last -> id + 1);
710 }
711 }
712 }
713 if (wingl -> n_shaders[MEASU][0])
714 {
715 wingl -> ogl_glsl[MEASU][0] = g_malloc0 (wingl -> n_shaders[MEASU][0]*sizeof*wingl -> ogl_glsl[MEASU][0]);
717 j = 0;
718 for (k=i; k<2; k++)
719 {
720 j += prepare_measure_shaders (k, j);
721 }
722 }
723}
724
int nbs
Definition d_atoms.c:176
void clean_labels(int id)
clean atomic label shaders
Definition d_label.c:143
void setup_this_measured_angle(int s, int sa, int sb, int sc, int pi)
prepare measured angle to render
Definition d_measures.c:143
distance dist_ba
Definition d_measures.c:71
void set_measure_color(int selected, int id, int num)
set measure color
Definition d_measures.c:117
int num_bonds(int i)
number of distinct pair(s) of atoms in selection
Definition selection.c:183
int objects[3]
Definition selection.c:212
double arc_cos(double val)
compute arc cosinus
Definition ogl_utils.c:131
void unrotate_camera()
unrotate OpenGL camera
Definition ogl_draw.c:143
void fill_angle_model_row(int p, int a, int b, int c, GtkTreeStore *store)
fill angle tree store row
Definition w_measures.c:158
atom * td
Definition d_measures.c:70
atom_in_selection * tmp_c
Definition d_measures.c:69
ColRGBA col
Definition d_measures.c:77
int num_dihedrals(int i)
number of distinct quadruplet(s) of atoms in selection
Definition selection.c:207
void draw_bond_label(atom *at, atom *bt, int pi)
prepare a measured distance OpenGL rendering
Definition d_measures.c:438
void dihedrals_loop(glwin *view, int id, int pi, GtkTreeStore *store)
do things for the measured dihedrals selection
Definition d_measures.c:319
void setup_this_measured_bond(int s, int sa, int sb, int pi)
prepare measured distance to render
Definition d_measures.c:474
int ** tmp_object_id[3]
Definition selection.c:214
distance dist_bc
Definition d_measures.c:71
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
Definition initcoord.c:81
object_3d * measure
Definition d_measures.c:75
atom_in_selection * tmp_d
Definition d_measures.c:69
atom * te
Definition d_measures.c:70
void fill_dihedral_model_row(int p, int a, int b, int c, int d, GtkTreeStore *store)
fill dihedral tree store row
Definition w_measures.c:213
int prepare_measure_shaders(int type, int shaders)
prepare measure OpenGL rendering
Definition d_measures.c:608
int num_angles(int i)
number of distinct triplet(s) of atoms in selection
Definition selection.c:195
ColRGBA col_gdk
Definition d_measures.c:78
void angles_loop(glwin *view, int id, int pi, GtkTreeStore *store)
do things for the measured angles selection
Definition d_measures.c:204
void bonds_loop(glwin *view, int id, int pi, GtkTreeStore *store)
do things for the measured distances selection
Definition d_measures.c:530
atom * tf
Definition d_measures.c:70
atom * tc
Definition d_measures.c:70
int measures_drawing
Definition d_measures.c:67
atom * tb
Definition d_measures.c:70
int type_of_measure
Definition d_measures.c:66
void setup_line_vertice(float *vertices, vec3_t pos, ColRGBA col, float alpha)
fill the OpenGL data buffer for a line bond (or clone bond) to render
Definition d_bonds.c:265
void draw_angle_label(atom *at, atom *bt, atom *ct, int pi)
prepare an measured angle label OpenGL rendering
Definition d_measures.c:90
double dist
Definition d_measures.c:73
int * object_was_selected[3]
Definition selection.c:213
void fill_bond_model_row(int p, int a, int b, GtkTreeStore *store)
fill bond tree store row
Definition w_measures.c:109
atom * ta
Definition d_measures.c:70
atom_in_selection * tmp_a
Definition d_measures.c:69
void create_measures_lists()
prepare measure(s) OpenGL rendering
Definition d_measures.c:673
atom_in_selection * tmp_b
Definition d_measures.c:69
int * shift
Definition d_measures.c:72
int atoms[NUM_STYLES][2]
float val
Definition dlp_init.c:117
angle angle_3d(cell_info *cell, int mdstep, atom *at, atom *bt, atom *ct)
angle between atom a, b and c in 3D
Definition ogl_utils.c:179
distance distance_3d(cell_info *cell, int mdstep, atom *at, atom *bt)
distance between atom a and b in 3D
Definition ogl_utils.c:81
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:330
double pi
Definition global.c:195
int * allocint(int val)
allocate an int * pointer
Definition global.c:314
float * allocfloat(int val)
allocate a float * pointer
Definition global.c:398
Global variable declarations Global convenience function declarations Global data structure defin...
gboolean is_atom_win_active(glwin *view)
is the model edition window visible ?
Definition atom_edit.c:71
project * proj
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
image * plot
Definition ogl_draw.c:66
void at_unshift(atom *at, float *shift)
correct atomic coordinates modified to display image in cell replica
Definition ogl_draw.c:447
#define MAX_IN_SELECTION
Maximum number of atoms in selection to display measure information.
Definition glview.h:135
project * proj_gl
Definition ogl_draw.c:60
glwin * wingl
Definition ogl_draw.c:59
void at_shift(atom *at, float *shift)
modify atomic coordinates to display image in cell replica
Definition ogl_draw.c:432
@ EDITION
Definition glview.h:158
box_info * box_gl
Definition ogl_draw.c:64
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
int step
Definition ogl_draw.c:70
glsl_program * init_shader_program(int object, int object_id, const GLchar *vertex, const GLchar *geometry, const GLchar *fragment, GLenum type_of_vertices, int narray, int nunif, gboolean lightning, object_3d *obj)
create an OpenGL shader program
cell_info * cell_gl
Definition ogl_draw.c:65
shaders
The different types of shaders in the atomes program.
Definition glwin.h:88
@ MEASU
Definition glwin.h:99
#define NSELECTION
Definition glwin.h:67
double z
Definition ogl_draw.c:57
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
const GLchar * line_stipple_color
const GLchar * angle_stipple
const GLchar * angle_vertex
const GLchar * line_color
const GLchar * line_stipple
const GLchar * angle_color
const GLchar * line_vertex
Definition ogl_shaders.c:80
#define LINE_BUFF_SIZE
Definition ogl_shading.h:49
@ GLSL_LINES
Definition ogl_shading.h:40
void prepare_string(char *text, int id, ColRGBA col, vec3_t pos, float lshift[3], atom *at, atom *bt, atom *ct)
prepare a screen string to be rendered
Definition ogl_text.c:691
void render_all_strings(int glsl, int id)
render all string to be rendered for a label list
Definition ogl_text.c:549
float blue
Definition global.h:124
float alpha
Definition global.h:125
float red
Definition global.h:122
float green
Definition global.h:123
Definition glwin.h:114
double angle
Definition glwin.h:115
gboolean pbc
Definition glwin.h:116
Definition global.h:886
double z
Definition global.h:892
double y
Definition global.h:891
double x
Definition global.h:890
Definition glwin.h:875
Definition glwin.h:277
int b
Definition tab-1.c:95
int c
Definition tab-1.c:95
int d
Definition tab-1.c:95
int a
Definition tab-1.c:95
GtkWidget * img
Definition workspace.c:70