Changeset 712 for trunk/geant4
- Timestamp:
- Feb 5, 2008, 3:17:36 PM (17 years ago)
- Location:
- trunk/geant4
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/specific-geant4-dev.sh
r709 r712 103 103 104 104 export DISTCC_COMPILER="gcc version 4.0.1 (Apple Computer, Inc. build 5370)" 105 export DISTCC_HOSTS="mac-ens 14/3,lzo mac-ens15/3,lzo mac-ens13/3,lzo localhost/1 mac-ens7/3,lzo mac-ens2.local./3,lzo mac-ens8.local./3,lzo mac-ens12.local./3,lzo mac-ens3.local./3,lzo mac-ens4/3,lzo mac-ens13/3,lzo mac-ens9/3,lzo"105 export DISTCC_HOSTS="mac-ens4/3,lzo mac-ens5/3,lzo mac-ens3/3,lzo localhost/1 mac-ens7/3,lzo mac-ens2.local./3,lzo mac-ens8.local./3,lzo mac-ens12.local./3,lzo mac-ens3.local./3,lzo mac-ens4/3,lzo mac-ens13/3,lzo mac-ens9/3,lzo" 106 106 export DISTCC_SYSTEM="10.4.11 (8S165, ppc)" 107 107 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r711 r712 112 112 QPoint fLastPos; 113 113 /** delta of scene translation. This delta is put in % of the scene view */ 114 float fDeltaSceneTranslation; 115 /** delta of left right move. This delta is put in % of the scene view */ 116 float fDeltaZoom; 114 G4double fDeltaSceneTranslation; 115 /** delta of depth move. This delta is put in % of the scene view */ 116 G4double fDeltaDepth; 117 /** delta of zoom move. This delta is put in % of the scene view */ 118 G4double fDeltaZoom; 117 119 /** To ensure key event are keep one by one */ 118 120 bool holdKeyEvent; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh
r606 r712 73 73 void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*); 74 74 void print3DcolorVertex(GLint, GLint*, GLfloat*); 75 GLdouble getSceneNearWidth(); 76 GLdouble getSceneFarWidth(); 77 GLdouble getSceneDepth(); 75 78 G4float pointSize; 76 79 char print_string[50]; -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r711 r712 287 287 ,fContextMenu(0) 288 288 ,fMouseAction(STYLE1) 289 ,fDeltaSceneTranslation(1/100) 290 ,fDeltaZoom(1.1) 289 ,fDeltaSceneTranslation(0.01) 290 ,fDeltaDepth(0.01) 291 ,fDeltaZoom(0.1) 291 292 ,holdKeyEvent(false) 292 293 { … … 1395 1396 void G4OpenGLQtViewer::G4MouseMoveEvent(int dx, int dy, int dz) 1396 1397 { 1397 // 2 1398 // ------------ 0 0 tx 1399 // right - left 1400 // 2 1401 // 0 ------------ 0 ty 1402 // top - bottom 1403 // -2 1404 // 0 0 ------------ tz 1405 // zFar-zNear 1406 // 0 0 0 1 1407 // where 1408 // tx = - (right + left) / (right - left) 1409 // ty = - (top + bottom) / (top - bottom) 1410 // tz = - (zFar + zNear) / (zFar - zNear) 1411 double projection_view[16]; 1412 glGetDoublev (GL_PROJECTION_MATRIX, projection_view); 1413 printf("%f\t%f\t%f\t%f\n",projection_view[0],projection_view[1],projection_view[2],projection_view[3]); 1414 printf("%f\t%f\t%f\t%f\n",projection_view[4],projection_view[5],projection_view[6],projection_view[7]); 1415 printf("%f\t%f\t%f\t%f\n",projection_view[8],projection_view[9],projection_view[10],projection_view[11]); 1416 printf("%f\t%f\t%f\t%f\n",projection_view[12],projection_view[13],projection_view[14],projection_view[15]); 1417 // int deltaX = 1418 // GLenum clip = glGet(GL_CLIP_PLANE); 1419 // int deltaY = ; 1420 1421 1422 G4Point3D stp = GetSceneHandler()->GetScene()->GetStandardTargetPoint(); 1423 1424 G4Point3D tp = stp + fVP.GetCurrentTargetPoint (); 1425 1426 const G4Vector3D& upVector = fVP.GetUpVector (); 1427 const G4Vector3D& vpVector = fVP.GetViewpointDirection (); 1428 1429 G4Vector3D unitRight = (upVector.cross (vpVector)).unit(); 1430 G4Vector3D unitUp = (vpVector.cross (unitRight)).unit(); 1431 1432 #ifdef GEANT4_QT_DEBUG 1433 G4cout << fVP<<G4endl; 1434 printf("Mouse event Target Point : %f %f %f\n",tp.x(),tp.y(),tp.z()); 1435 printf("Mouse event upVector : %f %f %f\n",upVector.x(),upVector.y(),upVector.z()); 1436 printf("Mouse event vpVector Point : %f %f %f\n",vpVector.x(),vpVector.y(),vpVector.z()); 1437 printf("Mouse event unitRight Point : %f %f %f\n",unitRight.x(),unitRight.y(),unitRight.z()); 1438 printf("Mouse event unitUp Point : %f %f %f\n",unitUp.x(),unitUp.y(),unitUp.z()); 1439 #endif 1440 tp += -dx * unitRight + dy * unitUp + dz * vpVector; 1441 fVP.SetCurrentTargetPoint (tp - stp); 1442 1443 updateQWidget(); 1398 GLdouble coefTrans = getSceneNearWidth()*fDeltaSceneTranslation; 1399 GLdouble coefDepth = getSceneDepth()*fDeltaDepth; 1400 1401 printf("Increment : %f %f\n",getSceneNearWidth(),getSceneDepth()); 1402 printf("Increment : %f %f %f \n",-dx*coefTrans,dy*coefTrans,dz*coefDepth); 1403 fVP.IncrementPan(-dx*coefTrans,dy*coefTrans,dz*coefDepth); 1404 1405 updateQWidget(); 1444 1406 } 1445 1407 … … 1807 1769 if ((event->key() == Qt::Key_Down) && (event->modifiers() & Qt::AltModifier )) { // go backward 1808 1770 #endif 1771 #ifdef GEANT4_QT_DEBUG 1772 printf("Alt + Down!!\n"); 1773 #endif 1774 1809 1775 G4MouseMoveEvent(0,0,1); 1810 1776 } … … 1813 1779 #else 1814 1780 else if ((event->key() == Qt::Key_Up) && (event->modifiers() & Qt::AltModifier)) { // go forward 1781 #endif 1782 #ifdef GEANT4_QT_DEBUG 1783 printf("Alt + Up!!\n"); 1815 1784 #endif 1816 1785 G4MouseMoveEvent(0,0,-1); … … 1848 1817 } 1849 1818 if (event->key() == Qt::Key_Plus) { // zoom in 1850 fVP.SetZoomFactor(fVP.GetZoomFactor()* fDeltaZoom);1819 fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+fDeltaZoom)); 1851 1820 updateQWidget(); 1852 1821 } 1853 1822 else if (event->key() == Qt::Key_Minus) { // zoom out 1854 fVP.SetZoomFactor(fVP.GetZoomFactor() /fDeltaZoom);1823 fVP.SetZoomFactor(fVP.GetZoomFactor()*(1-fDeltaZoom)); 1855 1824 updateQWidget(); 1856 1825 } 1857 1826 // with no modifiers 1858 1827 if (!event->modifiers()) { 1828 #ifdef GEANT4_QT_DEBUG 1829 printf("No modifier !!\n"); 1830 #endif 1859 1831 if (event->key() == Qt::Key_Down) { // go down 1860 1832 G4MouseMoveEvent(0,1,0); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc
r688 r712 196 196 } 197 197 198 printf("Set view to : %f %f %f %f %f %f \n",left, right, bottom, top, pnear, pfar); 198 199 glMatrixMode (GL_MODELVIEW); // apply further transformations to scene. 199 200 glLoadIdentity(); … … 724 725 } 725 726 727 GLdouble G4OpenGLViewer::getSceneNearWidth() 728 { 729 const G4Point3D targetPoint 730 = fSceneHandler.GetScene()->GetStandardTargetPoint() 731 + fVP.GetCurrentTargetPoint (); 732 G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius(); 733 if(radius<=0.) radius = 1.; 734 const G4double cameraDistance = fVP.GetCameraDistance (radius); 735 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius); 736 return 2 * fVP.GetFrontHalfHeight (pnear, radius); 737 } 738 739 GLdouble G4OpenGLViewer::getSceneFarWidth() 740 { 741 const G4Point3D targetPoint 742 = fSceneHandler.GetScene()->GetStandardTargetPoint() 743 + fVP.GetCurrentTargetPoint (); 744 G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius(); 745 if(radius<=0.) radius = 1.; 746 const G4double cameraDistance = fVP.GetCameraDistance (radius); 747 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius); 748 const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius); 749 return 2 * fVP.GetFrontHalfHeight (pfar, radius); 750 } 751 752 753 GLdouble G4OpenGLViewer::getSceneDepth() 754 { 755 const G4Point3D targetPoint 756 = fSceneHandler.GetScene()->GetStandardTargetPoint() 757 + fVP.GetCurrentTargetPoint (); 758 G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius(); 759 if(radius<=0.) radius = 1.; 760 const G4double cameraDistance = fVP.GetCameraDistance (radius); 761 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius); 762 return fVP.GetFarDistance (cameraDistance, pnear, radius)- pnear; 763 } 764 765 726 766 void G4OpenGLViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer) 727 767 { -
trunk/geant4/visualization/management/include/G4ViewParameters.hh
r593 r712 210 210 void SetLightsMoveWithCamera (G4bool moves); 211 211 void SetPan (G4double right, G4double up); 212 /** Increment currentTarget point by following X,Y values 213 */ 212 214 void IncrementPan (G4double right, G4double up); 215 /** Increment currentTarget point by following X,Y,Z values 216 */ 217 void IncrementPan (G4double right, G4double up, G4double distance); 213 218 void SetDefaultVisAttributes (const G4VisAttributes&); 214 219 void SetDefaultTextVisAttributes (const G4VisAttributes&); -
trunk/geant4/visualization/management/src/G4ViewParameters.cc
r593 r712 233 233 234 234 void G4ViewParameters::IncrementPan (G4double right, G4double up) { 235 IncrementPan (right,up, 0); 236 } 237 238 void G4ViewParameters::IncrementPan (G4double right, G4double up, G4double distance) { 235 239 G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit(); 236 240 G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit(); 237 fCurrentTargetPoint += right * unitRight + up * unitUp ;241 fCurrentTargetPoint += right * unitRight + up * unitUp + distance * fViewpointDirection; 238 242 } 239 243
Note: See TracChangeset
for help on using the changeset viewer.