示例#1
0
文件: Scene.C 项目: tmd-gpat/MOLding
 DisplayColor(Displayable *d, const char *coloritemname, int colorindex)
 : Displayable(d), changed(0) {
   // Query the index of the Display color category, or add it if necessary
   colorCat = scene->category_index("Display");
   if (colorCat == -1) {
     colorCat = scene->add_color_category("Display");
   } 
   dcindex = scene->add_color_item(colorCat, coloritemname, colorindex);
   do_color_changed(colorCat);
 }
示例#2
0
//////////////////////////  constructor
Axes::Axes(DisplayDevice *d, Displayable *par) : Displayable(par), disp(d) {
  colorCat = (-1); // indicate we don't yet have a color object to use
  need_create_cmdlist = TRUE;
  movedAxes = FALSE;

  // initialize coordinates for axes lines
  origin[0] = yLine[0] = zLine[0] = 0.0;  
  xLineCap[1] = xLineCap[2] = 0.0;
  xLine[0] = AXESRODLEN; xLineCap[0] = 1.0;

  origin[1] = xLine[1] = zLine[1] = 0.0;  
  yLineCap[0] = yLineCap[2] = 0.0;
  yLine[1] = AXESRODLEN; yLineCap[1] = 1.0;

  origin[2] = xLine[2] = yLine[2] = 0.0;
  zLineCap[0] = zLineCap[1] = 0.0;
  zLine[2] = AXESRODLEN; zLineCap[2] = 1.0;

  xText[0] = AXESTXTLEN * xLine[0]; xText[1] = xLine[1]; xText[2] = xLine[2];
  yText[1] = AXESTXTLEN * yLine[1]; yText[0] = yLine[0]; yText[2] = yLine[2];
  zText[2] = AXESTXTLEN * zLine[2]; zText[0] = zLine[0]; zText[1] = zLine[1];
  
  // Displayable characteristics
  rot_on();
  glob_trans_off();
  cent_trans_off();
  
  // set scaling factor to a small amount
  scale_on();
  set_scale(0.25);
  scale_off();
  
  // put axes in lower left corner by default
  axesPos = AXES_LOWERLEFT;
  Aspect = (-1.0);

  colorCat = scene->add_color_category("Axes");
  
  // add components, and their default colors
  scene->add_color_item(colorCat, "X", AXESXCOL);
  scene->add_color_item(colorCat, "Y", AXESYCOL);
  scene->add_color_item(colorCat, "Z", AXESZCOL);
  scene->add_color_item(colorCat, "Origin", AXESOCOL);
  scene->add_color_item(colorCat, "Labels", AXESTCOL);

  do_color_changed(colorCat);
}
示例#3
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);
}
示例#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
void Displayable::color_changed(int cat) {
  do_color_changed(cat);
  for (int i=0; i<num_children; i++) child(i)->color_changed(cat);
}