Changeset 933 for trunk/source/visualization
- Timestamp:
- Feb 26, 2009, 12:23:47 PM (16 years ago)
- Location:
- trunk/source/visualization
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r931 r933 160 160 void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line) 161 161 { 162 printf("----1");163 162 G4int nPoints = line.size (); 164 163 if (nPoints <= 0) return; … … 369 368 // Draw... 370 369 if (sizeType == world) { // Size specified in world coordinates. 371 printf("G4OpenGLSceneHandler::AddCircleSquare world\n");372 370 DrawXYPolygon (shape, size, centre, pVA); 373 371 374 372 } else { // Size specified in screen (window) coordinates. 375 printf("G4OpenGLSceneHandler::AddCircleSquare screen bitmap size:%d\n",size); 376 377 int test=3; 378 if (test == 1) { 379 // Find window coordinates of centre... 380 GLdouble modelMatrix[16]; 381 glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); 382 G4double projectionMatrix[16]; 383 glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix); 384 GLint viewport[4]; 385 glGetIntegerv(GL_VIEWPORT,viewport); 386 GLdouble winx, winy, winz; 387 gluProject(centre.x(), centre.y(), centre.z(), 388 modelMatrix, projectionMatrix, viewport, 389 &winx, &winy, &winz); 390 391 // Determine ratio window:world... 392 const G4Vector3D& viewpointDirection = 393 fpViewer -> GetViewParameters().GetViewpointDirection(); 394 const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector(); 395 const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit(); 396 const G4Vector3D p = centre + inScreen; 397 GLdouble winDx, winDy, winDz; 398 gluProject(p.x(), p.y(), p.z(), 399 modelMatrix, projectionMatrix, viewport, 400 &winDx, &winDy, &winDz); 401 G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) + 402 std::pow(winy - winDy, 2)); 403 DrawXYPolygon (shape, size/winWorldRatio, centre, pVA); 404 405 } else if (test == 2) { 406 // glMatrixMode(GL_PROJECTION); 407 glPushMatrix(); 408 // glLoadIdentity(); 409 // gluOrtho2D(0.0,640.0,480.0,10.0); 410 411 // glDisable(GL_DEPTH_TEST); 412 glRotatef (30, 0, -1, 0); 413 glRotatef (20, -1, 0, 0); 414 glRotatef (50, 0, 0, -1); 415 DrawXYPolygon (shape, size, centre, pVA); 416 417 418 glPopMatrix(); 419 420 // glMatrixMode(GL_MODELVIEW); 421 // glEnable(GL_DEPTH_TEST); 422 } else if (test == 3){ // Avec DrawPolygone, mais en forcant 423 424 glPointSize (size); 425 glBegin (GL_POINTS); 426 glVertex3f(centre.x(),centre.y(),centre.z()); 427 glEnd(); 428 //Antialiasing sur les points 429 glEnable (GL_POINT_SMOOTH); 430 //Gestion de la transparence 431 glEnable(GL_BLEND); 432 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 433 434 // const G4Point3D targetPoint 435 // = fSceneHandler.GetScene()->GetStandardTargetPoint() 436 // + fVP.GetCurrentTargetPoint (); 437 // G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius(); 438 // if(radius<=0.) radius = 1.; 439 // const G4double cameraDistance = fVP.GetCameraDistance (radius); 440 // const G4Point3D cameraPosition = 441 // targetPoint + cameraDistance * fVP.GetViewpointDirection().unit(); 442 } else { 443 glRasterPos3d(centre.x(),centre.y(),centre.z()); 444 const GLubyte* marker = 445 G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 446 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 447 glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 448 } 373 glPointSize (size); 374 glBegin (GL_POINTS); 375 glVertex3f(centre.x(),centre.y(),centre.z()); 376 glEnd(); 377 //Antialiasing 378 glEnable (GL_POINT_SMOOTH); 379 //Transparency 380 glEnable(GL_BLEND); 381 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 382 // glRasterPos3d(centre.x(),centre.y(),centre.z()); 383 // const GLubyte* marker = 384 // G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 385 // glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 386 // glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 449 387 } 450 388 } -
trunk/source/visualization/management/History
r912 r933 1 $Id: History,v 1.11 5 2009/01/22 15:39:55lgarnier Exp $1 $Id: History,v 1.116 2009/02/25 18:28:00 lgarnier Exp $ 2 2 3 3 ------------------------------------------------------------------- … … 26 26 History file for visualization management sub-category 27 27 ------------------------------------------------------ 28 29 25th February 2009 Laurent Garnier 30 - Notify handler send by G4VVisManager is implemented in G4VisManager 28 31 29 32 22th January 2009 Laurent Garnier -
trunk/source/visualization/management/include/G4VisManager.hh
r907 r933 25 25 // 26 26 // 27 // $Id: G4VisManager.hh,v 1. 69 2009/01/13 09:55:15lgarnier Exp $27 // $Id: G4VisManager.hh,v 1.70 2009/02/25 18:28:00 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 300 300 void GeometryHasChanged (); 301 301 // Used by run manager to notify change. 302 303 void NotifyHandlers(); 304 // Notify scene handlers (G4VGraphicsScene objects) that the scene 305 // has changed so that they may rebuild their graphics database, if 306 // any, and redraw all views. 302 307 303 308 void DispatchToModel(const G4VTrajectory&, G4int i_mode); -
trunk/source/visualization/management/src/G4VisManager.cc
r907 r933 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VisManager.cc,v 1.11 6 2009/01/13 09:55:15lgarnier Exp $26 // $Id: G4VisManager.cc,v 1.117 2009/02/25 18:28:00 lgarnier Exp $ 27 27 // GEANT4 tag $Name: $ 28 28 // … … 800 800 801 801 } 802 void G4VisManager::NotifyHandlers () { 803 804 if (fVerbosity >= confirmations) { 805 G4cout << "G4VisManager::NotifyHandler() called." << G4endl; 806 } 807 808 // Check scenes. 809 G4SceneList& sceneList = fSceneList; 810 G4int iScene, nScenes = sceneList.size (); 811 for (iScene = 0; iScene < nScenes; iScene++) { 812 G4Scene* pScene = sceneList [iScene]; 813 std::vector<G4VModel*>& modelList = pScene -> SetRunDurationModelList (); 814 815 if (modelList.size ()) { 816 pScene->CalculateExtent(); 817 G4UImanager::GetUIpointer () -> 818 ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName())); 819 } 820 } 821 822 // Check the manager's current scene... 823 if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) { 824 if (fVerbosity >= warnings) { 825 G4cout << "WARNING: The current scene \"" 826 << fpScene -> GetName () 827 << "\" has no models." 828 << G4endl; 829 } 830 } 831 832 } 802 833 803 834 G4bool G4VisManager::FilterTrajectory(const G4VTrajectory& trajectory) -
trunk/source/visualization/modeling/include/G4ModelApplyCommandsT.hh
r931 r933 552 552 Apply(newValue); 553 553 G4VVisManager* visManager = G4VVisManager::GetConcreteInstance(); 554 printf("G4ModelApplyCommand 8 :%d\n",visManager); 554 555 if (visManager) visManager->NotifyHandlers(); 555 556 }
Note: See TracChangeset
for help on using the changeset viewer.