99 g_debug (
"*** Print Matrices ***");
101 g_debug (
":: MODEL_MATRIX");
102 m4_print (
wingl -> model_matrix);
104 g_debug (
":: VIEW_MATRIX");
105 m4_print (
wingl -> view_matrix);
107 g_debug (
":: MODEL_VIEW_MATRIX");
108 m4_print (
wingl -> model_view_matrix);
110 g_debug (
":: NORMAL_MATRIX");
111 m4_print (
wingl -> normal_matrix);
113 g_debug (
":: PROJECTION_MATRIX");
114 m4_print (
wingl -> projection_matrix);
116 g_debug (
":: PROJECTION_MODEL_VIEW_MATRIX");
117 m4_print (
wingl -> proj_model_view_matrix);
129 wingl -> proj_model_matrix = m4_mul (
wingl -> projection_matrix,
wingl -> model_matrix);
130 wingl -> view_matrix = m4_quat_rotation (
plot -> rotation_quaternion);
132 quat =
plot -> rotation_quaternion;
134 wingl -> un_view_matrix = m4_quat_rotation (quat);
135 wingl -> model_view_matrix = m4_mul (
wingl -> model_matrix,
wingl -> view_matrix);
136 wingl -> normal_matrix = m4_transpose (m4_invert_affine(
wingl -> model_matrix));
137 wingl -> proj_model_view_matrix = m4_mul (
wingl -> projection_matrix,
wingl -> model_view_matrix);
138 wingl -> proj_view_matrix = m4_mul (
wingl -> projection_matrix,
wingl -> view_matrix);
139 wingl -> view_model_matrix = m4_mul (
wingl -> view_matrix,
wingl -> model_matrix);
151 quat =
plot -> rotation_quaternion;
153 wingl -> model_view_matrix = m4_mul (
wingl -> model_view_matrix, m4_quat_rotation (quat));
166 new_s -> word = g_strdup_printf (
"%s", old_s -> word);
167 new_s ->
col = old_s ->
col;
169 for (i=0; i<3; i++) new_s ->
shift[i] = old_s ->
shift[i];
170 new_s -> num_instances = old_s -> num_instances;
171 new_s -> instances =
duplicate_float (old_s -> num_instances*4, old_s -> instances);
172 new_s -> prev = NULL;
173 new_s -> last = NULL;
188 new_mat -> predefine = old_mat -> predefine;
189 new_mat -> albedo = old_mat -> albedo;
191 for (i=0; i<6; i++) new_mat ->
param[i] = old_mat ->
param[i];
205 new_fog -> mode = old_fog -> mode;
206 new_fog -> based = old_fog -> based;
207 new_fog -> density = old_fog -> density;
209 for (i=0; i<2; i++) new_fog -> depth[i] = old_fog -> depth[i];
223 new_img -> quality = old_img -> quality;
226 new_img -> l_ghtning.lights = old_img -> l_ghtning.lights;
227 new_img -> l_ghtning.spot =
copy_light_sources (old_img -> l_ghtning.lights, old_img -> l_ghtning.lights, old_img -> l_ghtning.spot);
246 new_lab -> font = g_strdup_printf (
"%s", old_lab -> font);
247 new_lab ->
color = NULL;
249 for (i=0; i<3; i++) new_lab ->
shift[i] = old_lab ->
shift[i];
250 new_lab -> n_colors = old_lab -> n_colors;
251 if (old_lab ->
color != NULL)
255 new_lab -> list = NULL;
256 if (old_lab -> list != NULL)
260 stmp_a = old_lab -> list -> last;
261 stmp_b = new_lab -> list -> last;
262 while (stmp_a -> prev != NULL)
265 stmp_b -> prev -> last = stmp_b -> last;
266 stmp_a = stmp_a -> prev;
267 stmp_b = stmp_b -> prev;
282 image * new_img = g_malloc0 (
sizeof*new_img);
285 * new_img = * old_img;
287 new_img -> back = g_malloc0(
sizeof*new_img -> back);
292 new_img -> color_map[i] = old_img -> color_map[i];
293 new_img -> show_atom[i] =
duplicate_bool(j, old_img -> show_atom[i]);
294 new_img -> show_label[i] =
duplicate_bool(j, old_img -> show_label[i]);
300 new_img -> bondrad = g_malloc0 (2*j*
sizeof*new_img -> bondrad);
301 new_img -> linerad = g_malloc0 (2*j*
sizeof*new_img -> linerad);
303 for (i=0; i<2*j; i++)
312 if (i < 2 || i > 3) new_img -> show_poly[i] =
duplicate_bool(
coord_gl -> totcoord[i], old_img -> show_poly[i]);
313 k = (i < 2) ?
proj_gl -> nspec : 1;
314 new_img -> spcolor[i] = g_malloc (k*
sizeof*new_img -> spcolor[i]);
320 new_img -> at_data = g_malloc0 (
proj_gl -> natomes*
sizeof*new_img -> at_data);
321 for (i=0; i<
proj_gl -> natomes; i++)
334 new_img -> xyz -> title[i] = g_strdup_printf (
"%s", old_img -> xyz -> title[i]);
336 new_img -> xyz ->
color = NULL;
337 if (old_img -> xyz ->
color != NULL)
353 if (
wingl -> ring_max[i])
356 for (j=0; j<
coord_gl -> totcoord[i+4]; j++)
359 for (l=0; l<
wingl -> num_rings[i][
step][k-1]; l++)
361 if (
wingl -> show_rpoly[i][
step][k-1][l]) m++;
366 new_img -> i_rings[i] =
allocdint (m+1, 2);
367 new_img -> i_rings[i][0][0] = m;
369 for (j=0; j<
coord_gl -> totcoord[i+4]; j++)
372 for (l=0; l<
wingl -> num_rings[i][
step][k-1]; l++)
374 if (
wingl -> show_rpoly[i][
step][k-1][l])
376 new_img -> i_rings[i][m][0] = j;
377 new_img -> i_rings[i][m][1] = l;
395 for (k=0; k<
coord_gl -> totcoord[2+i]; k++)
397 new_img -> fm_vol_col[i][j][k] = old_img -> fm_vol_col[i][j][k];
412 snapshot * nextsnap = g_malloc0 (
sizeof*nextsnap);
414 nextsnap ->
img ->
id ++;
417 if (
wingl -> anim -> frames == 0)
419 wingl -> anim -> first -> prev = NULL;
420 wingl -> anim -> last = nextsnap;
421 wingl -> anim -> last -> prev = NULL;
422 wingl -> anim -> first = nextsnap;
427 wingl -> anim -> last -> next = nextsnap;
428 nextsnap -> prev =
wingl -> anim -> last;
429 wingl -> anim -> last =
wingl -> anim -> last -> next;
430 wingl -> anim -> last ->
img ->
id =
wingl -> anim -> frames;
432 wingl -> anim -> frames += 1;
446 atom * bt = g_malloc0 (
sizeof*bt);
452 bt -> style = at -> style;
453 bt -> cloned = at -> cloned;
457 bt -> show[i] = at -> show[i];
463 bt -> coord[i] = at -> coord[i];
465 bt -> numv = at -> numv;
466 bt -> fid = at -> fid;
467 bt -> faid = at -> faid;
468 if (bt -> numv) bt -> vois =
duplicate_int (bt -> numv, at -> vois);
549 if (
plot -> back -> gradient)
wingl -> create_shaders[
BACKG] = TRUE;
559 if (
wingl -> to_pick)
562 glDisable (GL_LIGHTING);
567 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
571 glEnable (GL_LIGHTING);
580 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
double scale(double axe)
find appropriate major tick spacing based on axis length
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Variable declarations for the creation of the DL_POLY input file(s)
int * duplicate_int(int num, int *old_val)
copy a list of int
float * duplicate_float(int num, float *old_val)
copy a list of float
gboolean * duplicate_bool(int num, gboolean *old_val)
copy a list of gboolean
int ** allocdint(int xal, int yal)
allocate an int ** pointer
double * duplicate_double(int num, double *old_val)
copy a list of double
Global variable declarations Global convenience function declarations Global data structure defin...
ColRGBA * duplicate_color(int num, ColRGBA *col)
duplicate a ColRGBA pointer
project * get_project_by_id(int p)
get project pointer using id number
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
void draw_vertices(int id)
Draw OpenGL shader program.
screen_string * duplicate_screen_string(screen_string *old_s)
create a copy a screen_string data structure
void create_background_lists()
prepare background OpenGL rendering
atom_selection * duplicate_ogl_selection(atom_selection *old_sel)
copy an atom selection
Light * copy_light_sources(int dima, int dimb, Light *old_sp)
create a copy of a list of light sources
int create_bond_lists(gboolean to_pick)
prepare bond(s) and clone bond(s) OpenGL rendering
void print_matrices()
print OpenGL matrices
void draw(glwin *view)
main drawing subroutine for the OpenGL window
int create_box_lists(int b_step)
prepare box OpenGL rendering
void at_unshift(atom *at, float *shift)
correct atomic coordinates modified to display image in cell replica
void unrotate_camera()
unrotate OpenGL camera
void duplicate_material(Material *new_mat, Material *old_mat)
duplicate material data
void create_ring_lists()
prepare ring(s) polyhedra OpenGL rendering
void duplicate_screen_label(screen_label *new_lab, screen_label *old_lab)
copy screen_label data structure
image * duplicate_image(image *old_img)
create a copy of an image data structure
void create_slab_lists(project *this_proj)
prepare slab(s) OpenGL rendering
void at_shift(atom *at, float *shift)
modify atomic coordinates to display image in cell replica
void create_light_lists()
prepare light(s) OpenGL rendering
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
void duplicate_material_and_lightning(image *new_img, image *old_img)
copy the material and lightning parameters of an image data structure
void create_volumes_lists()
prepare volume(s) OpenGL rendering
void setup_camera()
setup OpenGL camera
int create_label_lists()
prepare atomic label(s) OpenGL rendering
void update_gl_pick_colors()
int create_pick_lists()
prepare the picking list OpenGL rendering
int create_axis_lists()
prepare axis OpenGL rendering
void duplicate_fog(Fog *new_fog, Fog *old_fog)
duplicate fog data
void create_poly_lists()
prepare coordination polyhedra(s) OpenGL rendering
atom * duplicate_atom(atom *at)
copy (partially) an atom data structure
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
void add_image()
add an image to the animation
void create_measures_lists()
prepare measure(s) OpenGL rendering
void duplicate_background_data(background *new_back, background *old_back)
duplicate background data structure
Preference variable declarations.