Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1.         glMatrixMode(GL_PROJECTION)
  2.         glLoadIdentity()
  3.  
  4.         P = perspective(60, 1, .01, 20).transpose().getA()
  5.         glMultMatrixf(P)
  6.  
  7.         glMatrixMode(GL_MODELVIEW)
  8.         glLoadIdentity()
  9.  
  10.         V_up     = np.array([0, 1, 0])
  11.         p_c      = np.array(movingCameraPos)
  12.         p_lookup = np.array([0, 0, -(near+far)/2])
  13.         N        = p_c - p_lookup
  14.  
  15.         x_c = np.cross(V_up, N)
  16.         x_c = x_c / np.linalg.norm(x_c)
  17.         z_c = N / np.linalg.norm(N)
  18.         y_c = np.cross(z_c, x_c)
  19.  
  20.         R = np.eye(4)
  21.         R[0][0:3] = x_c
  22.         R[1][0:3] = y_c
  23.         R[2][0:3] = z_c
  24.  
  25.         T = translate(p_c * -1)
  26.  
  27.         RT = (R * T).transpose().getA()
  28.         glMultMatrixf(RT)
  29.  
  30.         drawScene()
  31.         drawMovingViewVolume()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement