Exemplo n.º 1
0
gint read_dmol(gchar *filename, struct model_pak *model)
{
gint flag;
FILE *fp;

/* checks */
g_return_val_if_fail(model != NULL, 1);
g_return_val_if_fail(filename != NULL, 2);

fp = fopen(filename,"rt");
if (!fp)
  return(3);

/* loop while there's data */
flag=0;
model->num_frames = 0;

read_dmol_frame(fp, model);

for (;;)
  {
  add_frame_offset(fp, model);

  if (read_dmol_frame(fp, NULL))
    break;

  model->num_frames++;
  }

/* get rid of frame list if only one frame */
if (model->num_frames == 1)
  {
  free_list(model->frame_list);
  model->frame_list = NULL;
  }

/* model setup */
strcpy(model->filename, filename);
g_free(model->basename);
model->basename = parse_strip(filename);
model_prep(model);

return(0);
}
Exemplo n.º 2
0
gint read_dmol(gchar *filename, struct model_pak *model)
{
gint flag;
FILE *fp;

/* checks */
g_return_val_if_fail(model != NULL, 1);
g_return_val_if_fail(filename != NULL, 2);

fp = fopen(filename,"rt");
if (!fp)
  return(3);

/* loop while there's data */
flag=0;
model->num_frames = 0;

read_dmol_frame(fp, model);

for (;;)
  {
  if (read_dmol_frame(fp, NULL))
    break;

  animate_frame_store(model);
  }

/* model setup */
model_prep(model);

g_free(model->filename);
model->filename = g_strdup(filename);

g_free(model->basename);
model->basename = parse_strip(filename);

fclose(fp);

return(0);
}