Last active
February 3, 2024 15:16
-
-
Save chuwilliamson/6947577654f1c724389df0709ec544ad to your computer and use it in GitHub Desktop.
Camera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Motion(int x, int y) | |
{ | |
if (mouseMoving) | |
{ | |
//get the change in x since mouse down and increment | |
mouse_long += (x - oldX); | |
rLong = Rotation(mouse_long, 'y'); | |
mouse_azi += (x - oldX); | |
//rAzi is x rotation by azi | |
rAzi = Rotation(mouse_azi, 'x'); | |
//get the change in y since mouse down and increment | |
mouse_lat += (y - oldY); | |
rLat = Rotation(mouse_lat, 'x'); | |
mouse_ele += (y - oldY); | |
//rEle is y rotation by ele | |
rEle = Rotation(mouse_ele, 'y'); | |
//Rlat is x rotation by lat and Rlong is y rotation by long | |
//increment long according to horizontal mouse movement and lat according to vertical motion | |
if (cam1) | |
{//r_long * r_lat where r_lat is x-rotation by lat and | |
//r_long is y rotation by long | |
//increment long according to | |
T_c1_w = rLong * rLat; | |
} | |
else if (cam2) | |
{ | |
T_c2_o = T_r_w * T_o_r * rAzi * rEle * Rotation(-90, 'z');; | |
} | |
} | |
//reset the oldX and Y values to prevent the sphere from resetting | |
//itself after clicking a new click event | |
oldX = x; | |
oldY = y; | |
//glutPostRedisplay(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment