setViewPose.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. return {
  2. tag = 'graphicsState',
  3. summary = 'Set the camera pose.',
  4. description = [[
  5. Sets the pose for a single view. Objects rendered in this view will appear as though the camera
  6. is positioned using the given pose.
  7. Two views are supported, one for each eye. When rendering to the headset, both views are
  8. changed to match the estimated eye positions. These view poses are also available using
  9. `lovr.headset.getViewPose`.
  10. ]],
  11. arguments = {
  12. view = {
  13. type = 'number',
  14. description = 'The index of the view to update.'
  15. },
  16. x = {
  17. type = 'number',
  18. description = 'The x position of the viewer, in meters.'
  19. },
  20. y = {
  21. type = 'number',
  22. description = 'The y position of the viewer, in meters.'
  23. },
  24. z = {
  25. type = 'number',
  26. description = 'The z position of the viewer, in meters.'
  27. },
  28. angle = {
  29. type = 'number',
  30. description = 'The number of radians the viewer is rotated around its axis of rotation.'
  31. },
  32. ax = {
  33. type = 'number',
  34. description = 'The x component of the axis of rotation.'
  35. },
  36. ay = {
  37. type = 'number',
  38. description = 'The y component of the axis of rotation.'
  39. },
  40. az = {
  41. type = 'number',
  42. description = 'The z component of the axis of rotation.'
  43. },
  44. matrix = {
  45. type = 'Mat4',
  46. description = 'A matrix containing the viewer pose.'
  47. },
  48. inverted = {
  49. type = 'boolean',
  50. description = 'Whether the matrix is an inverted pose (a view matrix).'
  51. }
  52. },
  53. returns = {},
  54. variants = {
  55. {
  56. arguments = { 'view', 'x', 'y', 'z', 'angle', 'ax', 'ay', 'az' },
  57. returns = {}
  58. },
  59. {
  60. arguments = { 'view', 'matrix', 'inverted' },
  61. returns = {}
  62. }
  63. },
  64. notes = [[
  65. Non-stereo rendering will only use the first view.
  66. The inverted view poses (view matrices) are available as the `mat4 lovrViews[2]` variable in
  67. shaders. The current view matrix is available as `lovrView`.
  68. ]],
  69. related = {
  70. 'lovr.headset.getViewPose',
  71. 'lovr.headset.getViewCount',
  72. 'lovr.graphics.getProjection',
  73. 'lovr.graphics.setProjection'
  74. }
  75. }