mul.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. return {
  2. summary = 'Multiply a matrix with another matrix or a vector.',
  3. description = [[
  4. Multiplies this matrix by another value. Multiplying by a matrix combines their two transforms
  5. together. Multiplying by a vector applies the transformation from the matrix to the vector and
  6. returns the vector.
  7. ]],
  8. arguments = {
  9. n = {
  10. type = 'Mat4',
  11. description = 'The matrix.'
  12. },
  13. v3 = {
  14. type = 'Vec3',
  15. description = 'A 3D vector, treated as a point.'
  16. },
  17. v4 = {
  18. type = 'Vec4',
  19. description = 'A 4D vector.'
  20. }
  21. },
  22. returns = {
  23. m = {
  24. type = 'Mat4',
  25. description = 'The original matrix, containing the result.'
  26. },
  27. v3 = {
  28. type = 'Vec3',
  29. description = 'The transformed vector.'
  30. },
  31. v4 = {
  32. type = 'Vec4',
  33. description = 'The transformed vector.'
  34. }
  35. },
  36. variants = {
  37. {
  38. arguments = { 'n' },
  39. returns = { 'm' }
  40. },
  41. {
  42. arguments = { 'v3' },
  43. returns = { 'v3' }
  44. },
  45. {
  46. arguments = { 'v4' },
  47. returns = { 'v4' }
  48. }
  49. },
  50. notes = [[
  51. When multiplying by a vec4, the vector is treated as either a point if its w component is 1, or
  52. a direction vector if the w is 0 (the matrix translation won't be applied).
  53. ]],
  54. related = {
  55. 'Mat4:translate',
  56. 'Mat4:rotate',
  57. 'Mat4:scale'
  58. }
  59. }