Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add shortcut to rotate camera by 90degrees #14 #1634

Merged
merged 12 commits into from
Sep 27, 2024
1 change: 1 addition & 0 deletions library/private/camera_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class camera_impl : public camera
vector3_t getViewUp() override;
void getViewUp(vector3_t& up) override;
camera& setViewAngle(const angle_deg_t& angle) override;
camera& rotateCamera(const angle_deg_t& angle) override;
angle_deg_t getViewAngle() override;
void getViewAngle(angle_deg_t& angle) override;
camera& setState(const camera_state_t& state) override;
Expand Down
1 change: 1 addition & 0 deletions library/public/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class F3D_EXPORT camera
virtual vector3_t getViewUp() = 0;
virtual void getViewUp(vector3_t& up) = 0;
virtual camera& setViewAngle(const angle_deg_t& angle) = 0;
virtual camera& rotateCamera(const angle_deg_t& angle) = 0;
mwestphal marked this conversation as resolved.
Show resolved Hide resolved
virtual angle_deg_t getViewAngle() = 0;
virtual void getViewAngle(angle_deg_t& angle) = 0;
virtual camera& setState(const camera_state_t& state) = 0;
Expand Down
9 changes: 9 additions & 0 deletions library/src/camera_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@
return *this;
}

//----------------------------------------------------------------------------
camera& camera_impl::rotateCamera(const angle_deg_t& angle)

Check warning on line 113 in library/src/camera_impl.cxx

View check run for this annotation

Codecov / codecov/patch

library/src/camera_impl.cxx#L113

Added line #L113 was not covered by tests
{
vtkCamera* cam = this->GetVTKCamera();
cam->Roll(angle);
this->Internals->VTKRenderer->ResetCameraClippingRange();
return *this;

Check warning on line 118 in library/src/camera_impl.cxx

View check run for this annotation

Codecov / codecov/patch

library/src/camera_impl.cxx#L115-L118

Added lines #L115 - L118 were not covered by tests
}

//----------------------------------------------------------------------------
angle_deg_t camera_impl::getViewAngle()
{
Expand Down
4 changes: 4 additions & 0 deletions library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@
self->SetViewOrbit(ViewType::VT_FRONT, self);
render = true;
break;
case '2':
mwestphal marked this conversation as resolved.
Show resolved Hide resolved
self->Window.getCamera().rotateCamera(90);
render = true;
break;

Check warning on line 329 in library/src/interactor_impl.cxx

View check run for this annotation

Codecov / codecov/patch

library/src/interactor_impl.cxx#L326-L329

Added lines #L326 - L329 were not covered by tests
case '3':
self->SetViewOrbit(ViewType::VT_RIGHT, self);
render = true;
Expand Down