vec_mat_operations4.hpp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //Copyright (c) 2008-2017 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_QVM_187092DA6454CEB1853E6915F8466A4
  5. #define BOOST_QVM_187092DA6454CEB1853E6915F8466A4
  6. //This file was generated by a program. Do not edit manually.
  7. #include <boost/qvm/deduce_vec.hpp>
  8. #include <boost/qvm/enable_if.hpp>
  9. #include <boost/qvm/inline.hpp>
  10. #include <boost/qvm/mat_traits.hpp>
  11. #include <boost/qvm/vec_traits.hpp>
  12. namespace
  13. boost
  14. {
  15. namespace
  16. qvm
  17. {
  18. template <class A,class B>
  19. BOOST_QVM_INLINE_OPERATIONS
  20. typename lazy_enable_if_c<
  21. mat_traits<A>::rows==4 && mat_traits<A>::cols==4 &&
  22. vec_traits<B>::dim==4,
  23. deduce_vec2<A,B,4> >::type
  24. operator*( A const & a, B const & b )
  25. {
  26. typedef typename mat_traits<A>::scalar_type Ta;
  27. typedef typename vec_traits<B>::scalar_type Tb;
  28. Ta const a00 = mat_traits<A>::template read_element<0,0>(a);
  29. Ta const a01 = mat_traits<A>::template read_element<0,1>(a);
  30. Ta const a02 = mat_traits<A>::template read_element<0,2>(a);
  31. Ta const a03 = mat_traits<A>::template read_element<0,3>(a);
  32. Ta const a10 = mat_traits<A>::template read_element<1,0>(a);
  33. Ta const a11 = mat_traits<A>::template read_element<1,1>(a);
  34. Ta const a12 = mat_traits<A>::template read_element<1,2>(a);
  35. Ta const a13 = mat_traits<A>::template read_element<1,3>(a);
  36. Ta const a20 = mat_traits<A>::template read_element<2,0>(a);
  37. Ta const a21 = mat_traits<A>::template read_element<2,1>(a);
  38. Ta const a22 = mat_traits<A>::template read_element<2,2>(a);
  39. Ta const a23 = mat_traits<A>::template read_element<2,3>(a);
  40. Ta const a30 = mat_traits<A>::template read_element<3,0>(a);
  41. Ta const a31 = mat_traits<A>::template read_element<3,1>(a);
  42. Ta const a32 = mat_traits<A>::template read_element<3,2>(a);
  43. Ta const a33 = mat_traits<A>::template read_element<3,3>(a);
  44. Tb const b0 = vec_traits<B>::template read_element<0>(b);
  45. Tb const b1 = vec_traits<B>::template read_element<1>(b);
  46. Tb const b2 = vec_traits<B>::template read_element<2>(b);
  47. Tb const b3 = vec_traits<B>::template read_element<3>(b);
  48. typedef typename deduce_vec2<A,B,4>::type R;
  49. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==4);
  50. R r;
  51. vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1+a02*b2+a03*b3;
  52. vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1+a12*b2+a13*b3;
  53. vec_traits<R>::template write_element<2>(r)=a20*b0+a21*b1+a22*b2+a23*b3;
  54. vec_traits<R>::template write_element<3>(r)=a30*b0+a31*b1+a32*b2+a33*b3;
  55. return r;
  56. }
  57. namespace
  58. sfinae
  59. {
  60. using ::boost::qvm::operator*;
  61. }
  62. namespace
  63. qvm_detail
  64. {
  65. template <int R,int C>
  66. struct mul_mv_defined;
  67. template <>
  68. struct
  69. mul_mv_defined<4,4>
  70. {
  71. static bool const value=true;
  72. };
  73. }
  74. template <class A,class B>
  75. BOOST_QVM_INLINE_OPERATIONS
  76. typename lazy_enable_if_c<
  77. mat_traits<B>::rows==4 && mat_traits<B>::cols==4 &&
  78. vec_traits<A>::dim==4,
  79. deduce_vec2<A,B,4> >::type
  80. operator*( A const & a, B const & b )
  81. {
  82. typedef typename vec_traits<A>::scalar_type Ta;
  83. typedef typename mat_traits<B>::scalar_type Tb;
  84. Ta const a0 = vec_traits<A>::template read_element<0>(a);
  85. Ta const a1 = vec_traits<A>::template read_element<1>(a);
  86. Ta const a2 = vec_traits<A>::template read_element<2>(a);
  87. Ta const a3 = vec_traits<A>::template read_element<3>(a);
  88. Tb const b00 = mat_traits<B>::template read_element<0,0>(b);
  89. Tb const b01 = mat_traits<B>::template read_element<0,1>(b);
  90. Tb const b02 = mat_traits<B>::template read_element<0,2>(b);
  91. Tb const b03 = mat_traits<B>::template read_element<0,3>(b);
  92. Tb const b10 = mat_traits<B>::template read_element<1,0>(b);
  93. Tb const b11 = mat_traits<B>::template read_element<1,1>(b);
  94. Tb const b12 = mat_traits<B>::template read_element<1,2>(b);
  95. Tb const b13 = mat_traits<B>::template read_element<1,3>(b);
  96. Tb const b20 = mat_traits<B>::template read_element<2,0>(b);
  97. Tb const b21 = mat_traits<B>::template read_element<2,1>(b);
  98. Tb const b22 = mat_traits<B>::template read_element<2,2>(b);
  99. Tb const b23 = mat_traits<B>::template read_element<2,3>(b);
  100. Tb const b30 = mat_traits<B>::template read_element<3,0>(b);
  101. Tb const b31 = mat_traits<B>::template read_element<3,1>(b);
  102. Tb const b32 = mat_traits<B>::template read_element<3,2>(b);
  103. Tb const b33 = mat_traits<B>::template read_element<3,3>(b);
  104. typedef typename deduce_vec2<A,B,4>::type R;
  105. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==4);
  106. R r;
  107. vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10+a2*b20+a3*b30;
  108. vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11+a2*b21+a3*b31;
  109. vec_traits<R>::template write_element<2>(r)=a0*b02+a1*b12+a2*b22+a3*b32;
  110. vec_traits<R>::template write_element<3>(r)=a0*b03+a1*b13+a2*b23+a3*b33;
  111. return r;
  112. }
  113. namespace
  114. sfinae
  115. {
  116. using ::boost::qvm::operator*;
  117. }
  118. namespace
  119. qvm_detail
  120. {
  121. template <int R,int C>
  122. struct mul_vm_defined;
  123. template <>
  124. struct
  125. mul_vm_defined<4,4>
  126. {
  127. static bool const value=true;
  128. };
  129. }
  130. }
  131. }
  132. #endif