newMat4.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. return {
  2. tag = 'vectors',
  3. summary = 'Create a new Mat4.',
  4. description = 'Creates a new 4D matrix. This function takes the same arguments as `Mat4:set`.',
  5. arguments = {
  6. d = {
  7. type = 'number',
  8. description = 'A number to use for the diagonal elements.'
  9. },
  10. n = {
  11. type = 'Mat4',
  12. description = 'An existing matrix to copy the values from.'
  13. },
  14. position = {
  15. type = 'Vec3',
  16. default = '0, 0, 0',
  17. description = 'The translation of the matrix.'
  18. },
  19. scale = {
  20. type = 'Vec3',
  21. default = '1, 1, 1',
  22. description = 'The scale of the matrix.'
  23. },
  24. rotation = {
  25. type = 'Quat',
  26. default = '0, 0, 0, 1',
  27. description = 'The rotation of the matrix.'
  28. },
  29. ['...'] = {
  30. type = 'number',
  31. description = '16 numbers to use as the raw values of the matrix (column-major).'
  32. }
  33. },
  34. returns = {
  35. m = {
  36. type = 'Mat4',
  37. description = 'The new matrix.'
  38. }
  39. },
  40. variants = {
  41. {
  42. description = 'Sets the matrix to the identity matrix.',
  43. arguments = {},
  44. returns = { 'm' }
  45. },
  46. {
  47. description = 'Copies the values from an existing matrix.',
  48. arguments = { 'n' },
  49. returns = { 'm' }
  50. },
  51. {
  52. arguments = { 'position', 'scale', 'rotation' },
  53. returns = { 'm' }
  54. },
  55. {
  56. arguments = { 'position', 'rotation' },
  57. returns = { 'm' }
  58. },
  59. {
  60. arguments = { '...' },
  61. returns = { 'm' }
  62. },
  63. {
  64. description = 'Sets the diagonal values to a number and everything else to 0.',
  65. arguments = { 'd' },
  66. returns = { 'm' }
  67. }
  68. },
  69. related = {
  70. 'lovr.math.mat4',
  71. 'Mat4',
  72. 'Vectors'
  73. }
  74. }