예제 #1
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();
  }
}
예제 #2
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);
}
예제 #3
0
// routine to prepare the displayable object; must set the origin properly
void Axes::prepare() {
  float asp, xpos, ypos;
  float poscale = 0.95f;

  // recreate command list if needed
  if (need_create_cmdlist)
    create_cmdlist();

  if (axesPos == NO_AXES || movedAxes) {
    return; // don't update/modify the Axes position
  }
  
  if ((asp = disp->aspect()) != Aspect) {
    // move the axes to their proper position
    switch (axesPos) {
      case AXES_LOWERLEFT:
        xpos = -poscale * asp;
        ypos = -poscale;
        break;
      case AXES_LOWERRIGHT:
        xpos = poscale * asp;
        ypos = -poscale;
        break;
      case AXES_UPPERLEFT:
        xpos = -poscale * asp;
        ypos = poscale;
        break;
      case AXES_UPPERRIGHT:
        xpos = poscale * asp;
        ypos = poscale;
        break;
      default:
        xpos = ypos = 0.0;
    }

    // update the current transformation
    Aspect = asp;
    glob_trans_on();
    set_glob_trans(xpos, ypos, 0.0);
    glob_trans_off();
  }
}
예제 #4
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);
}
예제 #5
0
// called when a pick moves:
//   args = display to use, obj picked, button, mode, tag, dim, pos
// For 2D version: x & y are 0 ... 1, represent 'relative, scaled' coords.
// For 3D version: x,y,z are transformed position of pointer
// For the Axes, when they are selected and the pointer moves, we wish
// to move the axes as well.
void Axes::pick_move(PickMode *, DisplayDevice *d, 
                     int, int dim, const float *pos) {
  float moveAxesOrigPos[3], newAxesOrigPos[3];
  const float *newpos;

  // calculate amount to translate axes
  if (dim == 2) {
    tm.multpoint3d(origin, moveAxesOrigPos);
    d->find_3D_from_2D(moveAxesOrigPos, pos, newAxesOrigPos);
    newpos = newAxesOrigPos;
  } else {
    newpos = pos;
  }
  
  // apply transformation
  glob_trans_on();
  set_glob_trans(newpos[0], newpos[1], newpos[2]);
  glob_trans_off();
  
  movedAxes = TRUE;
}
예제 #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();
}