setProjection.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. return {
  2. tag = 'graphicsState',
  3. summary = 'Set the field of view.',
  4. description = [[
  5. Sets the projection for a single view. 4 field of view angles can be used, similar to the field
  6. of view returned by `lovr.headset.getViewAngles`. Alternatively, a projection matrix can be
  7. used for other types of projections like orthographic, oblique, etc.
  8. Two views are supported, one for each eye. When rendering to the headset, both projections are
  9. changed to match the ones used by the headset.
  10. ]],
  11. arguments = {
  12. view = {
  13. type = 'number',
  14. description = 'The index of the view to update.'
  15. },
  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 projection matrix for the view.'
  35. }
  36. },
  37. returns = {},
  38. variants = {
  39. {
  40. arguments = { 'view', 'left', 'right', 'up', 'down' },
  41. returns = {}
  42. },
  43. {
  44. arguments = { 'view', 'matrix' },
  45. returns = {}
  46. }
  47. },
  48. notes = [[
  49. Non-stereo rendering will only use the first view.
  50. The projection matrices are available as the `mat4 lovrProjections[2]` variable in shaders. The
  51. current projection matrix is available as `lovrProjection`.
  52. ]],
  53. related = {
  54. 'lovr.headset.getViewAngles',
  55. 'lovr.headset.getViewCount',
  56. 'lovr.graphics.getViewPose',
  57. 'lovr.graphics.setViewPose'
  58. }
  59. }