// 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(); } }
// 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(); } }