Changeset 1259 for trunk/source/visualization/OpenGL
- Timestamp:
- May 26, 2010, 2:17:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r1254 r1259 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.cc,v 1. 49 2010/05/20 07:09:33 lgarnierExp $27 // $Id: G4OpenGLQtViewer.cc,v 1.50 2010/05/20 08:13:37 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 114 114 printf("G4OpenGLQtViewer::CreateMainWindow :: ++++++++++++++ add new TAB %s W:%d H:%d SizeHinX:%d SizeHintY:%d\n",name.toStdString().c_str(),getWinWidth(),getWinHeight(),fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY()); 115 115 #endif 116 G4Qt* interactorManager = G4Qt::getInstance ();116 //G4Qt* interactorManager = G4Qt::getInstance (); 117 117 118 118 ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY()); … … 208 208 ,fWindow(0) 209 209 ,fRecordFrameNumber(0) 210 ,fRotationAngleX(0)211 ,fRotationAngleY(0)212 ,fDeltaRotationAngleX(0)213 ,fDeltaRotationAngleY(0)214 210 ,fContextMenu(0) 215 211 ,fMouseAction(STYLE1) … … 231 227 ,fRecordingStep(WAIT) 232 228 ,fProcess(NULL) 229 ,fNbMaxFramesPerSec(100) 230 ,fNbMaxAnglePerSec(360) 233 231 ,fLaunchSpinDelay(100) 234 232 { … … 1478 1476 lastMoveTime.start(); 1479 1477 // try to addapt speed move/rotate looking to drawing speed 1480 int cycles = 4;1478 float correctionFactor = 5; 1481 1479 while (fAutoMove) { 1482 // if ( lastMoveTime.elapsed() > (fSpinningDelay / (cycles/2))) { 1480 if ( lastMoveTime.elapsed () >= (int)(1000/fNbMaxFramesPerSec)) { 1481 float lTime = 1000/((float)lastMoveTime.elapsed ()); 1482 if (((((float)delta.x())/correctionFactor)*lTime > fNbMaxAnglePerSec) || 1483 ((((float)delta.x())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) { 1484 correctionFactor = (float)delta.x()*(lTime/fNbMaxAnglePerSec); 1485 if (delta.x() <0 ) { 1486 correctionFactor = -correctionFactor; 1487 } 1488 } 1489 if (((((float)delta.y())/correctionFactor)*lTime > fNbMaxAnglePerSec) || 1490 ((((float)delta.y())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) { 1491 correctionFactor = (float)delta.y()*(lTime/fNbMaxAnglePerSec); 1492 if (delta.y() <0 ) { 1493 correctionFactor = -correctionFactor; 1494 } 1495 } 1496 1483 1497 if (fMouseAction == STYLE1) { // rotate 1484 rotateQtScene(((float)delta.x())/c ycles,((float)delta.y())/cycles);1498 rotateQtScene(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor); 1485 1499 } else if (fMouseAction == STYLE2) { // move 1486 moveScene(-((float)delta.x())/c ycles,-((float)delta.y())/cycles,0,true);1500 moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true); 1487 1501 } 1502 #ifdef G4DEBUG_VIS_OGL 1503 printf("G4OpenGLQtViewer::G4MouseReleaseEvent Fps:%f x:%d y:%d cycle:%f\n",(float)1000/lastMoveTime.elapsed(),delta.x(),delta.y(),correctionFactor); 1504 #endif 1488 1505 lastMoveTime.start(); 1489 cycles = 1 ;1506 } 1490 1507 ((QApplication*)G4Qt::getInstance ())->processEvents(); 1491 cycles ++ ;1492 1508 } 1493 1509 } … … 2694 2710 fGLWindow = new QDialog(); 2695 2711 #ifdef G4DEBUG_VIS_OGL 2696 printf("G4OpenGLQtViewer::GetParentWidget fGLWindow :%d \n",fGLWindow);2712 printf("G4OpenGLQtViewer::GetParentWidget fGLWindow\n"); 2697 2713 #endif 2698 2714 }
Note: See TracChangeset
for help on using the changeset viewer.