Advertisement
atm959

Matrix stuff

Feb 3rd, 2019
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. float aspectRatio = (float)854 / (float)480;
  2. float y_scale = (float)((1.0f / tan(degToRad(FOV / 2.0f))));
  3. float x_scale = y_scale / aspectRatio;
  4. float frustum_length = FAR_PLANE - NEAR_PLANE;
  5.  
  6. projection[0][0] = x_scale;
  7. projection[1][1] = y_scale;
  8. projection[2][2] = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
  9. projection[2][3] = -1;
  10. projection[3][2] = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
  11. projection[3][3] = 0;
  12.  
  13. view[0][0] = 1;
  14. view[1][1] = 1;
  15. view[2][2] = 1;
  16. view[3][3] = 1;
  17.  
  18. model[0][0] = 1;
  19. model[1][1] = 1;
  20. model[2][2] = 1;
  21. model[3][3] = 1;
  22. model[1][3] = 10 * sin(t);
  23. model[2][3] = -10;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement