64extern void setup_this_atom (
int style, gboolean to_pick,
int picked,
atom * at,
int ac,
float * vert,
float al);
65extern void prepare_clone (
int style, gboolean to_pick,
int picked,
atom at,
atom bt,
float x,
float y,
float z,
float * vertices);
66extern 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);
93 doit = (
plot -> at_data[at].pick[
pi] &&
plot -> at_data[at].style == style) ? TRUE : FALSE;
123 gboolean doit = FALSE;
127 if (
plot -> at_data[at].show[1] &&
plot -> at_data[at].style == style) doit = TRUE;
160 int i, j, k, l, m, n;
162 gboolean show_a, show_b, show_c, show_d;
166 show_a =
plot -> at_data[at].show[bi];
167 show_c =
plot -> at_data[at].pick[
pi];
168 m =
plot -> at_data[at].style;
176 if (show_a && show_c && m == sty)
183 show_b =
plot -> at_data[j].show[bi];
184 show_d =
plot -> at_data[j].pick[
pi];
185 n =
plot -> at_data[j].style;
195 if (sp == -1 || k == sp)
198 if ((bi &&
dist.pbc) ||(! bi && !
dist.pbc))
202 if ((! show_b || ! show_d) || (m != n)) l += 1 + bi;
230 if ((j == at && k == bt) || (j == bt && k == at))
return i;
262 tmp_a -> style = bt -> style;
275 tmp_a -> style = at -> style;
278 tmp_a ->
id = at -> id;
305 gboolean show_a, show_b, show_c, show_d;
308 show_a =
plot -> at_data[at].show[bi];
309 show_c =
plot -> at_data[at].pick[
pi];
310 l =
plot -> at_data[at].style;
318 if (show_a && show_c && l == sty)
325 show_b =
plot -> at_data[j].show[bi];
326 show_d =
plot -> at_data[j].pick[
pi];
327 m =
plot -> at_data[j].style;
337 if (sb == -1 || k == sb)
340 if ((bi &&
dist.pbc) ||(! bi && !
dist.pbc))
344 if ((! show_b || ! show_d) || (l != m))
381 sel =
plot -> selected[type] -> first;
384 for (i=0; i<clone; i++)
391 bonds[style][type] = (
npbds[style][type]) ? 1 : 0;
392 caps[style][type] = (
npcps[style][type]) ? 1 : 0;
396 sel =
plot -> selected[type] -> first;
399 for (i=0; i<clone; i++)
408 for (h=0; h<clone; h++)
414 npbds[style][type] +=
sbonds[style][type][h][i][j];
415 npcps[style][type] += (
sbonds[style][type][h][i][j]) ? 1 : 0;
420 caps[style][type] = 0;
444 for (h=0; h<clone; h++)
451 bonds[style][type] = (
npbds[style][type]) ? 1 : 0;
452 caps[style][type] = (
npcps[style][type]) ? 1 : 0;
460 for (h=0; h<clone; h++)
469 for (h=0; h<clone; h++)
475 npbds[style][type] +=
sbonds[style][type][h][i][j];
476 npcps[style][type] += (
sbonds[style][type][h][i][j]) ? 1 : 0;
481 caps[style][type] = 0;
508 cyl -> num_instances = (
bonds/2) * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
514 cap -> num_instances = (ncaps/2) * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
518 for (h=0; h<
caps+1; h++)
521 for (i=0; i<clone; i++)
523 sel =
plot -> selected[type] -> first;
524 for (j=0; j<
plot -> selected[type] -> selected; j++)
530 if (
sel -> next != NULL)
sel =
sel -> next;
537 int narray_sel =
plot -> ray_tracing ? 8 : 6;
543 GLenum prim_sel_cap =
plot -> ray_tracing ? GL_TRIANGLE_STRIP : GL_TRIANGLE_FAN;
550 for (h=0; h<clone; h++)
556 if (
sbonds[style][type][h][i][j])
558 cyl = g_malloc0(
sizeof*cyl);
560 cyl -> num_vertices =
sbonds[style][type][h][i][j] * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
561 cyl -> vertices =
allocfloat (cyl -> vert_buffer_size*cyl -> num_vertices);
563 sel =
plot -> selected[type] -> first;
564 for (k=0; k<
plot -> selected[type] -> selected; k++)
570 if (
sel -> next != NULL)
sel =
sel -> next;
605 cyl -> num_instances = (
bonds/2) * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
611 cap -> num_instances = (ncaps/2) * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
615 for (h=0; h<
caps+1; h++)
618 for (i=0; i<clone; i++)
640 GLenum prim_cap = (
plot -> ray_tracing) ? GL_TRIANGLE_STRIP : GL_TRIANGLE_FAN;
647 for (h=0; h<clone; h++)
653 if (
sbonds[style][type][h][i][j])
655 cyl = g_malloc0(
sizeof*cyl);
657 cyl -> num_vertices =
sbonds[style][type][h][i][j] * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
658 cyl -> vertices =
allocfloat (cyl -> vert_buffer_size*cyl -> num_vertices);
695 gboolean sphere = TRUE;
696 gboolean cylinder = FALSE;
708 atos = g_malloc0(
sizeof*atos);
709 atos -> vert_buffer_size = 3;
710 atos -> num_vertices = 1;
712 atos -> vertices[0] = atos -> vertices[1] = atos -> vertices[2] = 0.0;
715 atos -> num_instances =
atoms[style][type] * (
plot -> abc -> extra_cell[0]+1)*(
plot -> abc -> extra_cell[1]+1)*(
plot -> abc -> extra_cell[2]+1);
720 if (
plot -> selected[type] -> selected)
722 sel =
plot -> selected[type] -> first;
723 for (j=0; j<
plot -> selected[type] -> selected; j++)
727 doit = (
plot -> at_data[
sel -> id].show[0] &&
plot -> at_data[
sel -> id].style == style-1) ? TRUE : FALSE;
737 if (
sel -> next != NULL)
sel =
sel -> next;
740 if (
plot -> draw_clones)
743 sel =
plot -> selected[type] -> first;
744 for (j=0; j<
plot -> selected[type] -> selected; j++)
750 if (
sel -> next != NULL)
sel =
sel -> next;
760 doit = (
plot -> at_data[j].pick[type] &&
plot -> at_data[j].show[0] &&
plot -> at_data[j].style == style-1) ? TRUE : FALSE;
771 if (
plot -> draw_clones)
796 if (
bonds[style][type])
799 if (
plot -> selected[type] -> selected > 0)
807 for (i=0; i<((
plot -> draw_clones) ? 2 : 1); i++)
809 if (
sbonds[style][type][i])
813 g_free (
sbonds[style][type][i][j]);
814 sbonds[style][type][i][j] = NULL;
816 g_free (
sbonds[style][type][i]);
817 sbonds[style][type][i] = NULL;
822 g_free (
sbonds[style][type]);
823 sbonds[style][type] = NULL;
843 if (
plot -> selected[type] -> selected)
845 sel =
plot -> selected[type] -> first;
846 for (j=0; j<
plot -> selected[type] -> selected; j++)
850 if (
plot -> at_data[
sel ->
id].show[0] &&
plot -> at_data[
sel ->
id].style == style) k ++;
856 if (
sel -> next != NULL)
sel =
sel -> next;
859 if (
plot -> draw_clones)
862 sel =
plot -> selected[type] -> first;
863 for (j=0; j<
plot -> selected[type] -> selected; j++)
866 if (
sel -> next != NULL)
sel =
sel -> next;
876 if (
plot -> draw_clones)
897 g_debug (
"Selected LIST");
900 gboolean cylinder = FALSE;
904 i = (
plot -> draw_clones) ? 2 : 1;
910 if (
plot -> selected[k] -> selected > 0 || (! k &&
wingl -> picked > 0))
918 nshaders += (
atoms[h][k]) ? 1 : 0;
923 if (
plot -> selected[k] -> selected > 0)
941 if (! nshaders)
return 0;
952 if (
plot -> selected[k] -> selected > 0 || (! k &&
wingl -> picked > 0))
972 g_debug (
"Pick LIST");
977 i = (
plot -> draw_clones) ? 2:1;
983 j +=
plot -> show_atom[k][l];
986 if (j == 0)
return 0;
992 k +=
plot -> at_data[i].show[0];
993 k +=
plot -> at_data[i].show[1];
1001 if (k == 0)
return 0;
1004 gboolean
bonds = FALSE;
1016 int tmp_style =
plot -> style;
1019 if (
wingl -> color_to_pick != NULL)
1021 g_free (
wingl -> color_to_pick);
1022 wingl -> color_to_pick = NULL;
1024 wingl -> to_be_picked = 0;
1030 gboolean saved_ray =
plot -> ray_tracing;
1031 plot -> ray_tracing = FALSE;
1036 wingl -> bonds_to_be_picked = 0;
1039 plot -> ray_tracing = saved_ray;
1040 plot -> style = tmp_style;
object_3d * draw_billboard_quad()
create a camera-aligned billboard quad proxy for perfect impostors.
atom_in_selection * tmp_a
atom_in_selection * tmp_b
int *** sbonds[NUM_STYLES][2]
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_billboard_quad(void)
create a camera-aligned billboard quad proxy for perfect impostors.
object_3d * draw_sphere(int quality)
OpenGL 3D sphere object rendering.
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
float get_sphere_radius(int style, int sp, int ac, int sel)
get an atom sphere radius
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
int create_pick_lists()
prepare the picking list OpenGL rendering
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 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 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 the 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 * free_atom(atom *at)
free an atom data structure
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 * cap_vertex_ray
const GLchar * cylinder_vertex
const GLchar * full_color_ray
const GLchar * cylinder_vertex_ray
const GLchar * line_color
const GLchar * cap_vertex
const GLchar * line_vertex
const GLchar * sphere_vertex
const GLchar * point_vertex
const GLchar * point_color
const GLchar * sphere_vertex_ray
void allocate_instances(object_3d *object)
allocate the instances buffer of a 3D object