modeling/src/maths/mat4/add.js

  1. /**
  2. * Adds the two matrices (A+B).
  3. *
  4. * @param {mat4} out - receiving matrix
  5. * @param {mat4} a - first operand
  6. * @param {mat4} b - second operand
  7. * @returns {mat4} out
  8. * @alias module:modeling/maths/mat4.add
  9. */
  10. const add = (out, a, b) => {
  11. out[0] = a[0] + b[0]
  12. out[1] = a[1] + b[1]
  13. out[2] = a[2] + b[2]
  14. out[3] = a[3] + b[3]
  15. out[4] = a[4] + b[4]
  16. out[5] = a[5] + b[5]
  17. out[6] = a[6] + b[6]
  18. out[7] = a[7] + b[7]
  19. out[8] = a[8] + b[8]
  20. out[9] = a[9] + b[9]
  21. out[10] = a[10] + b[10]
  22. out[11] = a[11] + b[11]
  23. out[12] = a[12] + b[12]
  24. out[13] = a[13] + b[13]
  25. out[14] = a[14] + b[14]
  26. out[15] = a[15] + b[15]
  27. return out
  28. }
  29. module.exports = add