Advertisement
faenil

Untitled

Oct 17th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. qreal conv_x = ( (mousex / (854.0/2.0)) -1);
  2. qreal conv_y = ( (mousey / (480.0/2.0)) -1);
  3.  
  4. QVector3D nearPlane(conv_x, conv_y, -1);
  5. QVector3D farPlane(conv_x, conv_y, +1);
  6.  
  7. //Multiply per the inverted ModelView matrix, to get world space coordinates
  8. nearPlane = nearPlane * cam_m.inverted(); // 3d vector * 4x4matrix...
  9. farPlane = farPlane * cam_m.inverted();
  10.  
  11. QVector3D direction = nearPlane - farPlane;
  12.  
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement