Advertisement
faenil

Untitled

Oct 18th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. qreal radialHeight = current_cam->distance_z * tan(current_cam->FOV * (PI / 360));
  2. qreal aspectRatio = 854.0 / 480.0;
  3. qreal radialWidth = radialHeight * aspectRatio;
  4. //LET'S TURN MOUSE COORDINATES (SCREEN COORDS) INTO EYE SPACE COORDS IN THE MIDDLE PLANE (PLANE AT DISTANCE_Z DISTANCE)
  5. qreal conv_x = ( (mousex / (854.0/2.0)) -1) * radialWidth;
  6. qreal conv_y = ( (mousey / (480.0/2.0)) -1) * radialHeight;
  7.  
  8. qWarning("mouse x,y in eye space"+ QString::number(conv_x).toUtf8() + ", " + QString::number(conv_y).toUtf8());
  9. //STARTING COORDINATES, IN EYE SPACE
  10. current_cam->start_pan_x = conv_x;
  11. current_cam->start_pan_z = conv_y;
  12.  
  13. current_cam->start_x = current_cam->x;
  14. current_cam->start_z = current_cam->z;
  15.  
  16. current_cam->isPanning = true;
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement