@@ -85,15 +85,6 @@ struct CameraState {
8585 // update eye and lookat coordinates
8686 eye = glm::vec3 (transformation * glm::vec4 (eye, 1 ));
8787 lookat = glm::vec3 (transformation * glm::vec4 (lookat, 1 ));
88-
89- // try to keep the camera horizontal line correct (eval right axis error)
90- float right_o_up = glm::dot (right_vector, keep_up_axis);
91- float right_handness = glm::dot (glm::cross (keep_up_axis, right_vector), front_vector);
92- float angle_Z_err = glm::asin (right_o_up);
93- angle_Z_err *= glm::atan (right_handness);
94- // rotation for up: cancel out the camera horizontal line drift
95- glm::mat4x4 rotation_matrixZ = glm::rotate (glm::mat4x4 (1 ), angle_Z_err, front_vector);
96- up_vector = glm::mat3x3 (rotation_matrixZ) * up_vector;
9788 }
9889
9990 void zoom (InputCtl::InputPreference const &pref, float delta, bool isHitchcock) {
@@ -180,14 +171,14 @@ void InputCtl::cursor_pos_callback(double xpos, double ypos) {
180171 }
181172 m_private->lastpos = pos;
182173
183- if (m_inputPref.clamp_cursor && !m_private->curclamped && xpos >= width || ypos >= height || xpos <= 0 || ypos <= 0 ) {
174+ if (m_inputPref.clamp_cursor && !m_private->curclamped && ( xpos >= width - 1 || ypos >= height - 1 || xpos <= 1 || ypos <= 1 ) ) {
184175 // clamp mouse cursor inside the window (ZHI JING Blender)
185- xpos = std::fmod (xpos + width, width) ;
186- ypos = std::fmod (ypos + height, height) ;
176+ xpos = std::fmod (xpos + width - 3 , width - 2 ) + 1 ;
177+ ypos = std::fmod (ypos + height - 3 , height - 2 ) + 1 ;
187178 glfwSetCursorPos (m_private->window , xpos, ypos);
188- m_private->curclamped = true ;
179+ /* m_private->curclamped = true; */
189180 } else {
190- m_private->curclamped = false ;
181+ /* m_private->curclamped = false; */
191182 }
192183}
193184
0 commit comments