getProjection.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. return {
  2. tag = 'graphicsState',
  3. summary = 'Get the field of view.',
  4. description = 'Returns the projection for a single view.',
  5. arguments = {
  6. view = {
  7. type = 'number',
  8. description = 'The view index.'
  9. },
  10. matrix = {
  11. type = 'Mat4',
  12. description = 'The matrix to fill with the projection.'
  13. }
  14. },
  15. returns = {
  16. left = {
  17. type = 'number',
  18. description = 'The left field of view angle, in radians.'
  19. },
  20. right = {
  21. type = 'number',
  22. description = 'The right field of view angle, in radians.'
  23. },
  24. up = {
  25. type = 'number',
  26. description = 'The top field of view angle, in radians.'
  27. },
  28. down = {
  29. type = 'number',
  30. description = 'The bottom field of view angle, in radians.'
  31. },
  32. matrix = {
  33. type = 'Mat4',
  34. description = 'The matrix containing the projection.'
  35. }
  36. },
  37. variants = {
  38. {
  39. arguments = { 'view' },
  40. returns = { 'left', 'right', 'up', 'down' }
  41. },
  42. {
  43. arguments = { 'view', 'matrix' },
  44. returns = { 'matrix' }
  45. }
  46. },
  47. notes = [[
  48. Non-stereo rendering will only use the first view.
  49. The projection matrices are available as the `mat4 lovrProjections[2]` variable in shaders. The
  50. current projection matrix is available as `lovrProjection`.
  51. ]],
  52. related = {
  53. 'lovr.headset.getViewAngles',
  54. 'lovr.headset.getViewCount',
  55. 'lovr.graphics.getViewPose',
  56. 'lovr.graphics.setViewPose'
  57. }
  58. }