transform.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. return {
  2. tag = 'graphicsTransforms',
  3. summary = 'Apply a general transform to the coordinate system.',
  4. description = [[
  5. Apply a transform to the coordinate system, changing its translation, rotation, and scale using
  6. a single function. A `mat4` can also be used.
  7. The transformation will last until `lovr.draw` returns or the transformation is popped off the
  8. transformation stack.
  9. ]],
  10. arguments = {
  11. transform = {
  12. type = 'mat4',
  13. description = 'The mat4 to apply to the coordinate system.'
  14. },
  15. x = {
  16. type = 'number',
  17. default = 0,
  18. description = 'The x component of the translation.'
  19. },
  20. y = {
  21. type = 'number',
  22. default = 0,
  23. description = 'The y component of the translation.'
  24. },
  25. z = {
  26. type = 'number',
  27. default = 0,
  28. description = 'The z component of the translation.'
  29. },
  30. sx = {
  31. type = 'number',
  32. default = 1,
  33. description = 'The x scale factor.'
  34. },
  35. sy = {
  36. type = 'number',
  37. default = 1,
  38. description = 'The y scale factor.'
  39. },
  40. sz = {
  41. type = 'number',
  42. default = 1,
  43. description = 'The z scale factor.'
  44. },
  45. angle = {
  46. type = 'number',
  47. default = 0,
  48. description = 'The number of radians to rotate around the rotation axis.'
  49. },
  50. ax = {
  51. type = 'number',
  52. default = 0,
  53. description = 'The x component of the axis of rotation.'
  54. },
  55. ay = {
  56. type = 'number',
  57. default = 1,
  58. description = 'The y component of the axis of rotation.'
  59. },
  60. az = {
  61. type = 'number',
  62. default = 0,
  63. description = 'The z component of the axis of rotation.'
  64. }
  65. },
  66. returns = {},
  67. variants = {
  68. {
  69. arguments = { 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az' },
  70. returns = {}
  71. },
  72. {
  73. description = 'Modify the coordinate system using a mat4 object.',
  74. arguments = { 'transform' },
  75. returns = {}
  76. }
  77. },
  78. related = {
  79. 'lovr.graphics.rotate',
  80. 'lovr.graphics.scale',
  81. 'lovr.graphics.translate'
  82. }
  83. }