Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- P = perspective(60, 1, .01, 20).transpose().getA()
- glMultMatrixf(P)
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- V_up = np.array([0, 1, 0])
- p_c = np.array(movingCameraPos)
- p_lookup = np.array([0, 0, -(near+far)/2])
- N = p_c - p_lookup
- x_c = np.cross(V_up, N)
- x_c = x_c / np.linalg.norm(x_c)
- z_c = N / np.linalg.norm(N)
- y_c = np.cross(z_c, x_c)
- R = np.eye(4)
- R[0][0:3] = x_c
- R[1][0:3] = y_c
- R[2][0:3] = z_c
- T = translate(p_c * -1)
- RT = (R * T).transpose().getA()
- glMultMatrixf(RT)
- drawScene()
- drawMovingViewVolume()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement