/////////////////////////////////////////////////////////////////////////
| 450 | |
| 451 | ////////////////////////////////////////////////////////////////////////////// |
| 452 | void G4OpenGLWin32Viewer::SetRotation( |
| 453 | G4int dx |
| 454 | ,G4int dy |
| 455 | ) |
| 456 | ////////////////////////////////////////////////////////////////////////////// |
| 457 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
| 458 | { |
| 459 | // Simple ad-hoc algorithms (borrowed from G4Qt3DViewer) |
| 460 | const G4Vector3D& x_prime = fVP.GetViewpointDirection() |
| 461 | .cross(fVP.GetUpVector()); |
| 462 | const G4Vector3D& y_prime = x_prime.cross(fVP.GetViewpointDirection()); |
| 463 | const G4double scale = 200; // Roughly pixels per window, empirically chosen |
| 464 | G4Vector3D newViewpointDirection = fVP.GetViewpointDirection(); |
| 465 | newViewpointDirection += dx*x_prime/scale; |
| 466 | newViewpointDirection += dy*y_prime/scale; |
| 467 | fVP.SetViewpointDirection(newViewpointDirection.unit()); |
| 468 | |
| 469 | if (fVP.GetRotationStyle() == G4ViewParameters::freeRotation) { |
| 470 | G4Vector3D newUpVector = fVP.GetUpVector(); |
| 471 | newUpVector += dx*x_prime/scale; |
| 472 | newUpVector += dy*y_prime/scale; |
| 473 | fVP.SetUpVector(newUpVector.unit()); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | ////////////////////////////////////////////////////////////////////////////// |
| 478 | void G4OpenGLWin32Viewer::SetZoom(G4int delta) |
no test coverage detected