src/ui/canvas.cpp

changeset 103
94719518e310
parent 100
43ce3672648a
child 104
cd4df75924b7
equal deleted inserted replaced
101:910890292639 103:94719518e310
66 const glm::vec3 vector_y = glm::normalize(this->gridMatrix * glm::vec4{0, 1, 0, 1}); 66 const glm::vec3 vector_y = glm::normalize(this->gridMatrix * glm::vec4{0, 1, 0, 1});
67 const float angle_x = std::abs(glm::dot(vector_x, cameraDirection)); 67 const float angle_x = std::abs(glm::dot(vector_x, cameraDirection));
68 const float angle_y = std::abs(glm::dot(vector_y, cameraDirection)); 68 const float angle_y = std::abs(glm::dot(vector_y, cameraDirection));
69 if (angle_x < angle_y) 69 if (angle_x < angle_y)
70 { 70 {
71 this->newStatusText("rotate by X axis");
72 this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{1, 0, 0}); 71 this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{1, 0, 0});
73 } 72 }
74 else 73 else
75 { 74 {
76 this->newStatusText("rotate by Y axis");
77 this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{0, 1, 0}); 75 this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{0, 1, 0});
78 } 76 }
79 this->updateGridMatrix(); 77 this->updateGridMatrix();
80 this->update(); 78 this->update();
81 }
82 else
83 {
84 this->newStatusText("don't rotate");
85 } 79 }
86 PartRenderer::mouseMoveEvent(event); 80 PartRenderer::mouseMoveEvent(event);
87 } 81 }
88 82
89 void Canvas::mousePressEvent(QMouseEvent* event) 83 void Canvas::mousePressEvent(QMouseEvent* event)

mercurial