Пример #1
0
////////////////////////  constructor  /////////////////////////
GeometryList::GeometryList(VMDApp *vmdapp, Displayable *disp)
  : Displayable(disp) {

  // indicate we don't yet have a color object to use
  colorCat = (-1);

  // save the list of molecules to use for data
  app = vmdapp;

  // default size of text labels is 1.0 (no scaling)
  labelsize = 1.0f;
  labelthickness = 1.0f;

  // create default lists for atom, bond, angle, and dihedral measurements
  add_geom_list("Atoms", ATOMGEOMCOL);
  add_geom_list("Bonds", BONDGEOMCOL);
  add_geom_list("Angles", ANGLEGEOMCOL);
  add_geom_list("Dihedrals", DIHEGEOMCOL);
  add_geom_list("Springs", SPRINGGEOMCOL);

  colorCat = scene->add_color_category("Labels");
  for (int i=0; i<num_lists(); i++) {
    scene->add_color_item(colorCat, geomLists.name(i), 
        geomLists.data(i)->defaultColor);
  }

  // Displayable characteristics
  rot_off();
  scale_off();
  glob_trans_off();
  cent_trans_off();
}
Пример #2
0
/// And now the class definition
VMDTitle::VMDTitle(DisplayDevice *d, Displayable *par) 
: Displayable(par), disp(d) {
  // displayable characteristics
  rot_off();
  scale_off();
  glob_trans_off();
  cent_trans_off();
  letterson = TRUE;
  redraw_list();
  
  glob_trans_on();
  set_glob_trans(0, 0.5, 0);
  glob_trans_off();
  starttime = time_of_day();
}
Пример #3
0
// routine to prepare the displayable object; must set the origin properly
void Stage::prepare() {
  float rot_amount = 0.0, strans[3];
  char rot_axes = 'z';
  
  strans[0] = strans[1] = strans[2] = 0.0;
  
  // move the stage to its proper position
  if (need_update && stagePos != NO_STAGE) {
    if (stagePos == STAGE_ORIGIN) {
      ;
    } else if(stagePos == STAGE_LOWER) {
      strans[1] = -1.0;
    } else if(stagePos == STAGE_UPPER) {
      strans[1] = 1.0;
    } else if(stagePos == STAGE_LEFT) {
      strans[0] = -1.0;
      rot_amount = -90.0;
    } else if(stagePos == STAGE_RIGHT) {
      strans[0] = 1.0;
      rot_amount = 90.0;
    } else if(stagePos == STAGE_BEHIND) {
      strans[2] = -1.0;
      rot_axes = 'x';
      rot_amount = 90.0;
    } else {
      msgErr << "Stage: Illegal stage location " << stagePos << " specified."
             << sendmsg;
      stagePos = STAGE_ORIGIN;
      return;
    }

    // update the current transformation
    need_update = FALSE;
    
    // (re)create the command list
    create_cmdlist();

    // reset tranformation
    glob_trans_on();
    rot_on();
    reset_transformation();
    set_glob_trans(strans[0], strans[1], strans[2]);
    add_rot(rot_amount, rot_axes);
    rot_off();
    glob_trans_off();
  }
}
Пример #4
0
FPS::FPS(DisplayDevice *d, Displayable *par) 
: Displayable(par), disp(d) {
  last_update = time_of_day(); // setup time of day with initial value
  loop_count = 0;

  // disable transformations on this displayable
  rot_off();
  glob_trans_off();
  cent_trans_off();
  scale_off();

  // set the text color category, index, etc. 
  colorCat = scene->add_color_category("Display");
  if (colorCat < 0)
    colorCat = scene->category_index("Display");

  usecolor = scene->add_color_item(colorCat, "FPS", REGWHITE);
  do_color_changed(colorCat);
}
Пример #5
0
Stage::Stage(Displayable *disp) : Displayable(disp) {

  // Displayable characteristics
  rot_off();
  scale_off();
  glob_trans_off();
  cent_trans_off();
  
  // put stage in lower part of image by default
  Panels = 0;
  panels(STAGE_PANELS);		// really sets the panels, and panel size
  stagePos = STAGEPOS_TOTAL;    // (inits value so purify doesn't complain)
  location(NO_STAGE);	        // position the stage

  colorCat = scene->add_color_category("Stage");
  scene->add_color_item(colorCat, "Even", STAGEEVENCOL);
  scene->add_color_item(colorCat, "Odd", STAGEODDCOL);

  do_color_changed(colorCat);
}
Пример #6
0
void VMDTitle::prepare() {
  double elapsed = time_of_day() - starttime;
  double delta;

  // Prevent the title screen from hogging the CPU/GPU when there's
  // nothing else going on.  This is particularly important for users
  // that start VMD and immediately start using Multiseq with no structure
  // data loaded at all.
  vmd_msleep(1); // sleep for 1 millisecond or more

  if (elapsed < 5 + 3) {  // display the title screen, no animation
    if (!letterson) {
      letterson = TRUE;
      redraw_list();
    }
    return;
  }

  elapsed -= 3;
  if (letterson) {
    letterson = FALSE;
    redraw_list();
  }

  if (elapsed < 30) { // just spin the VMD logo
    delta = elapsed - 5;
    rot_on();
    set_rot(solve_position((float) delta, 25.0f, 0.0f, 360.0f*8.0f), 'y');
    rot_off();
  }

  if (elapsed < 15) { 
    delta = elapsed - 5;
    scale_on();
    set_scale( 1.0f/(1.0f+ ((float) delta)/3.0f)); // and getting smaller
    scale_off();
    glob_trans_on();

    // and moving up
    set_glob_trans(0, 0.5f, solve_position((float) delta, 10.0f, 0.0f, 0.5f)); 
    glob_trans_off();
    return;
  }

  if (elapsed < 20) {
    return;
  }

  // I am at          ( 0  ,  0.5, 0.5)
  // I want to get to ( -.7  ,  0.9  , 0.5) in 10 secs
  if (elapsed < 30) {
    delta = elapsed - 20;
    glob_trans_on();
    set_glob_trans(
       solve_position((float) delta, 10.0f, 0.0f, -0.6f * disp->aspect()),
       solve_position((float) delta, 10.0f, 0.5f, 0.8f),
       solve_position((float) delta, 10.0f, 0.5f, 0.5f));
    glob_trans_off();
    scale_on();
    set_scale(solve_position((float) delta, 10.0f, 1.0f/(1.0f+10.0f/3.0f), 0.25f));
    scale_off();
    return;
  }

  if (elapsed < 35) 
    return;

  // just spin the VMD logo
  delta = elapsed - 35;
  rot_on();
  set_rot((float) delta * 360.0f / 6.0f, 'y');  
  rot_off();
}