68extern void setup_this_atom (
int style, gboolean to_pick,
int picked,
atom * at,
int ac,
float * vert,
float al);
69extern void prepare_clone (
int style, gboolean to_pick,
int picked,
atom at,
atom bt,
float x,
float y,
float z,
float * vertices);
70extern void setup_this_bond (
int sty, gboolean to_pick, gboolean picked,
int cap,
int bi,
int pi,
atom * at,
atom * bt,
float al,
float * vertices);
95 doit = (
plot -> at_data[at].pick[
pi] &&
plot -> at_data[at].
style == style) ? TRUE : FALSE;
125 gboolean doit = FALSE;
129 if (
plot -> at_data[at].show[1] &&
plot -> at_data[at].style == style) doit = TRUE;
162 int i, j, k, l, m, n;
164 gboolean show_a, show_b, show_c, show_d;
168 show_a =
plot -> at_data[at].show[bi];
169 show_c =
plot -> at_data[at].pick[
pi];
178 if (show_a && show_c && m == sty)
185 show_b =
plot -> at_data[j].show[bi];
186 show_d =
plot -> at_data[j].pick[
pi];
197 if (sp == -1 || k == sp)
200 if ((bi &&
dist.pbc) ||(! bi && !
dist.pbc))
204 if ((! show_b || ! show_d) || (m != n)) l += 1 + bi;
232 if ((j == at && k == bt) || (j == bt && k == at))
return i;
264 tmp_a -> style = bt -> style;
277 tmp_a -> style = at -> style;
280 tmp_a ->
id = at -> id;
307 gboolean show_a, show_b, show_c, show_d;
310 show_a =
plot -> at_data[at].show[bi];
311 show_c =
plot -> at_data[at].pick[
pi];
320 if (show_a && show_c && l == sty)
327 show_b =
plot -> at_data[j].show[bi];
328 show_d =
plot -> at_data[j].pick[
pi];
339 if (sb == -1 || k == sb)
342 if ((bi &&
dist.pbc) ||(! bi && !
dist.pbc))
346 if ((! show_b || ! show_d) || (l != m))
383 sel =
plot -> selected[type] -> first;
386 for (i=0; i<clone; i++)
393 bonds[style][type] = (
npbds[style][type]) ? 1 : 0;
394 caps[style][type] = (
npcps[style][type]) ? 1 : 0;
398 sel =
plot -> selected[type] -> first;
401 for (i=0; i<clone; i++)
410 for (h=0; h<clone; h++)
416 npbds[style][type] +=
nbonds[style][type][h][i][j];
417 npcps[style][type] += (
nbonds[style][type][h][i][j]) ? 1 : 0;
422 caps[style][type] = 0;
446 for (h=0; h<clone; h++)
453 bonds[style][type] = (
npbds[style][type]) ? 1 : 0;
454 caps[style][type] = (
npcps[style][type]) ? 1 : 0;
462 for (h=0; h<clone; h++)
471 for (h=0; h<clone; h++)
477 npbds[style][type] +=
nbonds[style][type][h][i][j];
478 npcps[style][type] += (
nbonds[style][type][h][i][j]) ? 1 : 0;
483 caps[style][type] = 0;
509 cyl -> num_instances = (
bonds/2) * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
515 cap -> num_instances = (ncaps/2) * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
519 for (h=0; h<
caps+1; h++)
522 for (i=0; i<clone; i++)
524 sel =
plot -> selected[type] -> first;
525 for (j=0; j<
plot -> selected[type] -> selected; j++)
531 if (
sel -> next != NULL)
sel =
sel -> next;
548 for (h=0; h<clone; h++)
554 if (
nbonds[style][type][h][i][j])
556 cyl = g_malloc0 (
sizeof*cyl);
558 cyl -> num_vertices =
nbonds[style][type][h][i][j] * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
559 cyl -> vertices =
allocfloat (cyl -> vert_buffer_size*cyl -> num_vertices);
561 sel =
plot -> selected[type] -> first;
562 for (k=0; k<
plot -> selected[type] -> selected; k++)
568 if (
sel -> next != NULL)
sel =
sel -> next;
604 cyl -> num_instances = (
bonds/2) * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
610 cap -> num_instances = (ncaps/2) * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
614 for (h=0; h<
caps+1; h++)
617 for (i=0; i<clone; i++)
644 for (h=0; h<clone; h++)
650 if (
nbonds[style][type][h][i][j])
652 cyl = g_malloc0 (
sizeof*cyl);
654 cyl -> num_vertices =
nbonds[style][type][h][i][j] * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
655 cyl -> vertices =
allocfloat (cyl -> vert_buffer_size*cyl -> num_vertices);
693 gboolean sphere = TRUE;
694 gboolean cylinder = FALSE;
700 if (
bonds[style][type])
703 if (
plot -> selected[type] -> selected > 0)
711 g_free (
nbonds[style][type]);
723 atos = g_malloc0 (
sizeof*atos);
724 atos -> vert_buffer_size = 3;
725 atos -> num_vertices = 1;
727 atos -> vertices[0] = atos -> vertices[1] = atos -> vertices[2] = 0.0;
730 atos -> num_instances =
atoms[style][type] * (
plot -> extra_cell[0]+1)*(
plot -> extra_cell[1]+1)*(
plot -> extra_cell[2]+1);
735 if (
plot -> selected[type] -> selected)
737 sel =
plot -> selected[type] -> first;
738 for (j=0; j<
plot -> selected[type] -> selected; j++)
742 doit = (
plot -> at_data[
sel -> id].show[0] &&
plot -> at_data[
sel -> id].
style == style-1) ? TRUE : FALSE;
752 if (
sel -> next != NULL)
sel =
sel -> next;
755 if (
plot -> draw_clones)
758 sel =
plot -> selected[type] -> first;
759 for (j=0; j<
plot -> selected[type] -> selected; j++)
765 if (
sel -> next != NULL)
sel =
sel -> next;
775 doit = (
plot -> at_data[j].pick[type] &&
plot -> at_data[j].show[0] &&
plot -> at_data[j].
style == style-1) ? TRUE : FALSE;
786 if (
plot -> draw_clones)
822 if (
plot -> selected[type] -> selected)
824 sel =
plot -> selected[type] -> first;
825 for (j=0; j<
plot -> selected[type] -> selected; j++)
829 if (
plot -> at_data[
sel ->
id].show[0] &&
plot -> at_data[
sel ->
id].style == style) k ++;
835 if (
sel -> next != NULL)
sel =
sel -> next;
838 if (
plot -> draw_clones)
841 sel =
plot -> selected[type] -> first;
842 for (j=0; j<
plot -> selected[type] -> selected; j++)
845 if (
sel -> next != NULL)
sel =
sel -> next;
855 if (
plot -> draw_clones)
876 g_debug (
"Selected LIST");
879 gboolean cylinder = FALSE;
883 i = (
plot -> draw_clones) ? 2 : 1;
888 if (
plot -> selected[k] -> selected > 0 || (! k &&
wingl -> picked > 0))
896 nshaders += (
atoms[h][k]) ? 1 : 0;
901 if (
plot -> selected[k] -> selected > 0)
914 if (! nshaders)
return 0;
925 if (
plot -> selected[k] -> selected > 0 || (! k &&
wingl -> picked > 0))
944 g_debug (
"Pick LIST");
949 i = (
plot -> draw_clones) ? 2:1;
955 j +=
plot -> show_atom[k][l];
958 if (j == 0)
return 0;
964 k +=
plot -> at_data[i].show[0];
965 k +=
plot -> at_data[i].show[1];
973 if (k == 0)
return 0;
976 gboolean
bonds = FALSE;
988 int tmp_style =
plot -> style;
991 if (
wingl -> color_to_pick != NULL)
993 g_free (
wingl -> color_to_pick);
994 wingl -> color_to_pick = NULL;
996 wingl -> to_be_picked = 0;
1005 wingl -> bonds_to_be_picked = 0;
1008 plot -> style = tmp_style;
atom_in_selection * tmp_a
atom_in_selection * tmp_b
int create_bond_lists(gboolean to_pick)
prepare bond(s) and clone bond(s) OpenGL rendering
int find_selected_bond_vertices(int sty, int at, int sp, int bi, int pi, int cap)
find the number of selected bond(s) to render
int check_selection(int style, int type)
check selection : atom(s) in selection ?
int render_picked(int style, gboolean cylinder, int caps, int bonds, int ncaps, int type, int clone, int shader)
prepare the OpenGL rendering data of to be picked bond / clone bond
int get_clone_id(int at, int bt)
get the bond id of cloned bond
object_3d * draw_sphere(int quality)
OpenGL 3D sphere object rendering.
int *** nbonds[NUM_STYLES][2]
int find_selected_clone_vertices(int style, int at)
find the number of selected atom(s) to render
void setup_all_selected_bond_vertices(int sty, int cap, int bi, int at, int sb, int pi, float *vertices)
prepare the rendering of all selected bond(s)
void prepare_selected(int style, gboolean cylinder, int clone, int type)
prepare the list of selected bond(s) to render
void setup_selected_clone_vertices(int style, int at, int pi, float *vertices)
fill the OpenGL data buffer for a selected atom clone bonds to render
void setup_this_atom(int style, gboolean to_pick, int picked, atom *at, int ac, float *vert, float al)
void setup_this_bond(int sty, gboolean to_pick, gboolean picked, int cap, int bi, int pi, atom *at, atom *bt, float al, float *vertices)
prepare the OpenGL rendering data of a bond / clone bond
void setup_sphere_vertice(float *vertices, vec3_t pos, ColRGBA col, float rad, float alpha)
fill the OpenGL data buffer for a atom (or clone) to render
int create_pick_lists()
prepare the picking list OpenGL rendering
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
object_3d * draw_cylinder_cap(int quality, float rad, gboolean picked)
OpenGL 3D cylinder cap object rendering.
object_3d * draw_cylinder(int quality, float ra, float rb)
OpenGL 3D cylinder object rendering.
int prepare_selection_shaders(int style, int shaders, int clone, int type, gboolean do_bonds)
prepare selection shaders
void setup_cylinder_vertice(float *vertices, vec3_t pos_a, vec3_t pos_b, ColRGBA col, float rad, float alpha)
void create_atom_lists(gboolean to_pick)
prepare atom(s) and clone(s) OpenGL rendering
int create_selection_lists()
prepare the selected atom(s) and bond(s) OpenGL rendering
float get_bond_radius(int sty, int ac, int at, int b, int sel)
get bond (clone bond) radius
void prepare_clone(int style, gboolean to_pick, int picked, atom at, atom bt, float x, float y, float z, float *vertices)
prepare the rendering data of a clone
void setup_triangles(float *vertices, vec3_t sa, vec3_t sb, vec3_t sc)
setup triangle veertices
void prepare_picked(int style, gboolean cylinder, int clone, int type)
prepare the list of the bond that can be picked to render
void prepare_selected_bond(int sty, int cap, int bi, int pi, atom *at, atom *bt, float *vertices)
prepare the rendering of a selected bond
int render_selected(int style, gboolean cylinder, int caps, int bonds, int ncaps, int type, int clone, int shader)
prepare the OpenGL rendering data of to selected bond / clone bond
Variable declarations for the creation of the DL_POLY input file(s)
distance distance_3d(cell_info *cell, int mdstep, atom *at, atom *bt)
distance between atom a and b in 3D
int *** alloctint(int xal, int yal, int zal)
allocate an int *** pointer
gboolean in_movie_encoding
int * allocint(int val)
allocate an int * pointer
float * allocfloat(int val)
allocate a float * pointer
Global variable declarations Global convenience function declarations Global data structure defin...
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
atom * duplicate_atom(atom *at)
copy (partially) an atom data structure
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
shaders
The different types of shaders in the atomes program.
const GLchar * full_color
const GLchar * cylinder_vertex
const GLchar * line_color
const GLchar * cap_vertex
const GLchar * line_vertex
const GLchar * sphere_vertex
const GLchar * point_vertex
const GLchar * point_color