setProjection.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. return {
  2. tag = 'camera',
  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. Up to 6 views are supported. The Pass returned by `lovr.headset.getPass` will have its views
  9. automatically configured to match 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. near = {
  33. type = 'number',
  34. default = '.01',
  35. description = 'The near clipping plane distance, in meters.'
  36. },
  37. far = {
  38. type = 'number',
  39. default = '0.0',
  40. description = 'The far clipping plane distance, in meters.'
  41. },
  42. matrix = {
  43. type = 'Mat4',
  44. description = 'The projection matrix for the view.'
  45. }
  46. },
  47. returns = {},
  48. variants = {
  49. {
  50. arguments = { 'view', 'left', 'right', 'up', 'down', 'near', 'far' },
  51. returns = {}
  52. },
  53. {
  54. arguments = { 'view', 'matrix' },
  55. returns = {}
  56. }
  57. },
  58. notes = [[
  59. A far clipping plane of 0.0 can be used for an infinite far plane with reversed Z range. This
  60. is the default because it improves depth precision and reduces Z fighting. Using a non-infinite
  61. far plane requires the depth buffer to be cleared to 1.0 instead of 0.0 and the default depth
  62. test to be changed to `lequal` instead of `gequal`.
  63. ]],
  64. related = {
  65. 'lovr.headset.getViewAngles',
  66. 'lovr.headset.getViewCount',
  67. 'Pass:getViewPose',
  68. 'Pass:setViewPose'
  69. }
  70. }