ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
IBLRotationInteractorLogic.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
12 
13 namespace cloudViewer {
14 namespace visualization {
15 namespace rendering {
16 
18  Camera* camera)
19  : scene_(scene), camera_(camera) {}
20 
21 void IBLRotationInteractorLogic::Rotate(int dx, int dy) {
22  Eigen::Vector3f up = camera_->GetUpVector();
23  Eigen::Vector3f right = -camera_->GetLeftVector();
24  RotateWorld(-dx, -dy, up, right);
27 }
28 
30  Eigen::Vector3f forward = camera_->GetForwardVector();
31  RotateWorld(0, dy, {0, 0, 0}, forward);
34 }
35 
37  ibl_rotation_at_mouse_down_ = scene_->GetIndirectLightRotation();
38  auto identity = Camera::Transform::Identity();
39  Super::SetMouseDownInfo(identity, {0.0f, 0.0f, 0.0f});
40 
41  skybox_currently_visible_ = scene_->GetSkyboxVisible();
42  if (!skybox_currently_visible_) {
43  scene_->ShowSkybox(true);
44  }
45 
46  ClearUI();
47 
49 }
50 
52 
54  ClearUI();
55  if (!skybox_currently_visible_) {
56  scene_->ShowSkybox(false);
57  }
58 }
59 
60 void IBLRotationInteractorLogic::ClearUI() {}
61 
63  return GetMatrix() * ibl_rotation_at_mouse_down_;
64 }
65 
66 } // namespace rendering
67 } // namespace visualization
68 } // namespace cloudViewer
virtual Eigen::Vector3f GetUpVector() const =0
virtual Eigen::Vector3f GetLeftVector() const =0
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition: Camera.h:29
virtual Eigen::Vector3f GetForwardVector() const =0
void RotateZ(int dx, int dy) override
Rotates about the forward axis of the matrix.
void SetMouseDownInfo(const Camera::Transform &matrix, const Eigen::Vector3f &center_of_rotation)
virtual void RotateWorld(int dx, int dy, const Eigen::Vector3f &x_axis, const Eigen::Vector3f &y_axis)
virtual void SetIndirectLightRotation(const Transform &rotation)=0
Generic file read and write utility for python interface.