reference-libobs-graphics-matrix4.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Matrix
  2. ======
  3. .. code:: cpp
  4. #include <graphics/matrix4.h>
  5. .. type:: struct matrix4
  6. Matrix structure
  7. .. member:: struct vec4 matrix4.x
  8. X component vector
  9. .. member:: struct vec4 matrix4.y
  10. Y component vector
  11. .. member:: struct vec4 matrix4.z
  12. Z component vector
  13. .. member:: struct vec4 matrix4.w
  14. W component vector
  15. ---------------------
  16. .. function:: void matrix4_copy(struct matrix4 *dst, const struct matrix4 *m)
  17. Copies a matrix
  18. :param dst: Destination matrix
  19. :param m: Matrix to copy
  20. ---------------------
  21. .. function:: void matrix4_identity(struct matrix4 *dst)
  22. Sets an identity matrix
  23. :param dst: Destination matrix
  24. ---------------------
  25. .. function:: void matrix4_from_quat(struct matrix4 *dst, const struct quat *q)
  26. Converts a quaternion to a matrix
  27. :param dst: Destination matrix
  28. :param q: Quaternion to convert
  29. ---------------------
  30. .. function:: void matrix4_from_axisang(struct matrix4 *dst, const struct axisang *aa)
  31. Converts an axis angle to a matrix
  32. :param dst: Destination matrix
  33. :param aa: Axis angle to convert
  34. ---------------------
  35. .. function:: void matrix4_mul(struct matrix4 *dst, const struct matrix4 *m1, const struct matrix4 *m2)
  36. Multiples two matrices
  37. :param dst: Destination matrix
  38. :param m1: Matrix 1
  39. :param m2: Matrix 2
  40. ---------------------
  41. .. function:: float matrix4_determinant(const struct matrix4 *m)
  42. Gets the determinant value of a matrix
  43. :param m: Matrix
  44. :return: Determinant
  45. ---------------------
  46. .. function:: void matrix4_translate3v(struct matrix4 *dst, const struct matrix4 *m, const struct vec3 *v)
  47. void matrix4_translate3f(struct matrix4 *dst, const struct matrix4 *m, float x, float y, float z)
  48. Translates the matrix by a 3-component vector
  49. :param dst: Destination matrix
  50. :param m: Matrix to translate
  51. :param v: Translation vector
  52. ---------------------
  53. .. function:: void matrix4_translate4v(struct matrix4 *dst, const struct matrix4 *m, const struct vec4 *v)
  54. Translates the matrix by a 4-component vector
  55. :param dst: Destination matrix
  56. :param m: Matrix to translate
  57. :param v: Translation vector
  58. ---------------------
  59. .. function:: void matrix4_rotate(struct matrix4 *dst, const struct matrix4 *m, const struct quat *q)
  60. Rotates a matrix by a quaternion
  61. :param dst: Destination matrix
  62. :param m: Matrix to rotate
  63. :param q: Rotation quaternion
  64. ---------------------
  65. .. function:: void matrix4_rotate_aa(struct matrix4 *dst, const struct matrix4 *m, const struct axisang *aa)
  66. void matrix4_rotate_aa4f(struct matrix4 *dst, const struct matrix4 *m, float x, float y, float z, float rot)
  67. Rotates a matrix by an axis angle
  68. :param dst: Destination matrix
  69. :param m: Matrix to rotate
  70. :param aa: Rotation anxis angle
  71. ---------------------
  72. .. function:: void matrix4_scale(struct matrix4 *dst, const struct matrix4 *m, const struct vec3 *v)
  73. void matrix4_scale3f(struct matrix4 *dst, const struct matrix4 *m, float x, float y, float z)
  74. Scales each matrix component by the components of a 3-component vector
  75. :param dst: Destination matrix
  76. :param m: Matrix to scale
  77. :param v: Scale vector
  78. ---------------------
  79. .. function:: bool matrix4_inv(struct matrix4 *dst, const struct matrix4 *m)
  80. Inverts a matrix
  81. :param dst: Destination matrix
  82. :param m: Matrix to invert
  83. ---------------------
  84. .. function:: void matrix4_transpose(struct matrix4 *dst, const struct matrix4 *m)
  85. Transposes a matrix
  86. :param dst: Destination matrix
  87. :param m: Matrix to transpose