------------------------------------------------------------------------------
| 714 | |
| 715 | //------------------------------------------------------------------------------ |
| 716 | void vtkInteractorStyleFlight::FlyByKey(vtkCamera* cam) |
| 717 | { |
| 718 | double speed = this->DiagonalLength * this->MotionStepSize * this->MotionUserScale; |
| 719 | speed = speed * (this->Interactor->GetShiftKey() ? this->MotionAccelerationFactor : 1.0); |
| 720 | if (this->DisableMotion) |
| 721 | { |
| 722 | speed = 0; |
| 723 | } |
| 724 | // |
| 725 | double aspeed = |
| 726 | this->AngleStepSize * (this->Interactor->GetShiftKey() ? this->AngleAccelerationFactor : 1.0); |
| 727 | double a_vector[3]; |
| 728 | // Left and right |
| 729 | if (this->Interactor->GetControlKey()) |
| 730 | { // Sidestep |
| 731 | this->GetLRVector(a_vector, cam); |
| 732 | if (this->KeysDown & 1) |
| 733 | { |
| 734 | this->MotionAlongVector(a_vector, -speed, cam); |
| 735 | } |
| 736 | if (this->KeysDown & 2) |
| 737 | { |
| 738 | this->MotionAlongVector(a_vector, speed, cam); |
| 739 | } |
| 740 | } |
| 741 | else |
| 742 | { |
| 743 | if (this->KeysDown & 1) |
| 744 | { |
| 745 | cam->Yaw(aspeed); |
| 746 | } |
| 747 | if (this->KeysDown & 2) |
| 748 | { |
| 749 | cam->Yaw(-aspeed); |
| 750 | } |
| 751 | } |
| 752 | |
| 753 | // Up and Down |
| 754 | if (this->Interactor->GetControlKey()) |
| 755 | { // Sidestep |
| 756 | cam->GetViewUp(a_vector); |
| 757 | if (this->KeysDown & 4) |
| 758 | { |
| 759 | this->MotionAlongVector(a_vector, -speed, cam); |
| 760 | } |
| 761 | if (this->KeysDown & 8) |
| 762 | { |
| 763 | this->MotionAlongVector(a_vector, speed, cam); |
| 764 | } |
| 765 | } |
| 766 | else |
| 767 | { |
| 768 | if (this->KeysDown & 4) |
| 769 | { |
| 770 | cam->Pitch(-aspeed); |
| 771 | } |
| 772 | if (this->KeysDown & 8) |
| 773 | { |
no test coverage detected