vec_mat_operations4.hpp 5.2 KB

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