Changeset 727 for trunk


Ignore:
Timestamp:
Feb 18, 2008, 6:26:55 PM (16 years ago)
Author:
garnier
Message:

correction du ticket #65. Pb sur autorotation et reouverture partielle du ticket #120

Location:
trunk/geant4/visualization/OpenGL/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r725 r727  
    291291  ,fContextMenu(0)
    292292  ,fMouseAction(STYLE1)
    293   ,fDeltaRotation(1)
     293  ,fDeltaRotation(0.5)
    294294  ,fDeltaSceneTranslation(0.01)
    295295  ,fDeltaDepth(0.01)
     
    14831483{
    14841484  fAutoMove = mAutoMove;
    1485 #ifdef GEANT4_QT_DEBUG
    1486   printf("                   mouse move event %d %d\n",pos_x,pos_y);
    1487 #endif
    14881485
    14891486  if (!fAutoMove) {  // keep old delta if automove
     
    15131510  }
    15141511  fLastPos = QPoint(pos_x, pos_y);
    1515 #ifdef GEANT4_QT_DEBUG
    1516   if (mButtons & Qt::LeftButton) {
    1517     printf("                  end of  mouse move event %d %d delta:%f %f\n",pos_x,pos_y,fDeltaPosX,fDeltaPosY);
    1518   } else {
    1519     printf("                  end of  mouse move event %d %d delta:%f %f --------------NO BUTTON\n",pos_x,pos_y,fDeltaPosX,fDeltaPosY);
    1520   }
    1521 #endif
    15221512}
    15231513
     
    16161606 
    16171607    new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
    1618  
     1608
     1609    // to avoid z rotation flipping
     1610    // to allow more than 360° rotation
    16191611    if (fVP.GetLightsMoveWithCamera()) {
    16201612      new_up = (new_vp.cross(yprime)).unit();
    1621       fVP.SetUpVector(new_up);
     1613      if (new_vp.z()*vp.z() <0) {
     1614        new_up.set(new_up.x(),-new_up.y(),new_up.z());
     1615      }
    16221616    } else {
    16231617      new_up = up;
    1624     }
     1618      if (new_vp.z()*vp.z() <0) {
     1619        new_up.set(new_up.x(),-new_up.y(),new_up.z());
     1620      }
     1621    }
     1622    fVP.SetUpVector(new_up);
    16251623    ////////////////
    16261624    // Rotates by fixed azimuthal angle delta_theta.
     
    16391637    viewPoint = new_vp.unit() + delta;
    16401638   
     1639#ifdef GEANT4_QT_DEBUG
     1640//     printf("vp Vector : %f %f %f delta_alpha:%f delta_theta:%f cosalpha:%f sinalpha:%f\n",viewPoint.x(),viewPoint.y(),viewPoint.z(),delta_alpha,delta_theta,cosalpha,sinalpha);
     1641//     printf("up : %f %f %f\n",up.x(),up.y(),up.z());
     1642//     printf("new up : %f %f %f\n",new_up.x(),new_up.y(),new_up.z());
     1643//     printf("vp : %f %f %f\n",vp.x(),vp.y(),vp.z());
     1644//     printf("new_vp : %f %f %f\n",new_vp.x(),new_vp.y(),new_vp.z());
     1645#endif
    16411646    fVP.SetViewAndLights (viewPoint);
    16421647    updateQWidget();
     
    19941999#endif
    19952000    if (event->key() == Qt::Key_Plus) {
    1996       fDeltaPosX =fDeltaPosX*(1+fDeltaMove);
    1997       fDeltaPosY =fDeltaPosY*(1+fDeltaMove);
     2001      fDeltaPosX =fDeltaPosX*(1+fDeltaRotation);
     2002      fDeltaPosY =fDeltaPosY*(1+fDeltaRotation);
     2003      printf("rotate + %f %f\n",fDeltaPosX,fDeltaPosY);
    19982004    }
    19992005    else if (event->key() == Qt::Key_Minus) {
    2000       fDeltaPosX =fDeltaPosX*(1-fDeltaMove);
    2001       fDeltaPosY =fDeltaPosY*(1-fDeltaMove);
     2006      fDeltaPosX =fDeltaPosX*(1-fDeltaRotation);
     2007      fDeltaPosY =fDeltaPosY*(1-fDeltaRotation);
     2008      printf("rotate - %f %f\n",fDeltaPosX,fDeltaPosY);
    20022009    }
    20032010  } else {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc

    r712 r727  
    196196  }
    197197 
    198   printf("Set view to : %f %f %f %f %f %f \n",left, right, bottom, top, pnear, pfar);
    199198  glMatrixMode (GL_MODELVIEW); // apply further transformations to scene.
    200199  glLoadIdentity();
Note: See TracChangeset for help on using the changeset viewer.