Skip to content

Commit

Permalink
Handler3D: Slightly more robust coord system detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenlovegrove committed Nov 22, 2016
1 parent 5eae415 commit 4883643
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/handler/handler.cpp
Expand Up @@ -278,11 +278,13 @@ void Handler3D::MouseMotion(View& display, int x, int y, int button_state)
rotation_changed = true;
}else if( button_state == MouseButtonRight)
{
// Try to correct for different coordinate conventions.
GLprecision aboutx = -rf * delta[1];
GLprecision abouty = rf * delta[0];
OpenGlMatrix& pm = cam_state->GetProjectionMatrix();
abouty *= -pm.m[2*4+3];
GLprecision abouty = -rf * delta[0];

// Try to correct for different coordinate conventions.
if(cam_state->GetProjectionMatrix().m[2*4+3] <= 0) {
abouty *= -1;
}

if(enforce_up) {
// Special case if view direction is parallel to up vector
Expand Down

0 comments on commit 4883643

Please sign in to comment.